{
  "openapi": "3.1.0",
  "info": {
    "title": "Dench API",
    "version": "1.0.0",
    "description": "Versioned Dench workspace API. The operation registry is shared with the Dench CLI parity layer, so every CLI command maps to an endpoint here."
  },
  "servers": [
    {
      "url": "https://www.dench.com/api/v1"
    }
  ],
  "tags": [
    {
      "name": "agent-config",
      "description": "Agent Config operations."
    },
    {
      "name": "approvals",
      "description": "Approvals operations."
    },
    {
      "name": "apps",
      "description": "Apps operations."
    },
    {
      "name": "auth",
      "description": "Auth operations."
    },
    {
      "name": "billing",
      "description": "Billing operations."
    },
    {
      "name": "browser",
      "description": "Browser operations."
    },
    {
      "name": "campaigns",
      "description": "Campaigns operations."
    },
    {
      "name": "chat",
      "description": "Chat operations."
    },
    {
      "name": "crm",
      "description": "Crm operations."
    },
    {
      "name": "email",
      "description": "Email operations."
    },
    {
      "name": "environments",
      "description": "Environments operations."
    },
    {
      "name": "files",
      "description": "Files operations."
    },
    {
      "name": "gateway",
      "description": "Gateway operations."
    },
    {
      "name": "lists",
      "description": "Lists operations."
    },
    {
      "name": "local",
      "description": "Local operations."
    },
    {
      "name": "meetings",
      "description": "Meetings operations."
    },
    {
      "name": "members",
      "description": "Members operations."
    },
    {
      "name": "memory",
      "description": "Memory operations."
    },
    {
      "name": "meta",
      "description": "Meta operations."
    },
    {
      "name": "notifications",
      "description": "Notifications operations."
    },
    {
      "name": "routines",
      "description": "Routines operations."
    },
    {
      "name": "secrets",
      "description": "Secrets operations."
    },
    {
      "name": "settings",
      "description": "Settings operations."
    },
    {
      "name": "workspace",
      "description": "Workspace operations."
    }
  ],
  "paths": {
    "/environments": {
      "get": {
        "operationId": "environments_list",
        "tags": [
          "environments"
        ],
        "summary": "List workspace-shared reusable setups and ready revisions (metadata only)",
        "description": "List workspace-shared reusable setups and ready revisions (metadata only).",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/environments/{name}": {
      "get": {
        "operationId": "environments_get",
        "tags": [
          "environments"
        ],
        "summary": "Inspect a saved setup, its manifest, and an optional immutable revision",
        "description": "Inspect a saved setup, its manifest, and an optional immutable revision.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "revision",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "environments_save",
        "tags": [
          "environments"
        ],
        "summary": "Publish an explicitly saved source and manifest for one-time preparation. Returns pending/building until verified; does not run the task",
        "description": "Publish an explicitly saved source and manifest for one-time preparation. Returns pending/building until verified; does not run the task.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "manifest": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "number",
                        "const": 1
                      },
                      "name": {
                        "type": "string"
                      },
                      "purpose": {
                        "type": "string"
                      },
                      "files": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "prepare": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "verify": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "env": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "secretEnv": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "secretFiles": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "path": {
                              "type": "string"
                            },
                            "secret": {
                              "type": "string"
                            },
                            "mutable": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "path",
                            "secret"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "statePaths": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "portable": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "version",
                      "name",
                      "purpose",
                      "files",
                      "prepare",
                      "verify"
                    ],
                    "additionalProperties": false
                  },
                  "uploadId": {
                    "type": "string"
                  },
                  "storageId": {
                    "type": "string"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "manifest",
                  "uploadId",
                  "storageId",
                  "sha256"
                ]
              },
              "example": {
                "manifest": {},
                "uploadId": "string",
                "storageId": "string",
                "sha256": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "environments_delete",
        "tags": [
          "environments"
        ],
        "summary": "Retire a saved setup from new selection; retain immutable revisions and active job evidence",
        "description": "Retire a saved setup from new selection; retain immutable revisions and active job evidence.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/environments/uploads": {
      "post": {
        "operationId": "environments_upload",
        "tags": [
          "environments"
        ],
        "summary": "Reserve an owner-bound source upload. Prefix the uploaded bytes with the returned proof before saving",
        "description": "Reserve an owner-bound source upload. Prefix the uploaded bytes with the returned proof before saving.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "source"
                  },
                  "size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 16777216
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "kind",
                  "size",
                  "sha256"
                ]
              },
              "example": {
                "kind": "string",
                "size": 0,
                "sha256": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/local/environments/run": {
      "post": {
        "operationId": "environments_run",
        "tags": [
          "environments"
        ],
        "summary": "Run a command with prepared dependencies and declared credentials, saving declared state with a revision check",
        "description": "Run a command with prepared dependencies and declared credentials, saving declared state with a revision check.",
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local-only CLI operation. Execution occurs in the CLI process. Use dench env run NAME -- COMMAND; secret-bearing execution resolution is not a general REST read endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "Execution occurs in the CLI process. Use dench env run NAME -- COMMAND; secret-bearing execution resolution is not a general REST read endpoint.",
                    "type": "invalid_request_error",
                    "code": "local_only"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/secrets": {
      "get": {
        "operationId": "secrets_list",
        "tags": [
          "secrets"
        ],
        "summary": "List workspace-shared credential names, kinds and versions; never values",
        "description": "List workspace-shared credential names, kinds and versions; never values.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/secrets/{name}": {
      "put": {
        "operationId": "secrets_set",
        "tags": [
          "secrets"
        ],
        "summary": "Encrypt a workspace credential. Use CLI stdin or the secure chat form; return metadata only. Do not put values in chat, manifests or scripts",
        "description": "Encrypt a workspace credential. Use CLI stdin or the secure chat form; return metadata only. Do not put values in chat, manifests or scripts.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z][A-Z0-9_]{0,127}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "env",
                      "file"
                    ]
                  },
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 65536
                  },
                  "expectedVersion": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "value"
                ]
              },
              "example": {
                "kind": "env",
                "value": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "env",
                        "file"
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "revision": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string",
                      "const": "stored"
                    }
                  },
                  "required": [
                    "name",
                    "kind",
                    "version",
                    "revision",
                    "status"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "secrets_delete",
        "tags": [
          "secrets"
        ],
        "summary": "Revoke a workspace credential for future resolution, optionally checking its version",
        "description": "Revoke a workspace credential for future resolution, optionally checking its version.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z][A-Z0-9_]{0,127}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedVersion": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/drafts": {
      "post": {
        "operationId": "campaigns_drafts_create",
        "tags": [
          "campaigns"
        ],
        "summary": "Create an idempotent empty campaign draft with the caller's available sender pools. Does not launch or send",
        "description": "Create an idempotent empty campaign draft with the caller's available sender pools. Does not launch or send.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientRequestId": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 64,
                    "description": "Your stable id for this request, 8-64 characters. Retrying with the same id returns the same draft instead of creating another."
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "timezone": {
                    "description": "IANA timezone, e.g. America/Los_Angeles. Sets a Mon-Fri 9-18 send window in it; without one the draft has no send window.",
                    "type": "string"
                  },
                  "emailMailboxAccountIds": {
                    "description": "Mailboxes to send from instead of your own running ones. Checked as the draft is created: one you can't use creates nothing.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "linkedinAccountIds": {
                    "description": "LinkedIn accounts to send from instead of your own running ones. Checked as the draft is created.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": [
                  "clientRequestId"
                ]
              },
              "example": {
                "clientRequestId": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sequenceId": {
                      "type": "string"
                    },
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "sequenceId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/audience/search": {
      "post": {
        "operationId": "campaigns_audience_search",
        "tags": [
          "campaigns"
        ],
        "summary": "Search people by filters without adding CRM records or campaign recipients. Search credits apply; this is not a free provider preview",
        "description": "Search people by filters without adding CRM records or campaign recipients. Search credits apply; this is not a free provider preview.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sequenceId": {
                    "type": "string"
                  },
                  "filters": {
                    "type": "object",
                    "properties": {
                      "linkedinUrl": {
                        "type": "string"
                      },
                      "fullName": {
                        "type": "string"
                      },
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "keywords": {
                        "description": "Current-title text only. For profile or work descriptions, use profileKeywords. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "type": "string"
                      },
                      "companyDomain": {
                        "type": "string"
                      },
                      "companyName": {
                        "type": "string"
                      },
                      "titles": {
                        "description": "Current job titles (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "pastTitles": {
                        "description": "Past job titles (free text).",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "personNames": {
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "pastSeniorities": {
                        "description": "Seniority in any past role, independent of pastCompanyNames/pastTitles. Current seniority vocabulary plus Founding Team. Founder includes Co-Founder; C-level and Founding Team do not imply founder. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "profileKeywords": {
                        "description": "Text in headline/about or any current/past work description. OR includes, global exclusions. Always loose text matching; missing evidence does not match.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "companyKeywords": {
                        "description": "Current employer business focus/model (e.g. SaaS, B2B, Cloud), from description/tagline/business tags; distinct from legal companyTypes. Same employer as other current-job filters. Always loose text matching. May need another filter to retrieve candidates.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "seniorities": {
                        "description": "Exact enum: Owner, Founder, C-level, Partner, VP, Head, Director, Manager, Senior.",
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "jobFunctions": {
                        "description": "Exact enum, e.g. Sales, Marketing, Software. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "subFunctions": {
                        "description": "Exact enum, e.g. SDR/BDR, Demand Generation. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "industries": {
                        "description": "Exact enum, e.g. Software Development. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "locations": {
                        "description": "Person locations — cities, states, countries, or metros (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "headcountRanges": {
                        "description": "Exact buckets: 1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10001+.",
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "companyNames": {
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "pastCompanyNames": {
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "companyDomains": {
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "companyHeadquarters": {
                        "description": "Company HQ locations — cities, states, countries, or metros (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "companyTypes": {
                        "description": "Exact enum: Partnership, Nonprofit, Educational, Privately Held, Public Company, Self-Owned, Self-Employed, Government Agency.",
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "universities": {
                        "description": "Universities attended (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "skills": {
                        "description": "Profile skills (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "languages": {
                        "description": "Spoken languages, e.g. English, German. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "yearsInRole": {
                        "type": "object",
                        "properties": {
                          "min": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "additionalProperties": false
                      },
                      "yearsAtCompany": {
                        "type": "object",
                        "properties": {
                          "min": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "additionalProperties": false
                      },
                      "daysSinceJobChange": {
                        "type": "object",
                        "properties": {
                          "min": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "additionalProperties": false
                      },
                      "foundedYears": {
                        "description": "Company founded-year range, e.g. {min: 2015, max: 2024}.",
                        "type": "object",
                        "properties": {
                          "min": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "additionalProperties": false
                      },
                      "exactMatch": {
                        "description": "Match free-text filters as whole strings. Default false: titles ['Founder'] also returns 'Co-Founder' and 'Founder & CEO'. Set true to narrow. Domains, LinkedIn URLs, enum filters and numeric ranges are always exact; keywords is always a loose text probe.",
                        "type": "boolean"
                      },
                      "preferCache": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "pageToken": {
                    "type": "string"
                  }
                },
                "required": [
                  "filters"
                ]
              },
              "example": {
                "filters": {}
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    "people": {
                      "type": "array",
                      "items": {}
                    },
                    "recipients": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": "string"
                          },
                          "linkedinProfileUrl": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string"
                          },
                          "personalization": {
                            "description": "Merge values keyed by name, e.g. {\"Company\":\"Acme\"} for {{Company}}.",
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "additionalProperties": false,
                        "description": "One person. Needs email and/or linkedinProfileUrl; unknown keys are rejected, not dropped."
                      }
                    },
                    "metadata": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "estimatedCents": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The search cost ceiling reported by Dench billing, in cents. Null means the receipt is unavailable."
                    },
                    "chargedCents": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The actual search charge reported by Dench billing, in cents. Null means the receipt is unavailable; results remain valid."
                    }
                  },
                  "required": [
                    "rows",
                    "people",
                    "recipients",
                    "metadata",
                    "estimatedCents",
                    "chargedCents"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/people/search": {
      "post": {
        "operationId": "campaigns_people_addFromSearch",
        "tags": [
          "campaigns"
        ],
        "summary": "Search and add up to 50 people to an existing campaign. New identities become Leads. Search credits apply; use nextPageToken for another page",
        "description": "Search and add up to 50 people to an existing campaign. New identities become Leads. Search credits apply; use nextPageToken for another page.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filters": {
                    "type": "object",
                    "properties": {
                      "linkedinUrl": {
                        "type": "string"
                      },
                      "fullName": {
                        "type": "string"
                      },
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "keywords": {
                        "description": "Current-title text only. For profile or work descriptions, use profileKeywords. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "type": "string"
                      },
                      "companyDomain": {
                        "type": "string"
                      },
                      "companyName": {
                        "type": "string"
                      },
                      "titles": {
                        "description": "Current job titles (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "pastTitles": {
                        "description": "Past job titles (free text).",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "personNames": {
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "pastSeniorities": {
                        "description": "Seniority in any past role, independent of pastCompanyNames/pastTitles. Current seniority vocabulary plus Founding Team. Founder includes Co-Founder; C-level and Founding Team do not imply founder. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "profileKeywords": {
                        "description": "Text in headline/about or any current/past work description. OR includes, global exclusions. Always loose text matching; missing evidence does not match.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "companyKeywords": {
                        "description": "Current employer business focus/model (e.g. SaaS, B2B, Cloud), from description/tagline/business tags; distinct from legal companyTypes. Same employer as other current-job filters. Always loose text matching. May need another filter to retrieve candidates.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "seniorities": {
                        "description": "Exact enum: Owner, Founder, C-level, Partner, VP, Head, Director, Manager, Senior.",
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "jobFunctions": {
                        "description": "Exact enum, e.g. Sales, Marketing, Software. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "subFunctions": {
                        "description": "Exact enum, e.g. SDR/BDR, Demand Generation. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "industries": {
                        "description": "Exact enum, e.g. Software Development. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "locations": {
                        "description": "Person locations — cities, states, countries, or metros (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "headcountRanges": {
                        "description": "Exact buckets: 1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10001+.",
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "companyNames": {
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "pastCompanyNames": {
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "companyDomains": {
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "companyHeadquarters": {
                        "description": "Company HQ locations — cities, states, countries, or metros (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "companyTypes": {
                        "description": "Exact enum: Partnership, Nonprofit, Educational, Privately Held, Public Company, Self-Owned, Self-Employed, Government Agency.",
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "universities": {
                        "description": "Universities attended (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "skills": {
                        "description": "Profile skills (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "languages": {
                        "description": "Spoken languages, e.g. English, German. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "exclude": {
                                  "type": "boolean"
                                },
                                "exactMatch": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "yearsInRole": {
                        "type": "object",
                        "properties": {
                          "min": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "additionalProperties": false
                      },
                      "yearsAtCompany": {
                        "type": "object",
                        "properties": {
                          "min": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "additionalProperties": false
                      },
                      "daysSinceJobChange": {
                        "type": "object",
                        "properties": {
                          "min": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "additionalProperties": false
                      },
                      "foundedYears": {
                        "description": "Company founded-year range, e.g. {min: 2015, max: 2024}.",
                        "type": "object",
                        "properties": {
                          "min": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "additionalProperties": false
                      },
                      "exactMatch": {
                        "description": "Match free-text filters as whole strings. Default false: titles ['Founder'] also returns 'Co-Founder' and 'Founder & CEO'. Set true to narrow. Domains, LinkedIn URLs, enum filters and numeric ranges are always exact; keywords is always a loose text probe.",
                        "type": "boolean"
                      },
                      "preferCache": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  },
                  "pageToken": {
                    "type": "string"
                  },
                  "checkDuplicatesAcrossWorkspace": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "filters"
                ]
              },
              "example": {
                "filters": {}
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    "people": {
                      "type": "array",
                      "items": {}
                    },
                    "recipients": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": "string"
                          },
                          "linkedinProfileUrl": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string"
                          },
                          "personalization": {
                            "description": "Merge values keyed by name, e.g. {\"Company\":\"Acme\"} for {{Company}}.",
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "additionalProperties": false,
                        "description": "One person. Needs email and/or linkedinProfileUrl; unknown keys are rejected, not dropped."
                      }
                    },
                    "metadata": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "estimatedCents": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The search cost ceiling reported by Dench billing, in cents. Null means the receipt is unavailable."
                    },
                    "chargedCents": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The actual search charge reported by Dench billing, in cents. Null means the receipt is unavailable; results remain valid."
                    },
                    "added": {
                      "type": "number"
                    },
                    "requested": {
                      "type": "number"
                    },
                    "cappedAtLimit": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "duplicates": {
                      "type": "number"
                    },
                    "duplicatesElsewhere": {
                      "type": "number"
                    },
                    "suppressed": {
                      "type": "number"
                    },
                    "invalid": {
                      "type": "number"
                    },
                    "skippedNoIdentity": {
                      "type": "number"
                    },
                    "skippedMissingInfo": {
                      "type": "number"
                    },
                    "missingInfoSample": {},
                    "found": {
                      "type": "number"
                    },
                    "skippedSearchProfiles": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "rows",
                    "people",
                    "recipients",
                    "metadata",
                    "estimatedCents",
                    "chargedCents",
                    "added",
                    "requested",
                    "cappedAtLimit",
                    "duplicates",
                    "duplicatesElsewhere",
                    "suppressed",
                    "invalid",
                    "skippedNoIdentity",
                    "skippedMissingInfo",
                    "found",
                    "skippedSearchProfiles"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/people/batch": {
      "post": {
        "operationId": "campaigns_people_addBatch",
        "tags": [
          "campaigns"
        ],
        "summary": "Add up to 50 selected recipients without another search. Deduplicates, applies suppression, and preserves the campaign's launch state",
        "description": "Add up to 50 selected recipients without another search. Deduplicates, applies suppression, and preserves the campaign's launch state.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipients": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "linkedinProfileUrl": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        },
                        "personalization": {
                          "description": "Merge values keyed by name, e.g. {\"Company\":\"Acme\"} for {{Company}}.",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        }
                      },
                      "additionalProperties": false,
                      "description": "One person. Needs email and/or linkedinProfileUrl; unknown keys are rejected, not dropped."
                    }
                  },
                  "newRecordsObject": {
                    "type": "string",
                    "enum": [
                      "lead",
                      "people"
                    ]
                  },
                  "checkDuplicatesAcrossWorkspace": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "recipients"
                ]
              },
              "example": {
                "recipients": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "added": {
                      "type": "number"
                    },
                    "requested": {
                      "type": "number"
                    },
                    "cappedAtLimit": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "duplicates": {
                      "type": "number"
                    },
                    "duplicatesElsewhere": {
                      "type": "number"
                    },
                    "suppressed": {
                      "type": "number"
                    },
                    "invalid": {
                      "type": "number"
                    },
                    "skippedNoIdentity": {
                      "type": "number"
                    },
                    "skippedMissingInfo": {
                      "type": "number"
                    },
                    "missingInfoSample": {}
                  },
                  "required": [
                    "added",
                    "requested",
                    "cappedAtLimit",
                    "duplicates",
                    "duplicatesElsewhere",
                    "suppressed",
                    "invalid",
                    "skippedNoIdentity",
                    "skippedMissingInfo"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/sources": {
      "get": {
        "operationId": "campaigns_sources_get",
        "tags": [
          "campaigns"
        ],
        "summary": "Read a campaign's saved signal source, targeting and schedule",
        "description": "Read a campaign's saved signal source, targeting and schedule.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "campaigns_sources_update",
        "tags": [
          "campaigns"
        ],
        "summary": "Update source cadence, pause/resume, targeting, signals or terms. Active sources may perform billable future work",
        "description": "Update source cadence, pause/resume, targeting, signals or terms. Active sources may perform billable future work.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused"
                    ]
                  },
                  "cadence": {
                    "type": "string",
                    "enum": [
                      "daily",
                      "weekly",
                      "monthly"
                    ]
                  },
                  "findMoreMatching": {
                    "type": "boolean"
                  },
                  "approvalMode": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "manual"
                    ],
                    "description": "auto: new people a signal finds start the sequence on their own. manual: they wait for approval."
                  },
                  "targeting": {
                    "type": "object",
                    "properties": {
                      "titles": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "locations": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "companySizes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "industries": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "excludes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "companies": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "companyTypes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "titles",
                      "locations",
                      "companySizes",
                      "industries",
                      "excludes"
                    ],
                    "additionalProperties": false
                  },
                  "signal": {
                    "type": "object",
                    "properties": {
                      "signal": {
                        "type": "string",
                        "enum": [
                          "post_engagement",
                          "keyword",
                          "hiring",
                          "funding",
                          "launch",
                          "new_leader",
                          "voice_engagement",
                          "company_engagement",
                          "brand_engagement",
                          "lookalike"
                        ]
                      },
                      "enabled": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "signal",
                      "enabled"
                    ],
                    "additionalProperties": false
                  },
                  "terms": {
                    "type": "object",
                    "properties": {
                      "signal": {
                        "type": "string",
                        "enum": [
                          "post_engagement",
                          "keyword",
                          "hiring",
                          "voice_engagement",
                          "company_engagement",
                          "brand_engagement"
                        ]
                      },
                      "values": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "signal",
                      "values"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "null"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/sources/signals": {
      "get": {
        "operationId": "campaigns_sources_signals",
        "tags": [
          "campaigns"
        ],
        "summary": "Read signal choices, suggested terms and current source configuration",
        "description": "Read signal choices, suggested terms and current source configuration.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/sources/preview": {
      "post": {
        "operationId": "campaigns_sources_preview",
        "tags": [
          "campaigns"
        ],
        "summary": "Preview a signal source using its current audience. Provider credits may apply; does not enroll people",
        "description": "Preview a signal source using its current audience. Provider credits may apply; does not enroll people.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "signal": {
                    "type": "string",
                    "enum": [
                      "post_engagement",
                      "keyword",
                      "hiring",
                      "funding",
                      "launch",
                      "new_leader",
                      "voice_engagement",
                      "company_engagement",
                      "brand_engagement",
                      "lookalike"
                    ]
                  },
                  "terms": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "signal"
                ]
              },
              "example": {
                "signal": "post_engagement"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/sources/run": {
      "post": {
        "operationId": "campaigns_sources_run",
        "tags": [
          "campaigns"
        ],
        "summary": "Run a live campaign's signals now instead of waiting for the schedule (Run now). Provider credits apply; limited to 6 runs an hour",
        "description": "Run a live campaign's signals now instead of waiting for the schedule (Run now). Provider credits apply; limited to 6 runs an hour.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "null"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/sources/overview": {
      "get": {
        "operationId": "campaigns_sources_overview",
        "tags": [
          "campaigns"
        ],
        "summary": "Read the Sources tab: each signal's status, last and next run, people found and anything needing attention",
        "description": "Read the Sources tab: each signal's status, last and next run, people found and anything needing attention.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/sources/pending": {
      "get": {
        "operationId": "campaigns_sources_pending",
        "tags": [
          "campaigns"
        ],
        "summary": "List people a signal found who are waiting for approval (manual approval mode)",
        "description": "List people a signal found who are waiting for approval (manual approval mode).",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/sources/review": {
      "post": {
        "operationId": "campaigns_sources_review",
        "tags": [
          "campaigns"
        ],
        "summary": "Approve people waiting for review (they start the sequence) or reject them",
        "description": "Approve people waiting for review (they start the sequence) or reject them.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enrollmentIds": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "approve",
                      "reject"
                    ]
                  }
                },
                "required": [
                  "enrollmentIds",
                  "decision"
                ]
              },
              "example": {
                "enrollmentIds": [],
                "decision": "approve"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/queue": {
      "get": {
        "operationId": "campaigns_queue",
        "tags": [
          "campaigns"
        ],
        "summary": "Today's queue: who the campaign plans to contact today, warmest first, within the senders' limits",
        "description": "Today's queue: who the campaign plans to contact today, warmest first, within the senders' limits.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/profile": {
      "get": {
        "operationId": "campaigns_builder_profile",
        "tags": [
          "campaigns"
        ],
        "summary": "Read the company profile and suggested campaign audience",
        "description": "Read the company profile and suggested campaign audience.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "hasProfile": {
                      "type": "boolean"
                    },
                    "targeting": {
                      "type": "object",
                      "properties": {
                        "titles": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "locations": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "companySizes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "industries": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "excludes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "companies": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "companyTypes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "titles",
                        "locations",
                        "companySizes",
                        "industries",
                        "excludes"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "hasProfile",
                    "targeting"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/drafts": {
      "post": {
        "operationId": "campaigns_builder_save",
        "tags": [
          "campaigns"
        ],
        "summary": "Save a signal campaign's audience, signals and terms idempotently. Does not start a build",
        "description": "Save a signal campaign's audience, signals and terms idempotently. Does not start a build.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientRequestId": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 64,
                    "description": "Your stable id for this request, 8-64 characters. Retrying with the same id returns the same draft instead of creating another."
                  },
                  "targeting": {
                    "type": "object",
                    "properties": {
                      "titles": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "locations": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "companySizes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "industries": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "excludes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "companies": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "companyTypes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "titles",
                      "locations",
                      "companySizes",
                      "industries",
                      "excludes"
                    ],
                    "additionalProperties": false
                  },
                  "signals": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "post_engagement",
                        "keyword",
                        "hiring",
                        "funding",
                        "launch",
                        "new_leader",
                        "voice_engagement",
                        "company_engagement",
                        "brand_engagement",
                        "lookalike"
                      ]
                    }
                  },
                  "signalTerms": {
                    "type": "object",
                    "properties": {
                      "post_engagement": {
                        "description": "Post topics, phrased as what the buyer does (\"using AI for outbound\"), not bare product names.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "keyword": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "hiring": {
                        "description": "Roles being hired for.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "voice_engagement": {
                        "description": "LinkedIn profile URLs of market voices whose posts to watch.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "company_engagement": {
                        "description": "LinkedIn company page URLs of companies and competitors.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "brand_engagement": {
                        "description": "The sender's own LinkedIn company page URL.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "exact": {
                        "description": "Topic signals searched by their exact keywords only (no drafted phrases).",
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "post_engagement",
                            "keyword"
                          ]
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "findMoreMatching": {
                    "description": "Also add people who match the audience without a signal.",
                    "type": "boolean"
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "signals",
                      "lookalike",
                      "existing",
                      "crm",
                      "search"
                    ],
                    "description": "How people come in: buying signals, people like one best lead, a pasted list or CSV, CRM records, or a people search."
                  },
                  "screen": {
                    "type": "string",
                    "enum": [
                      "source",
                      "signals",
                      "lookalike",
                      "target",
                      "messages",
                      "outreach",
                      "review"
                    ]
                  },
                  "lookalike": {
                    "description": "For source lookalike: the edited result of builder lookalike, with signals [\"lookalike\"].",
                    "type": "object",
                    "properties": {
                      "seed": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "linkedinUrl": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "companyName": {
                            "type": "string"
                          },
                          "companyDomain": {
                            "type": "string"
                          },
                          "avatarUrl": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "name",
                          "linkedinUrl"
                        ],
                        "additionalProperties": false
                      },
                      "title": {
                        "type": "string"
                      },
                      "similarRoles": {
                        "type": "boolean"
                      },
                      "roles": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "location": {
                        "type": "string"
                      },
                      "industry": {
                        "type": "string"
                      },
                      "relatedIndustries": {
                        "type": "boolean"
                      },
                      "industries": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "companySizes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "companies": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "domain": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "name",
                            "domain"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "seed",
                      "title",
                      "similarRoles",
                      "roles",
                      "relatedIndustries",
                      "industries",
                      "companySizes",
                      "companies"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "clientRequestId",
                  "targeting",
                  "signals"
                ]
              },
              "example": {
                "clientRequestId": "string",
                "targeting": {},
                "signals": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draftId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "draftId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "get": {
        "operationId": "campaigns_builder_drafts",
        "tags": [
          "campaigns"
        ],
        "summary": "List saved, unfinished campaign drafts that can be resumed",
        "description": "List saved, unfinished campaign drafts that can be resumed.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/drafts/{draftId}": {
      "get": {
        "operationId": "campaigns_builder_get",
        "tags": [
          "campaigns"
        ],
        "summary": "Read signal build progress, preview people, messages and errors",
        "description": "Read signal build progress, preview people, messages and errors.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "targeting": {
                      "type": "object",
                      "properties": {
                        "titles": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "locations": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "companySizes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "industries": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "excludes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "companies": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "companyTypes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "titles",
                        "locations",
                        "companySizes",
                        "industries",
                        "excludes"
                      ],
                      "additionalProperties": false
                    },
                    "signals": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "post_engagement",
                          "keyword",
                          "hiring",
                          "funding",
                          "launch",
                          "new_leader",
                          "voice_engagement",
                          "company_engagement",
                          "brand_engagement",
                          "lookalike"
                        ]
                      }
                    },
                    "people": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "status",
                    "targeting",
                    "signals",
                    "people"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "campaigns_builder_discard",
        "tags": [
          "campaigns"
        ],
        "summary": "Discard a saved draft that has not become a campaign",
        "description": "Discard a saved draft that has not become a campaign.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "null"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/drafts/{draftId}/build": {
      "post": {
        "operationId": "campaigns_builder_build",
        "tags": [
          "campaigns"
        ],
        "summary": "Start the same billable signal/audience/message build used by the UI; poll the draft for progress",
        "description": "Start the same billable signal/audience/message build used by the UI; poll the draft for progress.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "started": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "started"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/drafts/{draftId}/create": {
      "post": {
        "operationId": "campaigns_builder_create",
        "tags": [
          "campaigns"
        ],
        "summary": "Create a campaign from a reviewed signal draft. Does not launch the campaign",
        "description": "Create a campaign from a reviewed signal draft. Does not launch the campaign.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "timezone": {
                    "type": "string"
                  },
                  "paused": {
                    "description": "Save paused: signals wait to run until launch.",
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sequenceId": {
                      "type": "string"
                    },
                    "enrolled": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "sequenceId",
                    "enrolled"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/drafts/{draftId}/people/{leadId}/opener": {
      "put": {
        "operationId": "campaigns_builder_opener",
        "tags": [
          "campaigns"
        ],
        "summary": "Edit or reset one preview person's opening line before creating the campaign",
        "description": "Edit or reset one preview person's opening line before creating the campaign.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "opener": {
                    "type": "string"
                  }
                },
                "required": [
                  "opener"
                ]
              },
              "example": {
                "opener": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "null"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/drafts/{draftId}/setup": {
      "get": {
        "operationId": "campaigns_builder_resume",
        "tags": [
          "campaigns"
        ],
        "summary": "Read a saved draft's setup (source, name, targeting, signals, terms, lookalike) to resume it",
        "description": "Read a saved draft's setup (source, name, targeting, signals, terms, lookalike) to resume it.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "clientRequestId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "targeting": {
                          "type": "object",
                          "properties": {
                            "titles": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "locations": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "companySizes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "industries": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "excludes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "companies": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "companyTypes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "titles",
                            "locations",
                            "companySizes",
                            "industries",
                            "excludes"
                          ],
                          "additionalProperties": false
                        },
                        "signals": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "post_engagement",
                              "keyword",
                              "hiring",
                              "funding",
                              "launch",
                              "new_leader",
                              "voice_engagement",
                              "company_engagement",
                              "brand_engagement",
                              "lookalike"
                            ]
                          }
                        }
                      },
                      "required": [
                        "clientRequestId",
                        "status",
                        "targeting",
                        "signals"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/drafts/{draftId}/outreach": {
      "patch": {
        "operationId": "campaigns_builder_outreach",
        "tags": [
          "campaigns"
        ],
        "summary": "Save a draft's Outreach and Review choices: AI or manual steps, the brief, the steps, who sends and when, and auto or manual approval",
        "description": "Save a draft's Outreach and Review choices: AI or manual steps, the brief, the steps, who sends and when, and auto or manual approval.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "outreachMode": {
                    "description": "ai: generate the sequence from the brief. manual: write steps.",
                    "type": "string",
                    "enum": [
                      "ai",
                      "manual"
                    ]
                  },
                  "brief": {
                    "type": "object",
                    "properties": {
                      "goal": {
                        "type": "string",
                        "description": "What a reply should lead to, e.g. a demo."
                      },
                      "helpWith": {
                        "type": "string",
                        "description": "The problem the product solves for them."
                      },
                      "tone": {
                        "type": "string",
                        "enum": [
                          "conversational",
                          "warm",
                          "direct",
                          "formal"
                        ]
                      },
                      "channels": {
                        "type": "string",
                        "enum": [
                          "both",
                          "email",
                          "linkedin"
                        ]
                      }
                    },
                    "required": [
                      "goal",
                      "helpWith",
                      "tone",
                      "channels"
                    ],
                    "additionalProperties": false
                  },
                  "steps": {
                    "maxItems": 12,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "email",
                            "wait",
                            "linkedin_connection",
                            "linkedin_message"
                          ]
                        },
                        "waitHours": {
                          "description": "Hours to wait, 1 to 1440. Required on a wait step.",
                          "type": "number",
                          "minimum": 1,
                          "maximum": 1440
                        },
                        "emailSubject": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "emailTextBody": {
                          "description": "Plain text only; draft steps keep no HTML body.",
                          "type": "string",
                          "maxLength": 5000
                        },
                        "emailReplyToPrevious": {
                          "type": "boolean"
                        },
                        "onlyIf": {
                          "type": "string",
                          "enum": [
                            "always",
                            "connected",
                            "not_connected"
                          ]
                        },
                        "linkedinMessageBody": {
                          "type": "string",
                          "maxLength": 5000
                        },
                        "linkedinMessageMode": {
                          "type": "string",
                          "enum": [
                            "skip_if_not_connected",
                            "wait_until_connected"
                          ]
                        },
                        "connectionTimeoutHours": {
                          "type": "number",
                          "minimum": 1,
                          "maximum": 1440
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "sending": {
                    "type": "object",
                    "properties": {
                      "emailMailboxAccountIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "linkedinAccountIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "timezone": {
                        "type": "string"
                      },
                      "startHour": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 24
                      },
                      "endHour": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 24
                      },
                      "weekdays": {
                        "type": "array",
                        "items": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 6
                        },
                        "description": "0 is Sunday, 6 is Saturday."
                      },
                      "dailySendCap": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100
                      }
                    },
                    "required": [
                      "emailMailboxAccountIds",
                      "linkedinAccountIds",
                      "timezone",
                      "startHour",
                      "endHour",
                      "weekdays"
                    ],
                    "additionalProperties": false
                  },
                  "approvalMode": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "manual"
                    ],
                    "description": "auto: new people a signal finds start the sequence on their own. manual: they wait for approval."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "null"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/drafts/{draftId}/sequence": {
      "post": {
        "operationId": "campaigns_builder_sequence",
        "tags": [
          "campaigns"
        ],
        "summary": "Generate the draft's sequence from a brief (goal, problem, tone, channels), as Generate sequence does. AI credits apply",
        "description": "Generate the draft's sequence from a brief (goal, problem, tone, channels), as Generate sequence does. AI credits apply.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "brief": {
                    "type": "object",
                    "properties": {
                      "goal": {
                        "type": "string",
                        "description": "What a reply should lead to, e.g. a demo."
                      },
                      "helpWith": {
                        "type": "string",
                        "description": "The problem the product solves for them."
                      },
                      "tone": {
                        "type": "string",
                        "enum": [
                          "conversational",
                          "warm",
                          "direct",
                          "formal"
                        ]
                      },
                      "channels": {
                        "type": "string",
                        "enum": [
                          "both",
                          "email",
                          "linkedin"
                        ]
                      }
                    },
                    "required": [
                      "goal",
                      "helpWith",
                      "tone",
                      "channels"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "brief"
                ]
              },
              "example": {
                "brief": {}
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/lookalike": {
      "post": {
        "operationId": "campaigns_builder_lookalike",
        "tags": [
          "campaigns"
        ],
        "summary": "Set up a lookalike from the best lead's LinkedIn URL (role, similar roles, place, industry, similar companies), suggest roles again, or re-scope to a company. Nothing is saved. Provider credits apply",
        "description": "Set up a lookalike from the best lead's LinkedIn URL (role, similar roles, place, industry, similar companies), suggest roles again, or re-scope to a company. Nothing is saved. Provider credits apply.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "linkedinUrl": {
                    "description": "The best lead's LinkedIn profile URL.",
                    "type": "string",
                    "maxLength": 300
                  },
                  "suggest": {
                    "description": "Suggest similar roles and related industries again.",
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "industry": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "title"
                    ],
                    "additionalProperties": false
                  },
                  "rescope": {
                    "description": "Re-scope the lookalike to a different company.",
                    "type": "object",
                    "properties": {
                      "seed": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "linkedinUrl": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "companyName": {
                            "type": "string"
                          },
                          "companyDomain": {
                            "type": "string"
                          },
                          "avatarUrl": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "name",
                          "linkedinUrl"
                        ],
                        "additionalProperties": false
                      },
                      "company": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "location": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "seed",
                      "company"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/voices": {
      "post": {
        "operationId": "campaigns_builder_voices",
        "tags": [
          "campaigns"
        ],
        "summary": "Suggest market voices (LinkedIn experts) for the campaign's topics, to watch with voice_engagement. AI credits apply",
        "description": "Suggest market voices (LinkedIn experts) for the campaign's topics, to watch with voice_engagement. AI credits apply.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "topics": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "market": {
                    "type": "string",
                    "maxLength": 300
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/autofill": {
      "post": {
        "operationId": "campaigns_builder_autofill",
        "tags": [
          "campaigns"
        ],
        "summary": "Turn an audience description into targeting filters. AI credits apply",
        "description": "Turn an audience description into targeting filters. AI credits apply.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300
                  }
                },
                "required": [
                  "description"
                ]
              },
              "example": {
                "description": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "targeting": {
                      "type": "object",
                      "properties": {
                        "titles": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "locations": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "companySizes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "industries": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "excludes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "companies": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "companyTypes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "titles",
                        "locations",
                        "companySizes",
                        "industries",
                        "excludes"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "targeting"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/builder/estimate": {
      "post": {
        "operationId": "campaigns_builder_estimate",
        "tags": [
          "campaigns"
        ],
        "summary": "Estimate audience or weekly signal volume using the UI's cached estimator. Provider credits may apply",
        "description": "Estimate audience or weekly signal volume using the UI's cached estimator. Provider credits may apply.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "people",
                      "week"
                    ]
                  },
                  "targeting": {
                    "type": "object",
                    "properties": {
                      "titles": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "locations": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "companySizes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "industries": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "excludes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "companies": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "companyTypes": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "titles",
                      "locations",
                      "companySizes",
                      "industries",
                      "excludes"
                    ],
                    "additionalProperties": false
                  },
                  "signals": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "post_engagement",
                        "keyword",
                        "hiring",
                        "funding",
                        "launch",
                        "new_leader",
                        "voice_engagement",
                        "company_engagement",
                        "brand_engagement",
                        "lookalike"
                      ]
                    }
                  },
                  "signalTerms": {
                    "type": "object",
                    "properties": {
                      "post_engagement": {
                        "description": "Post topics, phrased as what the buyer does (\"using AI for outbound\"), not bare product names.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "keyword": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "hiring": {
                        "description": "Roles being hired for.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "voice_engagement": {
                        "description": "LinkedIn profile URLs of market voices whose posts to watch.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "company_engagement": {
                        "description": "LinkedIn company page URLs of companies and competitors.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "brand_engagement": {
                        "description": "The sender's own LinkedIn company page URL.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "exact": {
                        "description": "Topic signals searched by their exact keywords only (no drafted phrases).",
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "post_engagement",
                            "keyword"
                          ]
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "kind",
                  "targeting"
                ]
              },
              "example": {
                "kind": "people",
                "targeting": {}
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "count"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/commands": {
      "get": {
        "operationId": "commands_list",
        "tags": [
          "meta"
        ],
        "summary": "List operations",
        "description": "List all CLI/API operations and parity classifications.",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "operations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "group": {
                            "type": "string"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "cli": {
                            "type": "string"
                          },
                          "aliases": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "method": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "backend": {
                            "type": "string",
                            "enum": [
                              "api",
                              "gateway",
                              "custom",
                              "local"
                            ]
                          },
                          "deprecated": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "group",
                          "summary",
                          "cli",
                          "aliases",
                          "method",
                          "path",
                          "backend",
                          "deprecated"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "operations"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "operations": [
                    {
                      "id": "crm.entries.create",
                      "group": "crm",
                      "summary": "Create a CRM entry.",
                      "cli": "dench crm entries create",
                      "aliases": [],
                      "method": "POST",
                      "path": "/crm/objects/{objectName}/entries",
                      "backend": "api",
                      "deprecated": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/auth/signin-requests": {
      "post": {
        "operationId": "auth_signin_create",
        "tags": [
          "auth"
        ],
        "summary": "Create sign-in request",
        "description": "Create an agent sign-in request.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "codeHash": {
                    "type": "string"
                  },
                  "sessionTokenHash": {
                    "type": "string"
                  },
                  "agentName": {
                    "type": "string"
                  },
                  "agentKind": {
                    "type": "string",
                    "description": "Agent kind, normalized to snake_case."
                  },
                  "intent": {
                    "type": "string",
                    "enum": [
                      "join_existing",
                      "create_workspace"
                    ],
                    "description": "Whether to join an existing workspace or create a new one."
                  },
                  "proposedOrganizationName": {
                    "description": "Required when intent is create_workspace.",
                    "type": "string"
                  },
                  "requestedOrganizationSelector": {
                    "type": "string"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                },
                "required": [
                  "codeHash",
                  "sessionTokenHash",
                  "agentName",
                  "agentKind",
                  "intent"
                ]
              },
              "example": {
                "codeHash": "string",
                "sessionTokenHash": "string",
                "agentName": "string",
                "agentKind": "string",
                "intent": "join_existing"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "pending"
                    },
                    "expiresAt": {
                      "type": "number",
                      "description": "Epoch ms when the sign-in code expires."
                    }
                  },
                  "required": [
                    "status",
                    "expiresAt"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "status": "pending",
                  "expiresAt": 1765526400000
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/auth/signin-requests/{requestId}/poll": {
      "post": {
        "operationId": "auth_signin_poll",
        "tags": [
          "auth"
        ],
        "summary": "Poll sign-in request",
        "description": "Poll an agent sign-in request until approval.",
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "codeHash": {
                    "type": "string"
                  },
                  "sessionTokenHash": {
                    "type": "string"
                  }
                },
                "required": [
                  "codeHash",
                  "sessionTokenHash"
                ]
              },
              "example": {
                "codeHash": "string",
                "sessionTokenHash": "string"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "approved",
                        "rejected",
                        "expired"
                      ]
                    },
                    "organization": {
                      "description": "Present once approved.",
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "slug"
                      ],
                      "additionalProperties": false
                    },
                    "agent": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    "sessionExpiresAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "status": "approved",
                  "organization": {
                    "id": "org_abc123",
                    "name": "Acme",
                    "slug": "acme"
                  },
                  "agent": {
                    "id": "ag_xyz789",
                    "name": "Cursor",
                    "kind": "cursor"
                  },
                  "sessionExpiresAt": 1773302400000
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/auth/otp/start": {
      "post": {
        "operationId": "auth_otp_start",
        "tags": [
          "auth"
        ],
        "summary": "Start email OTP",
        "description": "Start the email OTP sign-in flow.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "Email to send the code to."
                  }
                },
                "required": [
                  "email"
                ]
              },
              "example": {
                "email": "string"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/auth/otp/verify": {
      "post": {
        "operationId": "auth_otp_verify",
        "tags": [
          "auth"
        ],
        "summary": "Verify email OTP",
        "description": "Verify an email OTP sign-in code.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string",
                    "description": "6+ digit code from the email."
                  },
                  "agentName": {
                    "type": "string"
                  },
                  "agentKind": {
                    "type": "string"
                  },
                  "sessionTokenHash": {
                    "type": "string",
                    "description": "sha256 hex of the local session token."
                  },
                  "intent": {
                    "type": "string",
                    "enum": [
                      "join_existing",
                      "create_workspace"
                    ],
                    "description": "Whether to join an existing workspace or create a new one."
                  },
                  "proposedOrganizationName": {
                    "type": "string"
                  },
                  "organizationSelector": {
                    "type": "string"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                },
                "required": [
                  "email",
                  "code",
                  "agentName",
                  "agentKind",
                  "sessionTokenHash",
                  "intent"
                ]
              },
              "example": {
                "email": "string",
                "code": "string",
                "agentName": "string",
                "agentKind": "string",
                "sessionTokenHash": "string",
                "intent": "join_existing"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "result": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "completed"
                            },
                            "organization": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "slug": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "slug"
                              ],
                              "additionalProperties": false
                            },
                            "sessionExpiresAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "requiresOrgChoice"
                            },
                            "authToken": {
                              "type": "string",
                              "description": "Pass to /auth/otp/finalize with the chosen org."
                            },
                            "organizations": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "slug": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name",
                                  "slug"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "expiresAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "kind",
                            "authToken",
                            "organizations",
                            "expiresAt"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "ok",
                    "result"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "result": {
                    "kind": "completed",
                    "organization": {
                      "id": "org_abc123",
                      "name": "Acme",
                      "slug": "acme"
                    },
                    "sessionExpiresAt": 1773302400000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/auth/otp/finalize": {
      "post": {
        "operationId": "auth_otp_finalize",
        "tags": [
          "auth"
        ],
        "summary": "Finalize OTP session",
        "description": "Finalize an email OTP sign-in session.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "authToken": {
                    "type": "string"
                  },
                  "organizationId": {
                    "description": "Provide this OR newOrganizationName.",
                    "type": "string"
                  },
                  "newOrganizationName": {
                    "type": "string"
                  }
                },
                "required": [
                  "authToken"
                ]
              },
              "example": {
                "authToken": "string"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "organization": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "slug": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "slug"
                          ],
                          "additionalProperties": false
                        },
                        "sessionExpiresAt": {
                          "type": "number"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "result"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "result": {
                    "organization": {
                      "id": "org_abc123",
                      "name": "Acme",
                      "slug": "acme"
                    },
                    "sessionExpiresAt": 1773302400000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/local/sessions": {
      "get": {
        "operationId": "sessions_local_list",
        "tags": [
          "local"
        ],
        "summary": "List local sessions",
        "description": "List local CLI sessions.",
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local-only CLI operation. CLI sessions live in the caller's ~/.dench/config.json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "CLI sessions live in the caller's ~/.dench/config.json.",
                    "type": "invalid_request_error",
                    "code": "local_only"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/local/sessions/use": {
      "post": {
        "operationId": "sessions_local_use",
        "tags": [
          "local"
        ],
        "summary": "Use local session",
        "description": "Select a local CLI session.",
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local-only CLI operation. The server cannot mutate the caller's local CLI config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "The server cannot mutate the caller's local CLI config.",
                    "type": "invalid_request_error",
                    "code": "local_only"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/local/logout": {
      "post": {
        "operationId": "sessions_local_logout",
        "tags": [
          "local"
        ],
        "summary": "Remove local sessions",
        "description": "Remove local CLI sessions.",
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local-only CLI operation. The server cannot mutate the caller's local CLI config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "The server cannot mutate the caller's local CLI config.",
                    "type": "invalid_request_error",
                    "code": "local_only"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/local/backend": {
      "post": {
        "operationId": "backend_local_configure",
        "tags": [
          "local"
        ],
        "summary": "Configure CLI backend",
        "description": "Configure the CLI backend target.",
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local-only CLI operation. Backend selection is local CLI state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "Backend selection is local CLI state.",
                    "type": "invalid_request_error",
                    "code": "local_only"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/sections": {
      "get": {
        "operationId": "workspace_context_sections",
        "tags": [
          "workspace"
        ],
        "summary": "Read selected scoped workspace documents and a compact context index without writes",
        "description": "Read selected scoped workspace documents and a compact context index without writes.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sections",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "identity",
                  "organisation",
                  "user",
                  "memory",
                  "rules",
                  "tools"
                ]
              }
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context": {
      "get": {
        "operationId": "workspace_context",
        "tags": [
          "workspace"
        ],
        "summary": "Workspace context",
        "description": "Return the current Dench workspace context for the bearer.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "agent": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    "rules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "body": {
                            "type": "string"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "organization",
                              "project"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "body",
                          "scope"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "activeAgents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "lastSeenAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "kind"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pendingApprovals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "risk": {
                            "type": "string",
                            "enum": [
                              "low",
                              "medium",
                              "high"
                            ],
                            "description": "Risk level."
                          },
                          "agentId": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "reason",
                          "risk",
                          "createdAt"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "recentArtifacts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "runId": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "note",
                              "draft",
                              "report",
                              "task_suggestion",
                              "patch",
                              "other"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "approved",
                              "rejected",
                              "applied",
                              "archived"
                            ]
                          },
                          "content": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "runId",
                          "title",
                          "type",
                          "status",
                          "content",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "suggestedWork": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "runId": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "note",
                              "draft",
                              "report",
                              "task_suggestion",
                              "patch",
                              "other"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "approved",
                              "rejected",
                              "applied",
                              "archived"
                            ]
                          },
                          "content": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          },
                          "nextCommands": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "id",
                          "runId",
                          "title",
                          "type",
                          "status",
                          "content",
                          "createdAt",
                          "updatedAt",
                          "nextCommands"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "memory": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "fact",
                              "decision",
                              "preference",
                              "goal",
                              "tool_note",
                              "other",
                              "convention",
                              "project_context",
                              "agent_lesson",
                              "docs_knowledge",
                              "open_goal"
                            ],
                            "description": "Memory classification."
                          },
                          "text": {
                            "type": "string"
                          },
                          "tags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "needs_review",
                              "archived"
                            ]
                          },
                          "updatedAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "key",
                          "kind",
                          "text",
                          "tags",
                          "status",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "chatAgents": {
                      "type": "object",
                      "properties": {
                        "nextCommands": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "activeRuns": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "goal": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "model": {
                                "type": "string"
                              },
                              "createdAt": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "id",
                              "goal",
                              "status",
                              "model",
                              "createdAt"
                            ],
                            "additionalProperties": {}
                          }
                        },
                        "templates": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "nextCommands",
                        "activeRuns",
                        "templates"
                      ],
                      "additionalProperties": false
                    },
                    "tools": {
                      "type": "object",
                      "properties": {
                        "discovery": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "cli": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "approvalPolicy": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "discovery",
                        "cli",
                        "approvalPolicy"
                      ],
                      "additionalProperties": false
                    },
                    "nextActions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "workspace",
                    "agent",
                    "rules",
                    "activeAgents",
                    "pendingApprovals",
                    "recentArtifacts",
                    "suggestedWork",
                    "memory",
                    "chatAgents",
                    "tools",
                    "nextActions"
                  ],
                  "additionalProperties": false,
                  "description": "Workspace orientation payload shared by /context, /status, /agents, and /approvals."
                },
                "example": {
                  "workspace": {
                    "id": "org_abc123",
                    "name": "Acme",
                    "slug": "acme"
                  },
                  "agent": {
                    "id": "ag_xyz789",
                    "name": "Cursor",
                    "kind": "cursor"
                  },
                  "rules": [],
                  "activeAgents": [
                    {
                      "id": "ag_xyz789",
                      "name": "Cursor",
                      "kind": "cursor",
                      "lastSeenAt": 1765526400000
                    }
                  ],
                  "pendingApprovals": [],
                  "recentArtifacts": [],
                  "suggestedWork": [],
                  "memory": [],
                  "chatAgents": {
                    "nextCommands": [
                      "dench agent new \"Find useful work\" --follow --json"
                    ],
                    "activeRuns": [],
                    "templates": []
                  },
                  "tools": {
                    "discovery": [
                      "dench_list_apps",
                      "dench_search_tools"
                    ],
                    "cli": [
                      "dench apps --json"
                    ],
                    "approvalPolicy": "Read-only tools can run by default."
                  },
                  "nextActions": [
                    "Ask for a goal or start a chat agent"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/instructions": {
      "get": {
        "operationId": "workspace_instructions",
        "tags": [
          "workspace"
        ],
        "summary": "Workspace instructions",
        "description": "Return the current workspace's standing instructions for external agents.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "instructions": {
                      "type": "string",
                      "description": "Markdown standing instructions for external agents connected to this workspace."
                    },
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "instructions",
                    "workspace"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "workspace": {
                    "name": "Acme",
                    "slug": "acme"
                  },
                  "instructions": "# Dench Workspace Instructions\n\nWorkspace: Acme (acme)\n\n## Identity\nYou are Dench..."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/status": {
      "get": {
        "operationId": "workspace_status",
        "tags": [
          "workspace"
        ],
        "summary": "Workspace status",
        "description": "Return workspace and agent status.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "agent": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    "rules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "body": {
                            "type": "string"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "organization",
                              "project"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "body",
                          "scope"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "activeAgents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "lastSeenAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "kind"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pendingApprovals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "risk": {
                            "type": "string",
                            "enum": [
                              "low",
                              "medium",
                              "high"
                            ],
                            "description": "Risk level."
                          },
                          "agentId": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "reason",
                          "risk",
                          "createdAt"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "recentArtifacts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "runId": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "note",
                              "draft",
                              "report",
                              "task_suggestion",
                              "patch",
                              "other"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "approved",
                              "rejected",
                              "applied",
                              "archived"
                            ]
                          },
                          "content": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "runId",
                          "title",
                          "type",
                          "status",
                          "content",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "suggestedWork": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "runId": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "note",
                              "draft",
                              "report",
                              "task_suggestion",
                              "patch",
                              "other"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "approved",
                              "rejected",
                              "applied",
                              "archived"
                            ]
                          },
                          "content": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          },
                          "nextCommands": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "id",
                          "runId",
                          "title",
                          "type",
                          "status",
                          "content",
                          "createdAt",
                          "updatedAt",
                          "nextCommands"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "memory": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "fact",
                              "decision",
                              "preference",
                              "goal",
                              "tool_note",
                              "other",
                              "convention",
                              "project_context",
                              "agent_lesson",
                              "docs_knowledge",
                              "open_goal"
                            ],
                            "description": "Memory classification."
                          },
                          "text": {
                            "type": "string"
                          },
                          "tags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "needs_review",
                              "archived"
                            ]
                          },
                          "updatedAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "key",
                          "kind",
                          "text",
                          "tags",
                          "status",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "chatAgents": {
                      "type": "object",
                      "properties": {
                        "nextCommands": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "activeRuns": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "goal": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "model": {
                                "type": "string"
                              },
                              "createdAt": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "id",
                              "goal",
                              "status",
                              "model",
                              "createdAt"
                            ],
                            "additionalProperties": {}
                          }
                        },
                        "templates": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "nextCommands",
                        "activeRuns",
                        "templates"
                      ],
                      "additionalProperties": false
                    },
                    "tools": {
                      "type": "object",
                      "properties": {
                        "discovery": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "cli": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "approvalPolicy": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "discovery",
                        "cli",
                        "approvalPolicy"
                      ],
                      "additionalProperties": false
                    },
                    "nextActions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "workspace",
                    "agent",
                    "rules",
                    "activeAgents",
                    "pendingApprovals",
                    "recentArtifacts",
                    "suggestedWork",
                    "memory",
                    "chatAgents",
                    "tools",
                    "nextActions"
                  ],
                  "additionalProperties": false,
                  "description": "Workspace orientation payload shared by /context, /status, /agents, and /approvals."
                },
                "example": {
                  "workspace": {
                    "id": "org_abc123",
                    "name": "Acme",
                    "slug": "acme"
                  },
                  "agent": {
                    "id": "ag_xyz789",
                    "name": "Cursor",
                    "kind": "cursor"
                  },
                  "rules": [],
                  "activeAgents": [
                    {
                      "id": "ag_xyz789",
                      "name": "Cursor",
                      "kind": "cursor",
                      "lastSeenAt": 1765526400000
                    }
                  ],
                  "pendingApprovals": [],
                  "recentArtifacts": [],
                  "suggestedWork": [],
                  "memory": [],
                  "chatAgents": {
                    "nextCommands": [
                      "dench agent new \"Find useful work\" --follow --json"
                    ],
                    "activeRuns": [],
                    "templates": []
                  },
                  "tools": {
                    "discovery": [
                      "dench_list_apps",
                      "dench_search_tools"
                    ],
                    "cli": [
                      "dench apps --json"
                    ],
                    "approvalPolicy": "Read-only tools can run by default."
                  },
                  "nextActions": [
                    "Ask for a goal or start a chat agent"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agents": {
      "get": {
        "operationId": "workspace_agents",
        "tags": [
          "workspace"
        ],
        "summary": "List agents",
        "description": "List agents visible in the workspace status payload.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "agent": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    "rules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "body": {
                            "type": "string"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "organization",
                              "project"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "body",
                          "scope"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "activeAgents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "lastSeenAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "kind"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pendingApprovals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "risk": {
                            "type": "string",
                            "enum": [
                              "low",
                              "medium",
                              "high"
                            ],
                            "description": "Risk level."
                          },
                          "agentId": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "reason",
                          "risk",
                          "createdAt"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "recentArtifacts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "runId": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "note",
                              "draft",
                              "report",
                              "task_suggestion",
                              "patch",
                              "other"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "approved",
                              "rejected",
                              "applied",
                              "archived"
                            ]
                          },
                          "content": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "runId",
                          "title",
                          "type",
                          "status",
                          "content",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "suggestedWork": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "runId": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "note",
                              "draft",
                              "report",
                              "task_suggestion",
                              "patch",
                              "other"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "approved",
                              "rejected",
                              "applied",
                              "archived"
                            ]
                          },
                          "content": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          },
                          "nextCommands": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "id",
                          "runId",
                          "title",
                          "type",
                          "status",
                          "content",
                          "createdAt",
                          "updatedAt",
                          "nextCommands"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "memory": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "fact",
                              "decision",
                              "preference",
                              "goal",
                              "tool_note",
                              "other",
                              "convention",
                              "project_context",
                              "agent_lesson",
                              "docs_knowledge",
                              "open_goal"
                            ],
                            "description": "Memory classification."
                          },
                          "text": {
                            "type": "string"
                          },
                          "tags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "needs_review",
                              "archived"
                            ]
                          },
                          "updatedAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "key",
                          "kind",
                          "text",
                          "tags",
                          "status",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "chatAgents": {
                      "type": "object",
                      "properties": {
                        "nextCommands": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "activeRuns": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "goal": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "model": {
                                "type": "string"
                              },
                              "createdAt": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "id",
                              "goal",
                              "status",
                              "model",
                              "createdAt"
                            ],
                            "additionalProperties": {}
                          }
                        },
                        "templates": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "nextCommands",
                        "activeRuns",
                        "templates"
                      ],
                      "additionalProperties": false
                    },
                    "tools": {
                      "type": "object",
                      "properties": {
                        "discovery": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "cli": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "approvalPolicy": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "discovery",
                        "cli",
                        "approvalPolicy"
                      ],
                      "additionalProperties": false
                    },
                    "nextActions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "workspace",
                    "agent",
                    "rules",
                    "activeAgents",
                    "pendingApprovals",
                    "recentArtifacts",
                    "suggestedWork",
                    "memory",
                    "chatAgents",
                    "tools",
                    "nextActions"
                  ],
                  "additionalProperties": false,
                  "description": "Workspace orientation payload shared by /context, /status, /agents, and /approvals."
                },
                "example": {
                  "workspace": {
                    "id": "org_abc123",
                    "name": "Acme",
                    "slug": "acme"
                  },
                  "agent": {
                    "id": "ag_xyz789",
                    "name": "Cursor",
                    "kind": "cursor"
                  },
                  "rules": [],
                  "activeAgents": [
                    {
                      "id": "ag_xyz789",
                      "name": "Cursor",
                      "kind": "cursor",
                      "lastSeenAt": 1765526400000
                    }
                  ],
                  "pendingApprovals": [],
                  "recentArtifacts": [],
                  "suggestedWork": [],
                  "memory": [],
                  "chatAgents": {
                    "nextCommands": [
                      "dench agent new \"Find useful work\" --follow --json"
                    ],
                    "activeRuns": [],
                    "templates": []
                  },
                  "tools": {
                    "discovery": [
                      "dench_list_apps",
                      "dench_search_tools"
                    ],
                    "cli": [
                      "dench apps --json"
                    ],
                    "approvalPolicy": "Read-only tools can run by default."
                  },
                  "nextActions": [
                    "Ask for a goal or start a chat agent"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/approvals": {
      "get": {
        "operationId": "workspace_approvals_list",
        "tags": [
          "approvals"
        ],
        "summary": "List approvals",
        "description": "List approval requests visible in the workspace status payload.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "agent": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    "rules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "body": {
                            "type": "string"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "organization",
                              "project"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "body",
                          "scope"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "activeAgents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "lastSeenAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "kind"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pendingApprovals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "risk": {
                            "type": "string",
                            "enum": [
                              "low",
                              "medium",
                              "high"
                            ],
                            "description": "Risk level."
                          },
                          "agentId": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "reason",
                          "risk",
                          "createdAt"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "recentArtifacts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "runId": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "note",
                              "draft",
                              "report",
                              "task_suggestion",
                              "patch",
                              "other"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "approved",
                              "rejected",
                              "applied",
                              "archived"
                            ]
                          },
                          "content": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "runId",
                          "title",
                          "type",
                          "status",
                          "content",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "suggestedWork": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "runId": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "note",
                              "draft",
                              "report",
                              "task_suggestion",
                              "patch",
                              "other"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "approved",
                              "rejected",
                              "applied",
                              "archived"
                            ]
                          },
                          "content": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          },
                          "nextCommands": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "id",
                          "runId",
                          "title",
                          "type",
                          "status",
                          "content",
                          "createdAt",
                          "updatedAt",
                          "nextCommands"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "memory": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "fact",
                              "decision",
                              "preference",
                              "goal",
                              "tool_note",
                              "other",
                              "convention",
                              "project_context",
                              "agent_lesson",
                              "docs_knowledge",
                              "open_goal"
                            ],
                            "description": "Memory classification."
                          },
                          "text": {
                            "type": "string"
                          },
                          "tags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "needs_review",
                              "archived"
                            ]
                          },
                          "updatedAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "key",
                          "kind",
                          "text",
                          "tags",
                          "status",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "chatAgents": {
                      "type": "object",
                      "properties": {
                        "nextCommands": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "activeRuns": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "goal": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "model": {
                                "type": "string"
                              },
                              "createdAt": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "id",
                              "goal",
                              "status",
                              "model",
                              "createdAt"
                            ],
                            "additionalProperties": {}
                          }
                        },
                        "templates": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "nextCommands",
                        "activeRuns",
                        "templates"
                      ],
                      "additionalProperties": false
                    },
                    "tools": {
                      "type": "object",
                      "properties": {
                        "discovery": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "cli": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "approvalPolicy": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "discovery",
                        "cli",
                        "approvalPolicy"
                      ],
                      "additionalProperties": false
                    },
                    "nextActions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "workspace",
                    "agent",
                    "rules",
                    "activeAgents",
                    "pendingApprovals",
                    "recentArtifacts",
                    "suggestedWork",
                    "memory",
                    "chatAgents",
                    "tools",
                    "nextActions"
                  ],
                  "additionalProperties": false,
                  "description": "Workspace orientation payload shared by /context, /status, /agents, and /approvals."
                },
                "example": {
                  "workspace": {
                    "id": "org_abc123",
                    "name": "Acme",
                    "slug": "acme"
                  },
                  "agent": {
                    "id": "ag_xyz789",
                    "name": "Cursor",
                    "kind": "cursor"
                  },
                  "rules": [],
                  "activeAgents": [
                    {
                      "id": "ag_xyz789",
                      "name": "Cursor",
                      "kind": "cursor",
                      "lastSeenAt": 1765526400000
                    }
                  ],
                  "pendingApprovals": [],
                  "recentArtifacts": [],
                  "suggestedWork": [],
                  "memory": [],
                  "chatAgents": {
                    "nextCommands": [
                      "dench agent new \"Find useful work\" --follow --json"
                    ],
                    "activeRuns": [],
                    "templates": []
                  },
                  "tools": {
                    "discovery": [
                      "dench_list_apps",
                      "dench_search_tools"
                    ],
                    "cli": [
                      "dench apps --json"
                    ],
                    "approvalPolicy": "Read-only tools can run by default."
                  },
                  "nextActions": [
                    "Ask for a goal or start a chat agent"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "approval_request",
        "tags": [
          "approvals"
        ],
        "summary": "Request approval",
        "description": "Request human approval.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "What needs human approval."
                  },
                  "reason": {
                    "type": "string"
                  },
                  "risk": {
                    "type": "string",
                    "enum": [
                      "low",
                      "medium",
                      "high"
                    ],
                    "description": "Risk level."
                  }
                },
                "required": [
                  "title",
                  "risk"
                ]
              },
              "example": {
                "title": "Deploy the new API branch?",
                "reason": "Production deploy changes public behavior.",
                "risk": "high"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "approvalId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "approvalId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "approvalId": "ap_mno345"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/artifacts": {
      "get": {
        "operationId": "workspace_artifacts_list",
        "tags": [
          "workspace"
        ],
        "summary": "List artifacts",
        "description": "List artifacts for the authenticated workspace.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "runId": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "note",
                          "draft",
                          "report",
                          "task_suggestion",
                          "patch",
                          "other"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "draft",
                          "approved",
                          "rejected",
                          "applied",
                          "archived"
                        ]
                      },
                      "content": {
                        "type": "string"
                      },
                      "createdAt": {
                        "type": "number"
                      },
                      "updatedAt": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "id",
                      "runId",
                      "title",
                      "type",
                      "status",
                      "content",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": false
                  }
                },
                "example": [
                  {
                    "id": "ra_def456",
                    "runId": "rn_ghi789",
                    "title": "Research summary",
                    "type": "report",
                    "status": "draft",
                    "content": "Key findings...",
                    "createdAt": 1765526400000,
                    "updatedAt": 1765526400000
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/suggested-work": {
      "get": {
        "operationId": "workspace_suggestedWork_list",
        "tags": [
          "workspace"
        ],
        "summary": "Suggested work",
        "description": "List draft suggested-work artifacts.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "runId": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "note",
                          "draft",
                          "report",
                          "task_suggestion",
                          "patch",
                          "other"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "draft",
                          "approved",
                          "rejected",
                          "applied",
                          "archived"
                        ]
                      },
                      "content": {
                        "type": "string"
                      },
                      "createdAt": {
                        "type": "number"
                      },
                      "updatedAt": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "id",
                      "runId",
                      "title",
                      "type",
                      "status",
                      "content",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": false
                  }
                },
                "example": [
                  {
                    "id": "ra_def456",
                    "runId": "rn_ghi789",
                    "title": "Follow up with 3 stale leads",
                    "type": "task_suggestion",
                    "status": "draft",
                    "content": "These leads have not been contacted in 30 days...",
                    "createdAt": 1765526400000,
                    "updatedAt": 1765526400000
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists": {
      "get": {
        "operationId": "lists_list",
        "tags": [
          "lists"
        ],
        "summary": "List lists",
        "description": "List saved searches (find-result lists) in the workspace, newest first.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "lists_save",
        "tags": [
          "lists"
        ],
        "summary": "Save list",
        "description": "Save find results as a named list (rows + filters become a workspace artifact).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "createdFrom": {
                    "type": "string",
                    "enum": [
                      "find_people",
                      "find_companies",
                      "find_jobs",
                      "mixed",
                      "watch_fire",
                      "generate_image"
                    ],
                    "description": "Use find_people, find_companies or find_jobs for a prospect list."
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Name of the new list."
                  },
                  "saved": {
                    "description": "True makes the list visible in Find. Omitted saves an unlisted draft that can still be read or added to a campaign by id.",
                    "type": "boolean"
                  },
                  "filters": {
                    "description": "Original search filters to retain with the list. Saving does not run a search."
                  },
                  "people": {
                    "description": "Complete person records from a search, including existing contact details and custom fields.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "companies": {
                    "description": "Complete company records from a search.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "jobs": {
                    "description": "Complete job records from a search.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  }
                },
                "required": [
                  "createdFrom",
                  "title"
                ]
              },
              "example": {
                "createdFrom": "find_people",
                "title": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "artifactId": {
                      "type": "string"
                    },
                    "filePath": {
                      "type": "string"
                    },
                    "rowCount": {
                      "type": "number"
                    },
                    "previewRows": {
                      "type": "array",
                      "items": {}
                    },
                    "title": {
                      "type": "string"
                    },
                    "createdFrom": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "artifactId",
                    "filePath",
                    "rowCount",
                    "previewRows",
                    "title",
                    "createdFrom"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{artifactId}/rows": {
      "get": {
        "operationId": "lists_rows",
        "tags": [
          "lists"
        ],
        "summary": "Read saved rows with current enrichment results and original indices; cursor-paged, without repeating a search",
        "description": "Read saved rows with current enrichment results and original indices; cursor-paged, without repeating a search.",
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "enrichment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "enriched",
                "in_progress",
                "no_contacts",
                "failed",
                "not_enriched"
              ]
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{artifactId}/enrich": {
      "post": {
        "operationId": "lists_enrich",
        "tags": [
          "lists"
        ],
        "summary": "Buy contact details for 1–100 saved profiles and save them to the list. Skips fields already found, looked up empty, or in flight. Requires a signed-in member or their personal agent",
        "description": "Buy contact details for 1–100 saved profiles and save them to the list. Skips fields already found, looked up empty, or in flight. Requires a signed-in member or their personal agent.",
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rows": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "fields": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "email",
                        "phone",
                        "personal_email"
                      ]
                    },
                    "description": "email is work email."
                  }
                },
                "required": [
                  "rows",
                  "fields"
                ]
              },
              "example": {
                "rows": [],
                "fields": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{artifactId}/import": {
      "post": {
        "operationId": "lists_import",
        "tags": [
          "lists"
        ],
        "summary": "Explicitly import selected saved profiles, optionally filtered by enrichment, with a configured Lead status. Reuses CRM records; never sends outreach or triggers conversion",
        "description": "Explicitly import selected saved profiles, optionally filtered by enrichment, with a configured Lead status. Reuses CRM records; never sends outreach or triggers conversion.",
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string",
                    "enum": [
                      "lead",
                      "company",
                      "job_posting"
                    ]
                  },
                  "rowIndexes": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "status": {
                    "type": "string",
                    "minLength": 1
                  },
                  "enrichment": {
                    "type": "string",
                    "enum": [
                      "all",
                      "enriched",
                      "in_progress",
                      "no_contacts",
                      "failed",
                      "not_enriched"
                    ]
                  },
                  "viewName": {
                    "type": "string"
                  },
                  "pin": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "to"
                ]
              },
              "example": {
                "to": "lead"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{artifactId}": {
      "get": {
        "operationId": "lists_get",
        "tags": [
          "lists"
        ],
        "summary": "Get list",
        "description": "Get one saved search / list by artifact id.",
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "lists_update",
        "tags": [
          "lists"
        ],
        "summary": "Update list",
        "description": "Update a saved list in place (title, filters, and/or replacement rows).",
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The existing list id."
            },
            "description": "The existing list id."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1
                  },
                  "filters": {
                    "description": "Replacement filter metadata; does not run a new search."
                  },
                  "people": {
                    "description": "Replacement people. Omit to preserve existing rows; an empty array clears them.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "companies": {
                    "description": "Replacement companies. Omit to preserve existing rows.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "jobs": {
                    "description": "Replacement jobs. Omit to preserve existing rows.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "artifactId": {
                      "type": "string"
                    },
                    "rowCount": {
                      "type": "number"
                    },
                    "previewRows": {
                      "type": "array",
                      "items": {}
                    },
                    "title": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "artifactId",
                    "rowCount",
                    "previewRows",
                    "title"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "lists_delete",
        "tags": [
          "lists"
        ],
        "summary": "Delete list",
        "description": "Delete a saved search / list, its exported CSV/JSONL files, and any linked watch.",
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{artifactId}/rename": {
      "post": {
        "operationId": "lists_rename",
        "tags": [
          "lists"
        ],
        "summary": "Rename list",
        "description": "Rename a saved search / list.",
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{artifactId}/reviews": {
      "get": {
        "operationId": "lists_prospects_reviews",
        "tags": [
          "lists"
        ],
        "summary": "Read durable enrichment activity (legacy review metadata remains readable). Use lists rows for current saved profiles and contacts",
        "description": "Read durable enrichment activity (legacy review metadata remains readable). Use lists rows for current saved profiles and contacts.",
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{artifactId}/assess": {
      "post": {
        "operationId": "lists_prospects_assess",
        "tags": [
          "lists"
        ],
        "summary": "Suggest ICP fit for one profile. Never changes a human review decision",
        "description": "Suggest ICP fit for one profile. Never changes a human review decision.",
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "row": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "suggestion": {
                    "type": "object",
                    "properties": {
                      "fit": {
                        "type": "string",
                        "enum": [
                          "likely_fit",
                          "unlikely_fit",
                          "unknown"
                        ]
                      },
                      "score": {
                        "description": "AI relevance to the saved ICP, not conversion probability.",
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "reason": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      }
                    },
                    "required": [
                      "fit",
                      "reason"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "row",
                  "suggestion"
                ]
              },
              "example": {
                "row": {},
                "suggestion": {}
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/memory/search": {
      "get": {
        "operationId": "memory_search",
        "tags": [
          "memory"
        ],
        "summary": "Search memory",
        "description": "Search durable workspace memory.",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Full-text query."
            },
            "description": "Full-text query."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "_creationTime": {
                        "type": "number"
                      },
                      "key": {
                        "type": "string"
                      },
                      "kind": {
                        "type": "string",
                        "enum": [
                          "fact",
                          "decision",
                          "preference",
                          "goal",
                          "tool_note",
                          "other",
                          "convention",
                          "project_context",
                          "agent_lesson",
                          "docs_knowledge",
                          "open_goal"
                        ],
                        "description": "Memory classification."
                      },
                      "text": {
                        "type": "string"
                      },
                      "tags": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "active",
                          "needs_review",
                          "archived"
                        ]
                      },
                      "source": {
                        "type": "string"
                      },
                      "visibility": {
                        "type": "string",
                        "enum": [
                          "user",
                          "org"
                        ],
                        "description": "Who can see the memory. Defaults to `user`."
                      },
                      "confidence": {
                        "type": "number"
                      },
                      "importance": {
                        "type": "number"
                      },
                      "createdAt": {
                        "type": "number"
                      },
                      "updatedAt": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "_id",
                      "_creationTime",
                      "key",
                      "kind",
                      "text",
                      "tags",
                      "status",
                      "source",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": {},
                    "description": "A workspace memory document."
                  }
                },
                "example": [
                  {
                    "_id": "wm_jkl012",
                    "_creationTime": 1765526400000,
                    "key": "deployment-policy",
                    "kind": "decision",
                    "text": "Never deploy without human approval.",
                    "tags": [
                      "deployment",
                      "policy"
                    ],
                    "status": "active",
                    "source": "agent",
                    "createdAt": 1765526400000,
                    "updatedAt": 1765526400000
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/memory": {
      "post": {
        "operationId": "memory_save",
        "tags": [
          "memory"
        ],
        "summary": "Save memory",
        "description": "Save a durable workspace memory fact.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "description": "Stable memory key."
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "fact",
                      "decision",
                      "preference",
                      "goal",
                      "tool_note",
                      "other",
                      "convention",
                      "project_context",
                      "agent_lesson",
                      "docs_knowledge",
                      "open_goal"
                    ],
                    "description": "Memory classification."
                  },
                  "text": {
                    "type": "string",
                    "description": "Memory body. No secrets or scratch notes."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "sensitivity": {
                    "type": "string",
                    "enum": [
                      "normal",
                      "broad",
                      "sensitive"
                    ],
                    "description": "Sensitivity tier; `sensitive` memories land in needs-review."
                  },
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "user",
                      "org"
                    ],
                    "description": "Who can see the memory. Defaults to `user`."
                  },
                  "projectId": {
                    "type": "string"
                  },
                  "sourceQuote": {
                    "type": "string"
                  },
                  "confidence": {
                    "type": "number"
                  },
                  "importance": {
                    "type": "number"
                  }
                },
                "required": [
                  "key",
                  "kind",
                  "text"
                ]
              },
              "example": {
                "key": "deployment-policy",
                "kind": "decision",
                "text": "Never deploy without human approval.",
                "tags": [
                  "deployment",
                  "policy"
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "memoryId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "needs_review",
                        "archived"
                      ]
                    }
                  },
                  "required": [
                    "ok",
                    "memoryId",
                    "status"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "memoryId": "wm_jkl012",
                  "status": "active"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/approvals/{approvalId}/decision": {
      "post": {
        "operationId": "approval_decide",
        "tags": [
          "approvals"
        ],
        "summary": "Decide approval",
        "description": "Record an approval decision.",
        "parameters": [
          {
            "name": "approvalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "approved",
                      "rejected"
                    ],
                    "description": "Human decision for an approval request."
                  },
                  "evidence": {
                    "description": "Required when the requesting agent records its own decision.",
                    "type": "string"
                  }
                },
                "required": [
                  "decision"
                ]
              },
              "example": {
                "decision": "approved",
                "evidence": "User said yes in chat"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean",
                          "const": true
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "approved",
                            "rejected"
                          ],
                          "description": "Human decision for an approval request."
                        }
                      },
                      "required": [
                        "ok",
                        "status"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean",
                          "const": false
                        },
                        "code": {
                          "type": "string",
                          "description": "e.g. approval_not_pending."
                        },
                        "error": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ok",
                        "code",
                        "error"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "example": {
                  "ok": true,
                  "status": "approved"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/billing/status": {
      "get": {
        "operationId": "billing_status",
        "tags": [
          "billing"
        ],
        "summary": "Billing status",
        "description": "Get billing and AI credit status.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "slug"
                      ],
                      "additionalProperties": false
                    },
                    "availableCreditsCents": {
                      "type": "number"
                    },
                    "creditConsumedCents": {
                      "type": "number"
                    },
                    "billedCents": {
                      "type": "number"
                    },
                    "onDemandSpendCents": {
                      "type": "number"
                    },
                    "monthlySpendLimitCents": {
                      "type": "number"
                    },
                    "spendLimitRemainingCents": {
                      "type": "number"
                    },
                    "subscriptionStatus": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "stripeCustomerId": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "grants": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "starter",
                              "trial",
                              "monthly",
                              "topup",
                              "manual",
                              "referral"
                            ]
                          },
                          "category": {
                            "type": "string",
                            "enum": [
                              "promotional",
                              "paid"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "granted",
                              "depleted",
                              "expired",
                              "voided"
                            ]
                          },
                          "amountCents": {
                            "type": "number"
                          },
                          "usedCents": {
                            "type": "number"
                          },
                          "remainingCents": {
                            "type": "number"
                          },
                          "effectiveAt": {
                            "type": "number"
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "source",
                          "category",
                          "status",
                          "amountCents",
                          "usedCents",
                          "remainingCents",
                          "effectiveAt",
                          "expiresAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCommands": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "workspace",
                    "availableCreditsCents",
                    "creditConsumedCents",
                    "billedCents",
                    "onDemandSpendCents",
                    "monthlySpendLimitCents",
                    "spendLimitRemainingCents",
                    "subscriptionStatus",
                    "stripeCustomerId",
                    "grants",
                    "nextCommands"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "workspace": {
                    "id": "org_abc123",
                    "name": "Acme",
                    "slug": "acme"
                  },
                  "availableCreditsCents": 500,
                  "creditConsumedCents": 120,
                  "billedCents": 120,
                  "onDemandSpendCents": 0,
                  "monthlySpendLimitCents": 5000,
                  "spendLimitRemainingCents": 4880,
                  "subscriptionStatus": "active",
                  "stripeCustomerId": "cus_abc123",
                  "grants": [
                    {
                      "id": "gr_pqr678",
                      "source": "starter",
                      "category": "promotional",
                      "status": "granted",
                      "amountCents": 500,
                      "usedCents": 120,
                      "remainingCents": 380,
                      "effectiveAt": 1765526400000,
                      "expiresAt": null
                    }
                  ],
                  "nextCommands": [
                    "dench billing topup --amount 20"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/billing/topup": {
      "post": {
        "operationId": "billing_topup",
        "tags": [
          "billing"
        ],
        "summary": "Top up credits",
        "description": "Create an AI credit top-up checkout link.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "requestId": {
                    "type": "string",
                    "description": "Idempotency key (1-200 of [A-Za-z0-9:_-])."
                  },
                  "amountUsd": {
                    "type": "number",
                    "description": "USD amount, $5 to $1000."
                  }
                },
                "required": [
                  "requestId",
                  "amountUsd"
                ]
              },
              "example": {
                "requestId": "string",
                "amountUsd": 0
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "charged": {
                          "type": "boolean",
                          "const": true
                        },
                        "amountCents": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "charged",
                        "amountCents"
                      ],
                      "additionalProperties": false,
                      "description": "Saved card charged directly."
                    },
                    {
                      "type": "object",
                      "properties": {
                        "url": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "url"
                      ],
                      "additionalProperties": false,
                      "description": "Stripe Checkout link to complete the top-up."
                    }
                  ]
                },
                "example": {
                  "url": "https://checkout.stripe.com/c/pay/cs_test_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/billing/upgrade": {
      "post": {
        "operationId": "billing_upgrade",
        "tags": [
          "billing"
        ],
        "summary": "Upgrade workspace",
        "description": "Create a workspace upgrade checkout link.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tier": {
                    "type": "string",
                    "enum": [
                      "pro",
                      "max",
                      "cloud",
                      "desktop",
                      "api"
                    ]
                  },
                  "billingCycle": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "yearly"
                    ]
                  },
                  "requestId": {
                    "type": "string"
                  },
                  "returnPath": {
                    "description": "Internal return path beginning with /.",
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "updated": {
                          "type": "boolean",
                          "const": true
                        },
                        "tier": {
                          "type": "string"
                        },
                        "billingCycle": {
                          "type": "string"
                        },
                        "stripeSubscriptionId": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "updated",
                        "tier",
                        "stripeSubscriptionId"
                      ],
                      "additionalProperties": false,
                      "description": "Existing subscription updated in place."
                    },
                    {
                      "type": "object",
                      "properties": {
                        "url": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "url"
                      ],
                      "additionalProperties": false,
                      "description": "Stripe Checkout link to complete the upgrade."
                    }
                  ]
                },
                "example": {
                  "url": "https://checkout.stripe.com/c/pay/cs_test_xyz789"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/chat/threads": {
      "get": {
        "operationId": "chat_list",
        "tags": [
          "chat"
        ],
        "summary": "List threads",
        "description": "List past chat threads.",
        "parameters": [
          {
            "name": "titleQuery",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "includeAutomated",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "threadId": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "lastMessageAt": {
                        "type": "number"
                      },
                      "createdAt": {
                        "type": "number"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "idle",
                          "streaming",
                          "error"
                        ]
                      },
                      "visibility": {
                        "type": "string",
                        "enum": [
                          "private",
                          "shared"
                        ]
                      },
                      "createdByUserId": {
                        "type": "string"
                      },
                      "archivedAt": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "fileContextPath": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "parentThreadId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Parent thread when this is a spawned sub-agent."
                      },
                      "nestingDepth": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "summary": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "activeRunId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "threadId",
                      "title",
                      "lastMessageAt",
                      "createdAt",
                      "status",
                      "visibility",
                      "createdByUserId",
                      "archivedAt",
                      "fileContextPath",
                      "parentThreadId",
                      "nestingDepth",
                      "summary",
                      "activeRunId"
                    ],
                    "additionalProperties": false
                  }
                },
                "example": [
                  {
                    "threadId": "th_abc123",
                    "title": "Deploy checklist",
                    "lastMessageAt": 1765526400000,
                    "createdAt": 1765526000000,
                    "status": "idle",
                    "visibility": "private",
                    "createdByUserId": "us_xyz789",
                    "archivedAt": null,
                    "fileContextPath": null,
                    "parentThreadId": null,
                    "nestingDepth": null,
                    "summary": null,
                    "activeRunId": null
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "chat_rename",
        "tags": [
          "chat"
        ],
        "summary": "Rename threads",
        "description": "Rename one or more chat threads.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "threadId": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "threadId",
                        "title"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "items"
                ]
              },
              "example": {
                "items": [
                  {
                    "threadId": "th_abc123",
                    "title": "Deploy checklist"
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "threadId": {
                            "type": "string"
                          },
                          "ok": {
                            "type": "boolean"
                          },
                          "error": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "threadId",
                          "ok"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "succeeded": {
                      "type": "number"
                    },
                    "failed": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "results",
                    "succeeded",
                    "failed"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "results": [
                    {
                      "threadId": "th_abc123",
                      "ok": true
                    }
                  ],
                  "succeeded": 1,
                  "failed": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "chat_delete",
        "tags": [
          "chat"
        ],
        "summary": "Delete threads",
        "description": "Delete one or more chat threads.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "threadIds": {
                    "minItems": 1,
                    "maxItems": 25,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "includeAutomated": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "threadIds"
                ]
              },
              "example": {
                "threadIds": [
                  "th_abc123"
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "scheduled": {
                      "type": "number"
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "threadId": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string",
                            "description": "e.g. automated_thread_protected."
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "threadId",
                          "reason"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "total": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "scheduled",
                    "rejected",
                    "total"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "scheduled": 2,
                  "rejected": [],
                  "total": 2
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "chat_new",
        "tags": [
          "chat"
        ],
        "summary": "New chat",
        "description": "Start a new chat-turn workflow.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "environment": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9-]{0,63}$"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "The user message that starts the turn."
                  },
                  "model": {
                    "type": "string"
                  },
                  "fileContextPath": {
                    "type": "string"
                  },
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "private",
                      "shared"
                    ]
                  },
                  "yolo": {
                    "description": "Bypass approval gates for this turn.",
                    "type": "boolean"
                  },
                  "title": {
                    "type": "string"
                  }
                },
                "required": [
                  "prompt"
                ]
              },
              "example": {
                "prompt": "Summarize the latest CRM changes."
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "threadId": {
                      "type": "string"
                    },
                    "runId": {
                      "type": "string"
                    },
                    "workflowRunId": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "threadUrl": {
                      "type": "string",
                      "description": "Web URL of the thread."
                    },
                    "streamUrl": {
                      "type": "string",
                      "description": "SSE stream URL for the live response."
                    },
                    "yolo": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "threadId",
                    "runId",
                    "workflowRunId",
                    "threadUrl",
                    "streamUrl",
                    "yolo"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "threadId": "th_abc123",
                  "runId": "rn_def456",
                  "workflowRunId": "wrun_01HX9",
                  "threadUrl": "https://www.dench.com/acme/chat/th_abc123",
                  "streamUrl": "https://www.dench.com/api/chat/stream?sessionId=th_abc123",
                  "yolo": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/chat/search": {
      "get": {
        "operationId": "chat_search",
        "tags": [
          "chat"
        ],
        "summary": "Search chats",
        "description": "Search past chat messages.",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Full-text query across past messages."
            },
            "description": "Full-text query across past messages."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "name": "excludeThreadId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeAutomated",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "threadId": {
                        "type": "string"
                      },
                      "threadTitle": {
                        "type": "string"
                      },
                      "messageId": {
                        "type": "string"
                      },
                      "role": {
                        "type": "string",
                        "enum": [
                          "user",
                          "assistant",
                          "system"
                        ]
                      },
                      "snippet": {
                        "type": "string"
                      },
                      "createdAt": {
                        "type": "number"
                      },
                      "runId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "threadId",
                      "threadTitle",
                      "messageId",
                      "role",
                      "snippet",
                      "createdAt",
                      "runId"
                    ],
                    "additionalProperties": false
                  }
                },
                "example": [
                  {
                    "threadId": "th_abc123",
                    "threadTitle": "Deploy checklist",
                    "messageId": "cm_def456",
                    "role": "user",
                    "snippet": "How do we deploy to prod?",
                    "createdAt": 1765526400000,
                    "runId": null
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/chat/threads/{threadId}": {
      "get": {
        "operationId": "chat_read",
        "tags": [
          "chat"
        ],
        "summary": "Read thread",
        "description": "Read a past chat thread.",
        "parameters": [
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "visibleTextOnly",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Message text as a person sees it: text parts only, without reasoning or tool calls.",
              "type": "boolean"
            },
            "description": "Message text as a person sees it: text parts only, without reasoning or tool calls."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "thread": {
                      "type": "object",
                      "properties": {
                        "threadId": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "lastMessageAt": {
                          "type": "number"
                        },
                        "createdAt": {
                          "type": "number"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "idle",
                            "streaming",
                            "error"
                          ]
                        },
                        "visibility": {
                          "type": "string",
                          "enum": [
                            "private",
                            "shared"
                          ]
                        },
                        "createdByUserId": {
                          "type": "string"
                        },
                        "archivedAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "fileContextPath": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "parentThreadId": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Parent thread when this is a spawned sub-agent."
                        },
                        "nestingDepth": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "summary": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "activeRunId": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "threadId",
                        "title",
                        "lastMessageAt",
                        "createdAt",
                        "status",
                        "visibility",
                        "createdByUserId",
                        "archivedAt",
                        "fileContextPath",
                        "parentThreadId",
                        "nestingDepth",
                        "summary",
                        "activeRunId"
                      ],
                      "additionalProperties": false
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "user",
                              "assistant",
                              "system"
                            ]
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          },
                          "text": {
                            "type": "string"
                          },
                          "runId": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "status": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "streaming",
                                  "complete",
                                  "error",
                                  "canceled"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "revision": {
                            "type": "number"
                          },
                          "isDraft": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "role",
                          "createdAt",
                          "updatedAt",
                          "text",
                          "runId",
                          "status",
                          "revision",
                          "isDraft"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "thread",
                    "messages"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "thread": {
                    "threadId": "th_abc123",
                    "title": "Deploy checklist",
                    "lastMessageAt": 1765526400000,
                    "createdAt": 1765526000000,
                    "status": "idle",
                    "visibility": "private",
                    "createdByUserId": "us_xyz789",
                    "archivedAt": null,
                    "fileContextPath": null,
                    "parentThreadId": null,
                    "nestingDepth": null,
                    "summary": null,
                    "activeRunId": null
                  },
                  "messages": [
                    {
                      "id": "cm_def456",
                      "role": "user",
                      "createdAt": 1765526400000,
                      "updatedAt": 1765526400000,
                      "text": "How do we deploy?",
                      "runId": null,
                      "status": "complete",
                      "revision": 0,
                      "isDraft": false
                    },
                    {
                      "id": "cm_ghi789",
                      "role": "assistant",
                      "createdAt": 1765526460000,
                      "updatedAt": 1765526460000,
                      "text": "Push to main; Vercel auto-deploys.",
                      "runId": "rn_jkl012",
                      "status": "complete",
                      "revision": 1,
                      "isDraft": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/chat/tree": {
      "get": {
        "operationId": "chat_tree",
        "tags": [
          "chat"
        ],
        "summary": "Thread tree",
        "description": "Read the parent-child chat thread hierarchy.",
        "parameters": [
          {
            "name": "titleQuery",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Filter threads by title.",
              "type": "string"
            },
            "description": "Filter threads by title."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "includeAutomated",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Include routine-spawned threads. Defaults false.",
              "type": "boolean"
            },
            "description": "Include routine-spawned threads. Defaults false."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "threadId": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "lastMessageAt": {
                        "type": "number"
                      },
                      "createdAt": {
                        "type": "number"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "idle",
                          "streaming",
                          "error"
                        ]
                      },
                      "visibility": {
                        "type": "string",
                        "enum": [
                          "private",
                          "shared"
                        ]
                      },
                      "createdByUserId": {
                        "type": "string"
                      },
                      "archivedAt": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "fileContextPath": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "parentThreadId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Parent thread when this is a spawned sub-agent."
                      },
                      "nestingDepth": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "summary": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "activeRunId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "threadId",
                      "title",
                      "lastMessageAt",
                      "createdAt",
                      "status",
                      "visibility",
                      "createdByUserId",
                      "archivedAt",
                      "fileContextPath",
                      "parentThreadId",
                      "nestingDepth",
                      "summary",
                      "activeRunId"
                    ],
                    "additionalProperties": false
                  },
                  "description": "Flat thread rows; parentThreadId encodes the hierarchy."
                },
                "example": [
                  {
                    "threadId": "th_abc123",
                    "title": "Deploy checklist",
                    "lastMessageAt": 1765526400000,
                    "createdAt": 1765526000000,
                    "status": "idle",
                    "visibility": "private",
                    "createdByUserId": "us_xyz789",
                    "archivedAt": null,
                    "fileContextPath": null,
                    "parentThreadId": null,
                    "nestingDepth": null,
                    "summary": null,
                    "activeRunId": null
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/chat/threads/{threadId}/messages": {
      "post": {
        "operationId": "chat_send",
        "tags": [
          "chat"
        ],
        "summary": "Send message",
        "description": "Send a message to an existing chat thread.",
        "parameters": [
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "The message to append."
                  },
                  "model": {
                    "type": "string"
                  },
                  "yolo": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "prompt"
                ]
              },
              "example": {
                "prompt": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "threadId": {
                      "type": "string"
                    },
                    "runId": {
                      "type": "string"
                    },
                    "workflowRunId": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "threadUrl": {
                      "type": "string",
                      "description": "Web URL of the thread."
                    },
                    "streamUrl": {
                      "type": "string",
                      "description": "SSE stream URL for the live response."
                    },
                    "yolo": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "threadId",
                    "runId",
                    "workflowRunId",
                    "threadUrl",
                    "streamUrl",
                    "yolo"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "threadId": "th_abc123",
                  "runId": "rn_ghi789",
                  "workflowRunId": "wrun_01HXA",
                  "threadUrl": "https://www.dench.com/acme/chat/th_abc123",
                  "streamUrl": "https://www.dench.com/api/chat/stream?sessionId=th_abc123",
                  "yolo": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/chat/threads/{threadId}/stream": {
      "get": {
        "operationId": "chat_follow",
        "tags": [
          "chat"
        ],
        "summary": "Follow stream",
        "description": "Follow a live chat response stream.",
        "parameters": [
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Server-Sent Events stream of chat turn updates. Each `data:` line carries a JSON payload; the stream closes when the turn completes.",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "SSE frames (`data: <json>\\n\\n`) until the turn finishes."
                },
                "example": "data: {\"type\":\"start\",\"messageId\":\"msg_01\"}\n\ndata: {\"type\":\"text-delta\",\"id\":\"t1\",\"delta\":\"Hello\"}\n\ndata: {\"type\":\"finish\"}\n\n"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects": {
      "get": {
        "operationId": "crm_objects_list",
        "tags": [
          "crm"
        ],
        "summary": "List objects",
        "description": "List CRM objects.",
        "parameters": [
          {
            "name": "withReferences",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields.",
              "type": "boolean"
            },
            "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "_creationTime": {
                            "type": "number"
                          },
                          "organizationId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "defaultView": {
                            "type": "string",
                            "enum": [
                              "table",
                              "kanban",
                              "calendar",
                              "timeline",
                              "gallery",
                              "list"
                            ],
                            "description": "Default view rendered for the object."
                          },
                          "sortOrder": {
                            "type": "number"
                          },
                          "immutable": {
                            "type": "boolean"
                          },
                          "visibility": {
                            "type": "string",
                            "enum": [
                              "workspace",
                              "owner_only",
                              "owner_plus_members"
                            ],
                            "description": "Who can read the object's records. Always reported as the value the object behaves as: `meeting` defaults to owner_plus_members, `calendar_event` to owner_only, anything else to workspace."
                          },
                          "icon": {
                            "type": "string"
                          },
                          "viewSettings": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          "savedViews": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          },
                          "entryCount": {
                            "type": "number"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "_id",
                          "_creationTime",
                          "organizationId",
                          "name",
                          "defaultView",
                          "sortOrder",
                          "immutable",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": {},
                        "description": "A CRM object (table) document."
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "_creationTime": {
                                "type": "number"
                              },
                              "organizationId": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "defaultView": {
                                "type": "string",
                                "enum": [
                                  "table",
                                  "kanban",
                                  "calendar",
                                  "timeline",
                                  "gallery",
                                  "list"
                                ],
                                "description": "Default view rendered for the object."
                              },
                              "sortOrder": {
                                "type": "number"
                              },
                              "immutable": {
                                "type": "boolean"
                              },
                              "visibility": {
                                "type": "string",
                                "enum": [
                                  "workspace",
                                  "owner_only",
                                  "owner_plus_members"
                                ],
                                "description": "Who can read the object's records. Always reported as the value the object behaves as: `meeting` defaults to owner_plus_members, `calendar_event` to owner_only, anything else to workspace."
                              },
                              "icon": {
                                "type": "string"
                              },
                              "viewSettings": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {}
                              },
                              "savedViews": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {}
                                }
                              },
                              "entryCount": {
                                "type": "number"
                              },
                              "createdAt": {
                                "type": "number"
                              },
                              "updatedAt": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "_id",
                              "_creationTime",
                              "organizationId",
                              "name",
                              "defaultView",
                              "sortOrder",
                              "immutable",
                              "createdAt",
                              "updatedAt"
                            ],
                            "additionalProperties": {},
                            "description": "A CRM object (table) document."
                          }
                        },
                        "references": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-entry"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "entryId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "entryId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-object"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "campaign"
                                  },
                                  "sequenceId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sequenceId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "referenceCoverage": {
                          "type": "object",
                          "properties": {
                            "returned": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "truncated": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "returned",
                            "available",
                            "truncated"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "data",
                        "references",
                        "referenceCoverage"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "example": [
                  {
                    "_id": "obj_lead01",
                    "_creationTime": 1765526400000,
                    "organizationId": "org_abc123",
                    "name": "lead",
                    "description": "Sales leads",
                    "defaultView": "kanban",
                    "sortOrder": 100,
                    "immutable": false,
                    "icon": "target",
                    "entryCount": 42,
                    "createdAt": 1765526400000,
                    "updatedAt": 1765612800000
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "crm_objects_create",
        "tags": [
          "crm"
        ],
        "summary": "Create object",
        "description": "Create a CRM object.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Object name (lowercased, singular)."
                  },
                  "description": {
                    "type": "string"
                  },
                  "defaultView": {
                    "type": "string",
                    "enum": [
                      "table",
                      "kanban",
                      "calendar",
                      "timeline",
                      "gallery",
                      "list"
                    ],
                    "description": "Default view rendered for the object."
                  },
                  "icon": {
                    "description": "Hugeicons (or legacy Lucide) icon name, e.g. user-multiple, target-01.",
                    "type": "string"
                  },
                  "fields": {
                    "description": "Fields to add after the built-in Notes, in column order. The object and its fields are created in one transaction: if any field is rejected, nothing is created.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "description": "Defaults to text.",
                          "type": "string",
                          "enum": [
                            "text",
                            "email",
                            "phone",
                            "url",
                            "number",
                            "boolean",
                            "date",
                            "richtext",
                            "file",
                            "user",
                            "enum",
                            "relation",
                            "tags",
                            "action"
                          ]
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "defaultValue": {
                          "type": "string"
                        },
                        "relatedObjectName": {
                          "description": "Target object for `relation` fields.",
                          "type": "string"
                        },
                        "relationshipType": {
                          "type": "string",
                          "enum": [
                            "many_to_one",
                            "many_to_many"
                          ],
                          "description": "Relation cardinality for a `relation` field."
                        },
                        "enumValues": {
                          "description": "Options for `enum` fields.",
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "enumColors": {
                          "description": "Hex colors aligned to enumValues.",
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "enumMultiple": {
                          "description": "Allow multi-select enum.",
                          "type": "boolean"
                        },
                        "description": {
                          "type": "string"
                        },
                        "indexed": {
                          "description": "Index for filter/search/sort.",
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "name"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "lead",
                "description": "Sales leads",
                "defaultView": "kanban",
                "icon": "target"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "fields": {
                      "description": "The fields created from `fields`, in order.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "obj_lead01"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/catalog/objects": {
      "get": {
        "operationId": "crm_objects_listCompact",
        "tags": [
          "crm"
        ],
        "summary": "List names, display labels, visibility and workspace counts without internal state",
        "description": "List names, display labels, visibility and workspace counts without internal state.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "displayName": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "entryCount": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "countScope": {
                        "type": "string",
                        "enum": [
                          "workspace",
                          "private_unknown"
                        ]
                      },
                      "visibility": {
                        "type": "string",
                        "enum": [
                          "workspace",
                          "owner_only",
                          "owner_plus_members"
                        ]
                      },
                      "archived": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "_id",
                      "name",
                      "displayName",
                      "entryCount",
                      "countScope",
                      "visibility",
                      "archived"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{name}": {
      "get": {
        "operationId": "crm_objects_get",
        "tags": [
          "crm"
        ],
        "summary": "Get object",
        "description": "Get a CRM object.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "_creationTime": {
                          "type": "number"
                        },
                        "organizationId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "defaultView": {
                          "type": "string",
                          "enum": [
                            "table",
                            "kanban",
                            "calendar",
                            "timeline",
                            "gallery",
                            "list"
                          ],
                          "description": "Default view rendered for the object."
                        },
                        "sortOrder": {
                          "type": "number"
                        },
                        "immutable": {
                          "type": "boolean"
                        },
                        "visibility": {
                          "type": "string",
                          "enum": [
                            "workspace",
                            "owner_only",
                            "owner_plus_members"
                          ],
                          "description": "Who can read the object's records. Always reported as the value the object behaves as: `meeting` defaults to owner_plus_members, `calendar_event` to owner_only, anything else to workspace."
                        },
                        "icon": {
                          "type": "string"
                        },
                        "viewSettings": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "savedViews": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "entryCount": {
                          "type": "number"
                        },
                        "createdAt": {
                          "type": "number"
                        },
                        "updatedAt": {
                          "type": "number"
                        },
                        "references": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-entry"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "entryId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "entryId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-object"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "campaign"
                                  },
                                  "sequenceId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sequenceId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "referenceCoverage": {
                          "type": "object",
                          "properties": {
                            "returned": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "truncated": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "returned",
                            "available",
                            "truncated"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "_id",
                        "_creationTime",
                        "organizationId",
                        "name",
                        "defaultView",
                        "sortOrder",
                        "immutable",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "example": {
                  "_id": "obj_lead01",
                  "_creationTime": 1765526400000,
                  "organizationId": "org_abc123",
                  "name": "lead",
                  "description": "Sales leads",
                  "defaultView": "kanban",
                  "sortOrder": 100,
                  "immutable": false,
                  "icon": "target",
                  "entryCount": 42,
                  "createdAt": 1765526400000,
                  "updatedAt": 1765612800000
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "crm_objects_update",
        "tags": [
          "crm"
        ],
        "summary": "Update object",
        "description": "Update a CRM object.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "defaultView": {
                    "type": "string",
                    "enum": [
                      "table",
                      "kanban",
                      "calendar",
                      "timeline",
                      "gallery",
                      "list"
                    ],
                    "description": "Default view rendered for the object."
                  },
                  "icon": {
                    "type": "string"
                  },
                  "viewSettings": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "savedViews": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "visibility": {
                    "description": "Who can see the object's records: every workspace member, only the record's owner, or the owner plus the members listed on the record. Admins only (a signed-in admin; an org-scoped key cannot change it). Records created before the switch have no owner and are hidden from everyone until one is set; switch back to workspace to see them again.",
                    "type": "string",
                    "enum": [
                      "workspace",
                      "owner_only",
                      "owner_plus_members"
                    ]
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "crm_objects_delete",
        "tags": [
          "crm"
        ],
        "summary": "Delete object",
        "description": "Delete a CRM object.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{from}/rename": {
      "post": {
        "operationId": "crm_objects_rename",
        "tags": [
          "crm"
        ],
        "summary": "Rename object",
        "description": "Rename a CRM object.",
        "parameters": [
          {
            "name": "from",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Current object name (path)."
            },
            "description": "Current object name (path)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string",
                    "description": "New object name."
                  }
                },
                "required": [
                  "to"
                ]
              },
              "example": {
                "to": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{name}/archive": {
      "post": {
        "operationId": "crm_objects_archive",
        "tags": [
          "crm"
        ],
        "summary": "Hide a CRM object's workspace sidebar row for the whole workspace. Not a delete — the table keeps working. Admin-only",
        "description": "Hide a CRM object's workspace sidebar row for the whole workspace. Not a delete — the table keeps working. Admin-only.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{name}/unarchive": {
      "post": {
        "operationId": "crm_objects_unarchive",
        "tags": [
          "crm"
        ],
        "summary": "Restore a CRM object's workspace sidebar row. Admin-only",
        "description": "Restore a CRM object's workspace sidebar row. Admin-only.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/views": {
      "get": {
        "operationId": "crm_views_list",
        "tags": [
          "crm"
        ],
        "summary": "List the saved views on a CRM object (plus the active view)",
        "description": "List the saved views on a CRM object (plus the active view).",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "objectName": {
                      "type": "string"
                    },
                    "activeView": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "views": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "objectName",
                    "activeView",
                    "views"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "objectName": "lead",
                  "activeView": "Hot leads",
                  "views": [
                    {
                      "name": "Hot leads",
                      "view_type": "table",
                      "filters": {
                        "id": "g1",
                        "conjunction": "and",
                        "rules": [
                          {
                            "id": "r1",
                            "field": "Status",
                            "operator": "is",
                            "value": "Hot"
                          }
                        ]
                      },
                      "sort": [
                        {
                          "field": "created_at",
                          "direction": "desc"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "crm_views_create",
        "tags": [
          "crm"
        ],
        "summary": "Create a saved view (named filters/sort/columns combo) on a CRM object",
        "description": "Create a saved view (named filters/sort/columns combo) on a CRM object.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "view": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "description": "View name (upsert key; shows in the view dropdown)."
                      },
                      "view_type": {
                        "type": "string",
                        "enum": [
                          "table",
                          "kanban",
                          "calendar",
                          "timeline",
                          "gallery",
                          "list"
                        ],
                        "description": "Default view rendered for the object."
                      },
                      "filters": {
                        "description": "FilterGroup, e.g. {\"id\":\"g1\",\"conjunction\":\"and\",\"rules\":[{\"id\":\"r1\",\"field\":\"Status\",\"operator\":\"is\",\"value\":\"Hot\"}]}. Date rules support operator \"date_preset\" with value \"today\", \"yesterday\", \"this_week\", \"last_week\", \"this_month\", \"last_month\", \"this_quarter\", \"last_quarter\", \"this_year\", or \"last_year\", plus \"relative_past\"/\"relative_next\" with relativeAmount + relativeUnit (days|weeks|months|quarters|years). Rules may target the system timestamps \"created_at\" / \"updated_at\", e.g. {\"field\":\"created_at\",\"operator\":\"relative_past\",\"relativeAmount\":7,\"relativeUnit\":\"days\"}.",
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "sort": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "description": "Field name to sort by."
                            },
                            "direction": {
                              "type": "string",
                              "enum": [
                                "asc",
                                "desc"
                              ]
                            }
                          },
                          "required": [
                            "field",
                            "direction"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "columns": {
                        "description": "Visible-column ordering. Omit to keep the default set.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "settings": {
                        "description": "View-type settings (kanbanField, calendarDateField, timelineStartField, …).",
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "pinnedEntryIds": {
                        "description": "Pinned-list mode: show EXACTLY these entry ids (mutually exclusive with filters).",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "additionalProperties": {}
                  },
                  "replaceExisting": {
                    "description": "Overwrite an existing view with the same name.",
                    "type": "boolean"
                  },
                  "setActive": {
                    "description": "Also switch the object's active view to this one.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "view"
                ]
              },
              "example": {
                "view": {
                  "name": "Hot leads",
                  "view_type": "table",
                  "filters": {
                    "id": "g1",
                    "conjunction": "and",
                    "rules": [
                      {
                        "id": "r1",
                        "field": "Status",
                        "operator": "is",
                        "value": "Hot"
                      }
                    ]
                  },
                  "sort": [
                    {
                      "field": "created_at",
                      "direction": "desc"
                    }
                  ]
                },
                "setActive": true
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "objectName": {
                      "type": "string"
                    },
                    "viewName": {
                      "type": "string"
                    },
                    "replaced": {
                      "type": "boolean"
                    },
                    "activeView": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "ok",
                    "objectName",
                    "viewName",
                    "replaced",
                    "activeView"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "objectName": "lead",
                  "viewName": "Hot leads",
                  "replaced": false,
                  "activeView": "Hot leads"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/views/{viewName}": {
      "get": {
        "operationId": "crm_views_get",
        "tags": [
          "crm"
        ],
        "summary": "Get one saved view's definition by name",
        "description": "Get one saved view's definition by name.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "crm_views_update",
        "tags": [
          "crm"
        ],
        "summary": "Replace a saved view's definition (upsert by name)",
        "description": "Replace a saved view's definition (upsert by name).",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Name of the view to replace (path)."
            },
            "description": "Name of the view to replace (path)."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "view": {
                    "description": "Full replacement definition; the path viewName is used as the name.",
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "description": "View name (upsert key; shows in the view dropdown)."
                      },
                      "view_type": {
                        "type": "string",
                        "enum": [
                          "table",
                          "kanban",
                          "calendar",
                          "timeline",
                          "gallery",
                          "list"
                        ],
                        "description": "Default view rendered for the object."
                      },
                      "filters": {
                        "description": "FilterGroup, e.g. {\"id\":\"g1\",\"conjunction\":\"and\",\"rules\":[{\"id\":\"r1\",\"field\":\"Status\",\"operator\":\"is\",\"value\":\"Hot\"}]}. Date rules support operator \"date_preset\" with value \"today\", \"yesterday\", \"this_week\", \"last_week\", \"this_month\", \"last_month\", \"this_quarter\", \"last_quarter\", \"this_year\", or \"last_year\", plus \"relative_past\"/\"relative_next\" with relativeAmount + relativeUnit (days|weeks|months|quarters|years). Rules may target the system timestamps \"created_at\" / \"updated_at\", e.g. {\"field\":\"created_at\",\"operator\":\"relative_past\",\"relativeAmount\":7,\"relativeUnit\":\"days\"}.",
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "sort": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "description": "Field name to sort by."
                            },
                            "direction": {
                              "type": "string",
                              "enum": [
                                "asc",
                                "desc"
                              ]
                            }
                          },
                          "required": [
                            "field",
                            "direction"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "columns": {
                        "description": "Visible-column ordering. Omit to keep the default set.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "settings": {
                        "description": "View-type settings (kanbanField, calendarDateField, timelineStartField, …).",
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "pinnedEntryIds": {
                        "description": "Pinned-list mode: show EXACTLY these entry ids (mutually exclusive with filters).",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "additionalProperties": {}
                  },
                  "setActive": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "view": {
                  "sort": [
                    {
                      "field": "Score",
                      "direction": "desc"
                    }
                  ],
                  "columns": [
                    "Name",
                    "Email",
                    "Status",
                    "Score"
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "objectName": {
                      "type": "string"
                    },
                    "viewName": {
                      "type": "string"
                    },
                    "replaced": {
                      "type": "boolean"
                    },
                    "activeView": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "ok",
                    "objectName",
                    "viewName",
                    "replaced",
                    "activeView"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "objectName": "lead",
                  "viewName": "Hot leads",
                  "replaced": true,
                  "activeView": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "crm_views_delete",
        "tags": [
          "crm"
        ],
        "summary": "Delete a saved view by name (idempotent)",
        "description": "Delete a saved view by name (idempotent).",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "objectName": {
                      "type": "string"
                    },
                    "viewName": {
                      "type": "string"
                    },
                    "removed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "objectName",
                    "viewName",
                    "removed"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "objectName": "lead",
                  "viewName": "Hot leads",
                  "removed": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/views/{viewName}/entries": {
      "get": {
        "operationId": "crm_views_entries",
        "tags": [
          "crm"
        ],
        "summary": "Materialize a saved view's rows (applies its filters/sort/pins), paginated",
        "description": "Materialize a saved view's rows (applies its filters/sort/pins), paginated.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "assignedTo",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Personal scope: \"me\" (the signed-in member / the human behind an agent session), \"unassigned\", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view.",
              "type": "string"
            },
            "description": "Personal scope: \"me\" (the signed-in member / the human behind an agent session), \"unassigned\", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view."
          },
          {
            "name": "assigneeField",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Which `user` field \"assigned\" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field.",
              "type": "string"
            },
            "description": "Which `user` field \"assigned\" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "description": "Materialized rows: id, entry_id, created_at, updated_at plus one key per field."
                    },
                    "totalCount": {
                      "type": "number"
                    },
                    "page": {
                      "type": "number"
                    },
                    "pageSize": {
                      "type": "number"
                    },
                    "truncated": {
                      "type": "boolean",
                      "description": "True when the read hit a server budget and rows may be missing."
                    },
                    "assigneeScope": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "description": "The user field the scope keyed on."
                            },
                            "target": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "user"
                                    },
                                    "userId": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "userId"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "unassigned"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "field",
                            "target"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The personal assignee scope that was applied, or null."
                    }
                  },
                  "required": [
                    "entries",
                    "totalCount",
                    "page",
                    "pageSize",
                    "truncated",
                    "assigneeScope"
                  ],
                  "additionalProperties": {},
                  "description": "The same payload the workspace table renders from (fields, statuses, savedViews, …)."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/views/{viewName}/rename": {
      "post": {
        "operationId": "crm_views_rename",
        "tags": [
          "crm"
        ],
        "summary": "Rename view",
        "description": "Rename a saved view in place — keeps its filters, pins, and sidebar slot.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/views/{viewName}/archive": {
      "post": {
        "operationId": "crm_views_archive",
        "tags": [
          "crm"
        ],
        "summary": "Move a pinned view's sidebar row into the Archived flyout. Admin-only",
        "description": "Move a pinned view's sidebar row into the Archived flyout. Admin-only.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/views/{viewName}/unarchive": {
      "post": {
        "operationId": "crm_views_unarchive",
        "tags": [
          "crm"
        ],
        "summary": "Restore a view's sidebar row (re-asserts its pin). Admin-only",
        "description": "Restore a view's sidebar row (re-asserts its pin). Admin-only.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/sidebar": {
      "get": {
        "operationId": "crm_sidebar_list",
        "tags": [
          "crm"
        ],
        "summary": "Describe the workspace sidebar: Library rows in tree order (with their groups), the home-level Pinned strip, what is hidden and why, and whether the caller is an admin",
        "description": "Describe the workspace sidebar: Library rows in tree order (with their groups), the home-level Pinned strip, what is hidden and why, and whether the caller is an admin.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "visible": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    "hidden": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "visible",
                    "hidden"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/sidebar/move": {
      "post": {
        "operationId": "crm_sidebar_move",
        "tags": [
          "crm"
        ],
        "summary": "Reposition one Library row (or group) among the Library's top-level slots. Does not add a home-level Pinned tab. Workspace-shared; admin-only",
        "description": "Reposition one Library row (or group) among the Library's top-level slots. Does not add a home-level Pinned tab. Workspace-shared; admin-only.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "navId": {
                    "type": "string",
                    "description": "Nav id from `sidebar list`, e.g. crm-object:task."
                  },
                  "position": {
                    "anyOf": [
                      {
                        "type": "string",
                        "const": "top"
                      },
                      {
                        "type": "string",
                        "const": "bottom"
                      },
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9007199254740991
                      }
                    ],
                    "description": "Where to land among the visible rows; N is 1-based."
                  }
                },
                "required": [
                  "navId",
                  "position"
                ]
              },
              "example": {
                "navId": "string",
                "position": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "navId": {
                      "type": "string"
                    },
                    "position": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "visibleOrder": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "navId",
                    "position"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/sidebar/groups": {
      "post": {
        "operationId": "crm_sidebar_groups_create",
        "tags": [
          "crm"
        ],
        "summary": "Create a named sidebar group (e.g. \"Hiring\") in the workspace-shared Library. Open to any member",
        "description": "Create a named sidebar group (e.g. \"Hiring\") in the workspace-shared Library. Open to any member.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/sidebar/groups/rename": {
      "post": {
        "operationId": "crm_sidebar_groups_rename",
        "tags": [
          "crm"
        ],
        "summary": "Rename a sidebar group. Open to any member",
        "description": "Rename a sidebar group. Open to any member.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/sidebar/groups/delete": {
      "post": {
        "operationId": "crm_sidebar_groups_delete",
        "tags": [
          "crm"
        ],
        "summary": "Dissolve a sidebar group; its rows return to the top level in its slot. Open to any member",
        "description": "Dissolve a sidebar group; its rows return to the top level in its slot. Open to any member.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/sidebar/groups/move": {
      "post": {
        "operationId": "crm_sidebar_groups_move-item",
        "tags": [
          "crm"
        ],
        "summary": "Move a sidebar row into a group (groupId set) or back to the top level (groupId null). Open to any member",
        "description": "Move a sidebar row into a group (groupId set) or back to the top level (groupId null). Open to any member.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/sidebar/pins": {
      "post": {
        "operationId": "crm_sidebar_pins_set",
        "tags": [
          "crm"
        ],
        "summary": "Pin (pinned true) or unpin a Library row — or a whole group — on the home-level Pinned shortcut strip (the \"tab on the left\"). Does not move the row inside Library. Workspace-shared; open to any member",
        "description": "Pin (pinned true) or unpin a Library row — or a whole group — on the home-level Pinned shortcut strip (the \"tab on the left\"). Does not move the row inside Library. Workspace-shared; open to any member.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/fields": {
      "get": {
        "operationId": "crm_fields_list",
        "tags": [
          "crm"
        ],
        "summary": "List fields",
        "description": "List fields for a CRM object, including read-only calculation metadata.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "_creationTime": {
                        "type": "number"
                      },
                      "organizationId": {
                        "type": "string"
                      },
                      "objectId": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "text",
                          "email",
                          "phone",
                          "url",
                          "number",
                          "boolean",
                          "date",
                          "richtext",
                          "file",
                          "user",
                          "enum",
                          "relation",
                          "tags",
                          "action"
                        ],
                        "description": "Field data type. `relation` needs relatedObjectName + relationshipType; `enum` uses enumValues/enumColors; `user` cells store one member userId or an array of member userIds; long prose belongs in the protected `Notes` richtext field."
                      },
                      "required": {
                        "type": "boolean"
                      },
                      "defaultValue": {
                        "type": "string"
                      },
                      "calculation": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "campaign_activity"
                          },
                          "metric": {
                            "type": "string",
                            "enum": [
                              "email_opened",
                              "email_clicked",
                              "replied",
                              "linkedin_connected"
                            ]
                          },
                          "campaignId": {
                            "description": "Same-workspace multichannel campaign ID readable by the viewer. Omit for any accessible multichannel campaign.",
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "kind",
                          "metric"
                        ],
                        "additionalProperties": false,
                        "description": "Read-only campaign activity boolean on people or lead (through Contact), not an expression. Cannot be required, indexed, enriched or have a default value."
                      },
                      "relatedObjectId": {
                        "type": "string"
                      },
                      "relationshipType": {
                        "type": "string",
                        "enum": [
                          "many_to_one",
                          "many_to_many"
                        ],
                        "description": "Relation cardinality for a `relation` field."
                      },
                      "enumValues": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "enumColors": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "enumMultiple": {
                        "type": "boolean"
                      },
                      "sortOrder": {
                        "type": "number"
                      },
                      "indexed": {
                        "type": "boolean"
                      },
                      "createdAt": {
                        "type": "number"
                      },
                      "updatedAt": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "_id",
                      "_creationTime",
                      "organizationId",
                      "objectId",
                      "name",
                      "type",
                      "required",
                      "sortOrder",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": {},
                    "description": "A CRM field (column) document."
                  }
                },
                "example": [
                  {
                    "_id": "fld_status01",
                    "_creationTime": 1765526400000,
                    "organizationId": "org_abc123",
                    "objectId": "obj_lead01",
                    "name": "Status",
                    "type": "enum",
                    "required": false,
                    "enumValues": [
                      "New",
                      "Working",
                      "Qualified",
                      "Lost"
                    ],
                    "enumColors": [
                      "#94a3b8",
                      "#3b82f6",
                      "#22c55e",
                      "#ef4444"
                    ],
                    "enumMultiple": false,
                    "sortOrder": 200,
                    "indexed": true,
                    "createdAt": 1765526400000,
                    "updatedAt": 1765612800000
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "crm_fields_create",
        "tags": [
          "crm"
        ],
        "summary": "Create field",
        "description": "Create a CRM field or read-only campaign activity boolean column.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "type": {
                    "description": "Defaults to boolean with calculation, otherwise text. Calculations require boolean.",
                    "type": "string",
                    "enum": [
                      "text",
                      "email",
                      "phone",
                      "url",
                      "number",
                      "boolean",
                      "date",
                      "richtext",
                      "file",
                      "user",
                      "enum",
                      "relation",
                      "tags",
                      "action"
                    ]
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "defaultValue": {
                    "type": "string"
                  },
                  "relatedObjectName": {
                    "description": "Target object for `relation` fields.",
                    "type": "string"
                  },
                  "relationshipType": {
                    "type": "string",
                    "enum": [
                      "many_to_one",
                      "many_to_many"
                    ],
                    "description": "Relation cardinality for a `relation` field."
                  },
                  "enumValues": {
                    "description": "Options for `enum` fields.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "enumColors": {
                    "description": "Hex colors aligned to enumValues.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "enumMultiple": {
                    "description": "Allow multi-select enum.",
                    "type": "boolean"
                  },
                  "description": {
                    "type": "string"
                  },
                  "indexed": {
                    "description": "Index for filter/search/sort.",
                    "type": "boolean"
                  },
                  "enrichment": {
                    "type": "object",
                    "properties": {
                      "category": {
                        "type": "string",
                        "enum": [
                          "people",
                          "company"
                        ]
                      },
                      "key": {
                        "type": "string"
                      },
                      "apolloPath": {
                        "type": "string"
                      },
                      "inputFieldName": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "category",
                      "key",
                      "apolloPath"
                    ],
                    "additionalProperties": false,
                    "description": "Enrichment binding that lets the field auto-fill from a provider."
                  },
                  "calculation": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "campaign_activity"
                      },
                      "metric": {
                        "type": "string",
                        "enum": [
                          "email_opened",
                          "email_clicked",
                          "replied",
                          "linkedin_connected"
                        ]
                      },
                      "campaignId": {
                        "description": "Same-workspace multichannel campaign ID readable by the viewer. Omit for any accessible multichannel campaign.",
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind",
                      "metric"
                    ],
                    "additionalProperties": false,
                    "description": "Read-only campaign activity boolean on people or lead (through Contact), not an expression. Cannot be required, indexed, enriched or have a default value."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Status",
                "type": "enum",
                "enumValues": [
                  "New",
                  "Working",
                  "Qualified",
                  "Lost"
                ],
                "enumColors": [
                  "#94a3b8",
                  "#3b82f6",
                  "#22c55e",
                  "#ef4444"
                ],
                "indexed": true
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "fld_score01"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/catalog/objects/{objectName}/fields": {
      "get": {
        "operationId": "crm_fields_listCompact",
        "tags": [
          "crm"
        ],
        "summary": "List field names, types and effective constraints without indexing or enrichment internals",
        "description": "List field names, types and effective constraints without indexing or enrichment internals.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string"
                      },
                      "required": {
                        "type": "boolean"
                      },
                      "readOnly": {
                        "type": "boolean"
                      },
                      "defaultValue": {
                        "type": "string"
                      },
                      "enumValues": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "enumMultiple": {
                        "type": "boolean"
                      },
                      "relatedObjectId": {
                        "type": "string"
                      },
                      "relationshipType": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "_id",
                      "name",
                      "type",
                      "required",
                      "readOnly",
                      "enumMultiple"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/fields/{fieldName}": {
      "patch": {
        "operationId": "crm_fields_update",
        "tags": [
          "crm"
        ],
        "summary": "Update field",
        "description": "Update a CRM field or change/explicitly clear an existing campaign calculation.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fieldName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "description": "Rename the field.",
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "enumValues": {
                    "description": "Full replacement of options.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "enumColors": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "enumMultiple": {
                    "type": "boolean"
                  },
                  "indexed": {
                    "type": "boolean"
                  },
                  "enrichment": {
                    "type": "object",
                    "properties": {
                      "category": {
                        "type": "string",
                        "enum": [
                          "people",
                          "company"
                        ]
                      },
                      "key": {
                        "type": "string"
                      },
                      "apolloPath": {
                        "type": "string"
                      },
                      "inputFieldName": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "category",
                      "key",
                      "apolloPath"
                    ],
                    "additionalProperties": false,
                    "description": "Enrichment binding that lets the field auto-fill from a provider."
                  },
                  "clearEnrichment": {
                    "type": "boolean"
                  },
                  "calculation": {
                    "description": "Replace an existing calculation's metric/source. Stored fields cannot be converted; create a new column instead.",
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "campaign_activity"
                      },
                      "metric": {
                        "type": "string",
                        "enum": [
                          "email_opened",
                          "email_clicked",
                          "replied",
                          "linkedin_connected"
                        ]
                      },
                      "campaignId": {
                        "description": "Same-workspace multichannel campaign ID readable by the viewer. Omit for any accessible multichannel campaign.",
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind",
                      "metric"
                    ],
                    "additionalProperties": false
                  },
                  "clearCalculation": {
                    "description": "Explicitly remove an existing calculation, leaving an editable boolean. Does not snapshot calculated values. Mutually exclusive with calculation.",
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "crm_fields_delete",
        "tags": [
          "crm"
        ],
        "summary": "Delete field",
        "description": "Delete a CRM field.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fieldName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/fields/reorder": {
      "post": {
        "operationId": "crm_fields_reorder",
        "tags": [
          "crm"
        ],
        "summary": "Reorder fields",
        "description": "Reorder CRM fields.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orderedFieldNames": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Field names in desired order."
                  }
                },
                "required": [
                  "orderedFieldNames"
                ]
              },
              "example": {
                "orderedFieldNames": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/fields/{fieldName}/enum/reorder": {
      "post": {
        "operationId": "crm_fields_enum_reorder",
        "tags": [
          "crm"
        ],
        "summary": "Reorder enum values",
        "description": "Reorder enum values.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fieldName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orderedValues": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Exact permutation of existing options."
                  }
                },
                "required": [
                  "orderedValues"
                ]
              },
              "example": {
                "orderedValues": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "enumValues": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "enumColors": {
                      "anyOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "ok",
                    "enumValues",
                    "enumColors"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "enumValues": [
                    "New",
                    "Qualified",
                    "Working",
                    "Lost"
                  ],
                  "enumColors": [
                    "#94a3b8",
                    "#22c55e",
                    "#3b82f6",
                    "#ef4444"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/fields/{fieldName}/enum": {
      "post": {
        "operationId": "crm_fields_enum_add",
        "tags": [
          "crm"
        ],
        "summary": "Add enum value",
        "description": "Add an enum value.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fieldName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "description": "Option value to add."
                  },
                  "color": {
                    "description": "Hex color for the option.",
                    "type": "string"
                  },
                  "position": {
                    "description": "0-based insert index; defaults to append.",
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "value"
                ]
              },
              "example": {
                "value": "Nurturing",
                "color": "#eab308",
                "position": 2
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "enumValues": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "enumColors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "inserted": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "enumValues",
                    "enumColors",
                    "inserted"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "enumValues": [
                    "New",
                    "Working",
                    "Nurturing",
                    "Qualified",
                    "Lost"
                  ],
                  "enumColors": [
                    "#94a3b8",
                    "#3b82f6",
                    "#eab308",
                    "#22c55e",
                    "#ef4444"
                  ],
                  "inserted": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/fields/{fieldName}/enum/{value}": {
      "delete": {
        "operationId": "crm_fields_enum_remove",
        "tags": [
          "crm"
        ],
        "summary": "Remove enum value",
        "description": "Remove an enum value.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fieldName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "enumValues": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "enumColors": {
                      "anyOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "removed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "enumValues",
                    "enumColors",
                    "removed"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "enumValues": [
                    "New",
                    "Working",
                    "Qualified"
                  ],
                  "enumColors": [
                    "#94a3b8",
                    "#3b82f6",
                    "#22c55e"
                  ],
                  "removed": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/fields/{fieldName}/enum/{oldValue}/rename": {
      "post": {
        "operationId": "crm_fields_enum_rename",
        "tags": [
          "crm"
        ],
        "summary": "Rename enum value",
        "description": "Rename an enum value.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fieldName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "oldValue",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Existing option value (path)."
            },
            "description": "Existing option value (path)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "newValue": {
                    "type": "string",
                    "description": "New option value; migrates entries + statuses."
                  }
                },
                "required": [
                  "newValue"
                ]
              },
              "example": {
                "newValue": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "enumValues": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "enumColors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "entriesUpdated": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "ok",
                    "enumValues",
                    "enumColors",
                    "entriesUpdated"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "enumValues": [
                    "New",
                    "Working",
                    "Closed Won",
                    "Lost"
                  ],
                  "enumColors": [
                    "#94a3b8",
                    "#3b82f6",
                    "#22c55e",
                    "#ef4444"
                  ],
                  "entriesUpdated": 7
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/fields/{fieldName}/enum/{value}/color": {
      "post": {
        "operationId": "crm_fields_enum_color",
        "tags": [
          "crm"
        ],
        "summary": "Set enum color",
        "description": "Set an enum color.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fieldName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "color": {
                    "type": "string",
                    "description": "Hex color, e.g. #22c55e."
                  }
                },
                "required": [
                  "color"
                ]
              },
              "example": {
                "color": "#22c55e"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "enumColors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "ok",
                    "enumColors"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "enumColors": [
                    "#94a3b8",
                    "#3b82f6",
                    "#22c55e",
                    "#ef4444"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries": {
      "get": {
        "operationId": "crm_entries_list",
        "tags": [
          "crm"
        ],
        "summary": "List entries",
        "description": "List CRM entries.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "withReferences",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields.",
              "type": "boolean"
            },
            "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "assignedTo",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Personal scope: \"me\" (the signed-in member / the human behind an agent session), \"unassigned\", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view.",
              "type": "string"
            },
            "description": "Personal scope: \"me\" (the signed-in member / the human behind an agent session), \"unassigned\", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view."
          },
          {
            "name": "assigneeField",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Which `user` field \"assigned\" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field.",
              "type": "string"
            },
            "description": "Which `user` field \"assigned\" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "objectId": {
                            "type": "string"
                          },
                          "fields": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {},
                            "description": "Field-name -> cell value map."
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          },
                          "updatedBy": {
                            "type": "string"
                          },
                          "sortOrder": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "objectId",
                          "fields",
                          "createdAt",
                          "updatedAt",
                          "updatedBy",
                          "sortOrder"
                        ],
                        "additionalProperties": false,
                        "description": "A materialized CRM entry (row)."
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "objectId": {
                                "type": "string"
                              },
                              "fields": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {},
                                "description": "Field-name -> cell value map."
                              },
                              "createdAt": {
                                "type": "number"
                              },
                              "updatedAt": {
                                "type": "number"
                              },
                              "updatedBy": {
                                "type": "string"
                              },
                              "sortOrder": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "id",
                              "objectId",
                              "fields",
                              "createdAt",
                              "updatedAt",
                              "updatedBy",
                              "sortOrder"
                            ],
                            "additionalProperties": false,
                            "description": "A materialized CRM entry (row)."
                          }
                        },
                        "references": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-entry"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "entryId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "entryId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-object"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "campaign"
                                  },
                                  "sequenceId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sequenceId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "referenceCoverage": {
                          "type": "object",
                          "properties": {
                            "returned": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "truncated": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "returned",
                            "available",
                            "truncated"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "data",
                        "references",
                        "referenceCoverage"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "example": [
                  {
                    "id": "ent_lead99",
                    "objectId": "obj_lead01",
                    "fields": {
                      "Name": "Ada Lovelace",
                      "Email": "ada@example.com",
                      "Status": "New"
                    },
                    "createdAt": 1765526400000,
                    "updatedAt": 1765612800000,
                    "updatedBy": "user:us_xyz789",
                    "sortOrder": 0
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "crm_entries_create",
        "tags": [
          "crm"
        ],
        "summary": "Create entry",
        "description": "Create a CRM entry.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {},
                    "description": "Field-name -> value map. For `user` fields use one member userId or a userId array; preserve every assignee."
                  }
                },
                "required": [
                  "data"
                ]
              },
              "example": {
                "data": {
                  "Name": "Joint review",
                  "Assignee": [
                    "user_kumar",
                    "user_mark"
                  ],
                  "Status": "New"
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entryId": {
                      "type": "string"
                    },
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "entryId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "entryId": "ent_lead99"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}": {
      "get": {
        "operationId": "crm_entries_get",
        "tags": [
          "crm"
        ],
        "summary": "Get entry",
        "description": "Get a CRM entry.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "objectId": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {},
                          "description": "Field-name -> cell value map."
                        },
                        "createdAt": {
                          "type": "number"
                        },
                        "updatedAt": {
                          "type": "number"
                        },
                        "updatedBy": {
                          "type": "string"
                        },
                        "sortOrder": {
                          "type": "number"
                        },
                        "references": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-entry"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "entryId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "entryId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-object"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "campaign"
                                  },
                                  "sequenceId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sequenceId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "referenceCoverage": {
                          "type": "object",
                          "properties": {
                            "returned": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "truncated": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "returned",
                            "available",
                            "truncated"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "id",
                        "objectId",
                        "fields",
                        "createdAt",
                        "updatedAt",
                        "updatedBy",
                        "sortOrder"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "example": {
                  "id": "ent_lead99",
                  "objectId": "obj_lead01",
                  "fields": {
                    "Name": "Ada Lovelace",
                    "Email": "ada@example.com",
                    "Status": "New"
                  },
                  "createdAt": 1765526400000,
                  "updatedAt": 1765612800000,
                  "updatedBy": "user:us_xyz789",
                  "sortOrder": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "crm_entries_update",
        "tags": [
          "crm"
        ],
        "summary": "Update entry",
        "description": "Update a CRM entry.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {},
                    "description": "Field-name -> value map. For `user` fields use one member userId or a userId array; preserve every assignee."
                  }
                },
                "required": [
                  "data"
                ]
              },
              "example": {
                "data": {}
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entryId": {
                      "type": "string"
                    },
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "entryId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "entryId": "ent_lead99"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "crm_entries_delete",
        "tags": [
          "crm"
        ],
        "summary": "Delete entry",
        "description": "Delete a CRM entry.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/sync-history": {
      "post": {
        "operationId": "crm_entries_syncHistory",
        "tags": [
          "crm"
        ],
        "summary": "Queue a full, paged pull of the record's email history from every connected mailbox; the ledger fills as pages land",
        "description": "Queue a full, paged pull of the record's email history from every connected mailbox; the ledger fills as pages land.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "get": {
        "operationId": "crm_entries_syncHistoryStatus",
        "tags": [
          "crm"
        ],
        "summary": "Has Dench read this record's email history? One row per address per mailbox",
        "description": "Has Dench read this record's email history? One row per address per mailbox.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/entries/{entryId}/dossier": {
      "get": {
        "operationId": "crm_entries_dossier_get",
        "tags": [
          "crm"
        ],
        "summary": "Status of the account's research dossier — the delimited `dench:dossier` section Dench keeps in the record's Notes: status, when it was written, how many dated updates followed, the last error",
        "description": "Status of the account's research dossier — the delimited `dench:dossier` section Dench keeps in the record's Notes: status, when it was written, how many dated updates followed, the last error.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/entries/{entryId}/dossier/regenerate": {
      "post": {
        "operationId": "crm_entries_dossier_regenerate",
        "tags": [
          "crm"
        ],
        "summary": "Research the account again and append a fresh dossier section to its Notes (needs a Website / Domain on the record)",
        "description": "Research the account again and append a fresh dossier section to its Notes (needs a Website / Domain on the record).",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/entries/{entryId}/privacy": {
      "get": {
        "operationId": "crm_privacy_get",
        "tags": [
          "crm"
        ],
        "summary": "Whether the caller hides their own emails / messages with this record from the workspace (directly, or through its account), and whether they own a connection the toggle applies to",
        "description": "Whether the caller hides their own emails / messages with this record from the workspace (directly, or through its account), and whether they own a connection the toggle applies to.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "crm_privacy_set",
        "tags": [
          "crm"
        ],
        "summary": "Hide (`hidden: true`) or show the caller's own emails / messages with this record to the workspace. An account covers every contact and opportunity linked to it; existing ledger rows are restamped and the shared Brief regenerates",
        "description": "Hide (`hidden: true`) or show the caller's own emails / messages with this record to the workspace. An account covers every contact and opportunity linked to it; existing ledger rows are restamped and the shared Brief regenerates.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "hidden": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "hidden"
                ]
              },
              "example": {
                "hidden": true
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/detections": {
      "get": {
        "operationId": "crm_detections_list",
        "tags": [
          "crm"
        ],
        "summary": "List account-detection verdicts — why a domain (or personal address) did or did not become an account: verdict, counterparty type, probabilities, evidence threads, the rows created. `kind` picks the creator: `detections` (email + sweep), `linkedin` (the LinkedIn resolver's rows) or `all` (default). Newest first",
        "description": "List account-detection verdicts — why a domain (or personal address) did or did not become an account: verdict, counterparty type, probabilities, evidence threads, the rows created. `kind` picks the creator: `detections` (email + sweep), `linkedin` (the LinkedIn resolver's rows) or `all` (default). Newest first.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/detections/undo": {
      "post": {
        "operationId": "crm_detections_undo",
        "tags": [
          "crm"
        ],
        "summary": "Undo what the ingestion jobs created since a timestamp (admin): `kind` = `detections` (accounts + contacts from the email detector and the sweep), `linkedin` (the LinkedIn resolver's contacts + accounts; their conversations are unlinked and parked), `email-tasks` (auto-created tasks and cases) or `all` (default). Deletes only rows no human has touched and marks the verdicts / decisions rolled_back so they are never re-created. `dryRun` lists what would go; per-kind counts in `kinds`",
        "description": "Undo what the ingestion jobs created since a timestamp (admin): `kind` = `detections` (accounts + contacts from the email detector and the sweep), `linkedin` (the LinkedIn resolver's contacts + accounts; their conversations are unlinked and parked), `email-tasks` (auto-created tasks and cases) or `all` (default). Deletes only rows no human has touched and marks the verdicts / decisions rolled_back so they are never re-created. `dryRun` lists what would go; per-kind counts in `kinds`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "since": {
                    "type": "number",
                    "description": "Only verdicts / decisions at or after this ms timestamp."
                  },
                  "kind": {
                    "description": "Which creator's rows to undo. Default `all`.",
                    "type": "string",
                    "enum": [
                      "detections",
                      "linkedin",
                      "email-tasks",
                      "all"
                    ]
                  },
                  "dryRun": {
                    "type": "boolean"
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  }
                },
                "required": [
                  "since"
                ]
              },
              "example": {
                "since": 0
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/history": {
      "get": {
        "operationId": "crm_entries_history",
        "tags": [
          "crm"
        ],
        "summary": "List a CRM entry's audit history",
        "description": "List a CRM entry's audit history.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/activity": {
      "get": {
        "operationId": "crm_activity_list",
        "tags": [
          "crm"
        ],
        "summary": "List a CRM entry's activity ledger (comments, notes, field changes, emails, meetings, Slack, LinkedIn) in one timeline, newest first by default",
        "description": "List a CRM entry's activity ledger (comments, notes, field changes, emails, meetings, Slack, LinkedIn) in one timeline, newest first by default.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/brief": {
      "get": {
        "operationId": "crm_brief_get",
        "tags": [
          "crm"
        ],
        "summary": "The record's generated Brief: health, who owes the next move, open threads, commitments, risks, next step. Read this before the ledger",
        "description": "The record's generated Brief: health, who owes the next move, open threads, commitments, risks, next step. Read this before the ledger.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/context": {
      "get": {
        "operationId": "crm_context_get",
        "tags": [
          "crm"
        ],
        "summary": "Read-only source diagnostics: accessible evidence, association reasons, last Brief source manifest, generation queue, and your mailbox delivery health. Bounded, cursor-paged snapshot; does not certify complete history",
        "description": "Read-only source diagnostics: accessible evidence, association reasons, last Brief source manifest, generation queue, and your mailbox delivery health. Bounded, cursor-paged snapshot; does not certify complete history.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/brief/regenerate": {
      "post": {
        "operationId": "crm_brief_regenerate",
        "tags": [
          "crm"
        ],
        "summary": "Rebuild a record's Brief from the current timeline",
        "description": "Rebuild a record's Brief from the current timeline.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/activity/count": {
      "get": {
        "operationId": "crm_activity_count",
        "tags": [
          "crm"
        ],
        "summary": "Bounded per-source counts of a CRM entry's activity ledger",
        "description": "Bounded per-source counts of a CRM entry's activity ledger.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/notes": {
      "get": {
        "operationId": "crm_notes_list",
        "tags": [
          "crm"
        ],
        "summary": "List a CRM entry's notes (titled, document-style comments), newest first",
        "description": "List a CRM entry's notes (titled, document-style comments), newest first.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "crm_notes_create",
        "tags": [
          "crm"
        ],
        "summary": "Add a titled note to a CRM entry's activity timeline (markdown body). Research goes here, never into the Notes document",
        "description": "Add a titled note to a CRM entry's activity timeline (markdown body). Research goes here, never into the Notes document.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/comments": {
      "get": {
        "operationId": "crm_comments_list",
        "tags": [
          "crm"
        ],
        "summary": "List comments on a CRM entry (roots newest first, with preview replies)",
        "description": "List comments on a CRM entry (roots newest first, with preview replies).",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "description": "continueCursor from the prior page.",
              "type": "string"
            },
            "description": "continueCursor from the prior page."
          },
          {
            "name": "replies",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Preview replies per root (default 2).",
              "type": "integer",
              "minimum": 0,
              "maximum": 50
            },
            "description": "Preview replies per root (default 2)."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "entryId": {
                            "type": "string"
                          },
                          "parentCommentId": {
                            "type": "string"
                          },
                          "rootCommentId": {
                            "type": "string"
                          },
                          "depth": {
                            "type": "number"
                          },
                          "body": {
                            "type": "string",
                            "description": "Markdown."
                          },
                          "actor": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "string"
                              },
                              "isDench": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "kind",
                              "label",
                              "isDench"
                            ],
                            "additionalProperties": {}
                          },
                          "mentionedUserIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "mentionsDench": {
                            "type": "boolean"
                          },
                          "replyCount": {
                            "type": "number"
                          },
                          "reactionSummary": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "emoji": {
                                  "type": "string"
                                },
                                "count": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "emoji",
                                "count"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "viewerReactions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "editedAt": {
                            "type": "number"
                          },
                          "deletedAt": {
                            "type": "number"
                          },
                          "denchStatus": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "failed",
                              "done"
                            ]
                          },
                          "canEdit": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "replies": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "entryId": {
                                  "type": "string"
                                },
                                "parentCommentId": {
                                  "type": "string"
                                },
                                "rootCommentId": {
                                  "type": "string"
                                },
                                "depth": {
                                  "type": "number"
                                },
                                "body": {
                                  "type": "string",
                                  "description": "Markdown."
                                },
                                "actor": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string"
                                    },
                                    "label": {
                                      "type": "string"
                                    },
                                    "displayName": {
                                      "type": "string"
                                    },
                                    "imageUrl": {
                                      "type": "string"
                                    },
                                    "userId": {
                                      "type": "string"
                                    },
                                    "isDench": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "label",
                                    "isDench"
                                  ],
                                  "additionalProperties": {}
                                },
                                "mentionedUserIds": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "mentionsDench": {
                                  "type": "boolean"
                                },
                                "replyCount": {
                                  "type": "number"
                                },
                                "reactionSummary": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "emoji": {
                                        "type": "string"
                                      },
                                      "count": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "emoji",
                                      "count"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "viewerReactions": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "editedAt": {
                                  "type": "number"
                                },
                                "deletedAt": {
                                  "type": "number"
                                },
                                "denchStatus": {
                                  "type": "string",
                                  "enum": [
                                    "pending",
                                    "failed",
                                    "done"
                                  ]
                                },
                                "canEdit": {
                                  "type": "boolean"
                                },
                                "createdAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "_id",
                                "entryId",
                                "depth",
                                "body",
                                "actor",
                                "mentionedUserIds",
                                "mentionsDench",
                                "replyCount",
                                "reactionSummary",
                                "viewerReactions",
                                "canEdit",
                                "createdAt"
                              ],
                              "additionalProperties": {},
                              "description": "A comment on a CRM entry."
                            }
                          }
                        },
                        "required": [
                          "_id",
                          "entryId",
                          "depth",
                          "body",
                          "actor",
                          "mentionedUserIds",
                          "mentionsDench",
                          "replyCount",
                          "reactionSummary",
                          "viewerReactions",
                          "canEdit",
                          "createdAt",
                          "replies"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "isDone": {
                      "type": "boolean"
                    },
                    "continueCursor": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "page",
                    "isDone",
                    "continueCursor"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "page": [
                    {
                      "_id": "cmt_01",
                      "entryId": "ent_lead99",
                      "depth": 0,
                      "body": "Kickoff went well — [@Bob](/?member=user_bob) can you send the proposal?",
                      "actor": {
                        "kind": "user",
                        "label": "Ada",
                        "displayName": "Ada Lovelace",
                        "userId": "user_ada",
                        "isDench": false
                      },
                      "mentionedUserIds": [
                        "user_bob"
                      ],
                      "mentionsDench": false,
                      "replyCount": 1,
                      "reactionSummary": [
                        {
                          "emoji": "👍",
                          "count": 2
                        }
                      ],
                      "viewerReactions": [
                        "👍"
                      ],
                      "canEdit": true,
                      "createdAt": 1765526400000,
                      "replies": [
                        {
                          "_id": "cmt_02",
                          "entryId": "ent_lead99",
                          "parentCommentId": "cmt_01",
                          "rootCommentId": "cmt_01",
                          "depth": 1,
                          "body": "On it.",
                          "actor": {
                            "kind": "user",
                            "label": "Bob",
                            "displayName": "Bob Smith",
                            "userId": "user_bob",
                            "isDench": false
                          },
                          "mentionedUserIds": [],
                          "mentionsDench": false,
                          "replyCount": 0,
                          "reactionSummary": [],
                          "viewerReactions": [],
                          "canEdit": false,
                          "createdAt": 1765530000000
                        }
                      ]
                    }
                  ],
                  "isDone": true,
                  "continueCursor": ""
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "crm_comments_create",
        "tags": [
          "crm"
        ],
        "summary": "Comment on a CRM entry (markdown). Mention members with [@Name](/?member=<userId>); mention Dench with [@Dench](/?member=dench) or mentionDench",
        "description": "Comment on a CRM entry (markdown). Mention members with [@Name](/?member=<userId>); mention Dench with [@Dench](/?member=dench) or mentionDench.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Markdown. Mention a member with [@Name](/?member=<userId>); mention Dench with [@Dench](/?member=dench)."
                  },
                  "parentCommentId": {
                    "description": "Reply under this comment (any depth).",
                    "type": "string"
                  },
                  "mentionUserIds": {
                    "description": "Extra members to notify without writing mention links.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "mentionDench": {
                    "description": "Summon Dench to reply in the thread.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "body"
                ]
              },
              "example": {
                "body": "Kickoff went well — [@Bob](/?member=user_bob) can you send the proposal? [@Dench](/?member=dench) what's the ARR here?"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "rootCommentId": {
                      "type": "string"
                    },
                    "depth": {
                      "type": "number"
                    },
                    "mentionedUserIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "mentionsDench": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "depth",
                    "mentionedUserIds",
                    "mentionsDench"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "cmt_03",
                  "rootCommentId": "cmt_01",
                  "depth": 1,
                  "mentionedUserIds": [
                    "user_bob"
                  ],
                  "mentionsDench": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/comments/{commentId}/replies": {
      "get": {
        "operationId": "crm_comments_replies",
        "tags": [
          "crm"
        ],
        "summary": "List every reply under a root comment, oldest first",
        "description": "List every reply under a root comment, oldest first.",
        "parameters": [
          {
            "name": "commentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Root comment id."
            },
            "description": "Root comment id."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "entryId": {
                            "type": "string"
                          },
                          "parentCommentId": {
                            "type": "string"
                          },
                          "rootCommentId": {
                            "type": "string"
                          },
                          "depth": {
                            "type": "number"
                          },
                          "body": {
                            "type": "string",
                            "description": "Markdown."
                          },
                          "actor": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "string"
                              },
                              "isDench": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "kind",
                              "label",
                              "isDench"
                            ],
                            "additionalProperties": {}
                          },
                          "mentionedUserIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "mentionsDench": {
                            "type": "boolean"
                          },
                          "replyCount": {
                            "type": "number"
                          },
                          "reactionSummary": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "emoji": {
                                  "type": "string"
                                },
                                "count": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "emoji",
                                "count"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "viewerReactions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "editedAt": {
                            "type": "number"
                          },
                          "deletedAt": {
                            "type": "number"
                          },
                          "denchStatus": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "failed",
                              "done"
                            ]
                          },
                          "canEdit": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "_id",
                          "entryId",
                          "depth",
                          "body",
                          "actor",
                          "mentionedUserIds",
                          "mentionsDench",
                          "replyCount",
                          "reactionSummary",
                          "viewerReactions",
                          "canEdit",
                          "createdAt"
                        ],
                        "additionalProperties": {},
                        "description": "A comment on a CRM entry."
                      }
                    },
                    "isDone": {
                      "type": "boolean"
                    },
                    "continueCursor": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "page",
                    "isDone",
                    "continueCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/comments/{commentId}": {
      "get": {
        "operationId": "crm_comments_get",
        "tags": [
          "crm"
        ],
        "summary": "Get one comment with its entry label",
        "description": "Get one comment with its entry label.",
        "parameters": [
          {
            "name": "commentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "entryId": {
                      "type": "string"
                    },
                    "parentCommentId": {
                      "type": "string"
                    },
                    "rootCommentId": {
                      "type": "string"
                    },
                    "depth": {
                      "type": "number"
                    },
                    "body": {
                      "type": "string",
                      "description": "Markdown."
                    },
                    "actor": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        },
                        "imageUrl": {
                          "type": "string"
                        },
                        "userId": {
                          "type": "string"
                        },
                        "isDench": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "kind",
                        "label",
                        "isDench"
                      ],
                      "additionalProperties": {}
                    },
                    "mentionedUserIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "mentionsDench": {
                      "type": "boolean"
                    },
                    "replyCount": {
                      "type": "number"
                    },
                    "reactionSummary": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "emoji": {
                            "type": "string"
                          },
                          "count": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "emoji",
                          "count"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "viewerReactions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "editedAt": {
                      "type": "number"
                    },
                    "deletedAt": {
                      "type": "number"
                    },
                    "denchStatus": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "failed",
                        "done"
                      ]
                    },
                    "canEdit": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "number"
                    },
                    "objectName": {
                      "type": "string"
                    },
                    "entryLabel": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "_id",
                    "entryId",
                    "depth",
                    "body",
                    "actor",
                    "mentionedUserIds",
                    "mentionsDench",
                    "replyCount",
                    "reactionSummary",
                    "viewerReactions",
                    "canEdit",
                    "createdAt",
                    "objectName",
                    "entryLabel"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "crm_comments_update",
        "tags": [
          "crm"
        ],
        "summary": "Edit a comment you wrote",
        "description": "Edit a comment you wrote.",
        "parameters": [
          {
            "name": "commentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "body"
                ]
              },
              "example": {
                "body": "Kickoff went well — proposal sent."
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "newlyMentioned": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "ok",
                    "newlyMentioned"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "crm_comments_delete",
        "tags": [
          "crm"
        ],
        "summary": "Delete a comment (kept as a tombstone when it has replies)",
        "description": "Delete a comment (kept as a tombstone when it has replies).",
        "parameters": [
          {
            "name": "commentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "tombstoned": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "tombstoned"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/comments/{commentId}/reactions/{emoji}": {
      "put": {
        "operationId": "crm_comments_react",
        "tags": [
          "crm"
        ],
        "summary": "Toggle an emoji reaction on a comment",
        "description": "Toggle an emoji reaction on a comment.",
        "parameters": [
          {
            "name": "commentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "emoji",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "A single emoji, e.g. 👍."
            },
            "description": "A single emoji, e.g. 👍."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reacted": {
                      "type": "boolean"
                    },
                    "reactionSummary": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "emoji": {
                            "type": "string"
                          },
                          "count": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "emoji",
                          "count"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "reacted",
                    "reactionSummary"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "reacted": true,
                  "reactionSummary": [
                    {
                      "emoji": "👍",
                      "count": 3
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/watch": {
      "get": {
        "operationId": "crm_watch_get",
        "tags": [
          "crm"
        ],
        "summary": "Whether you follow a CRM entry's activity",
        "description": "Whether you follow a CRM entry's activity.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "watching": {
                      "type": "boolean"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "watcherCount": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "watching",
                    "watcherCount"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "watching": true,
                  "reason": "commented",
                  "watcherCount": 3
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "crm_watch_set",
        "tags": [
          "crm"
        ],
        "summary": "Follow or unfollow a CRM entry's activity",
        "description": "Follow or unfollow a CRM entry's activity.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "watching": {
                    "description": "Defaults to true; false unfollows.",
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "watching": true
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "watching": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "watching"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/assigned/page": {
      "post": {
        "operationId": "crm_tasks_pageAssigned",
        "tags": [
          "crm"
        ],
        "summary": "Page assigned tasks in priority order (or completed tasks by recency)",
        "description": "Page assigned tasks in priority order (or completed tasks by recency).",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/tasks/page": {
      "post": {
        "operationId": "crm_tasks_pageForEntry",
        "tags": [
          "crm"
        ],
        "summary": "Page all tasks linked to a record, including subtasks",
        "description": "Page all tasks linked to a record, including subtasks.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/prepare": {
      "post": {
        "operationId": "crm_tasks_prepare",
        "tags": [
          "crm"
        ],
        "summary": "Start or resume preparation of exact task ordering and progress",
        "description": "Start or resume preparation of exact task ordering and progress.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/mine": {
      "get": {
        "operationId": "crm_tasks_mine",
        "tags": [
          "crm"
        ],
        "summary": "Your open tasks (plus ones completed today)",
        "description": "Your open tasks (plus ones completed today).",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "priority",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Only tasks at this priority — one of the workspace's Priority options (\"high\"; case-insensitive).",
              "type": "string"
            },
            "description": "Only tasks at this priority — one of the workspace's Priority options (\"high\"; case-insensitive)."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": {}
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/tasks": {
      "get": {
        "operationId": "crm_tasks_forEntry",
        "tags": [
          "crm"
        ],
        "summary": "Tasks linked to a CRM entry",
        "description": "Tasks linked to a CRM entry.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": {}
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "crm_tasks_createForEntry",
        "tags": [
          "crm"
        ],
        "summary": "Create a task linked to a CRM entry",
        "description": "Create a task linked to a CRM entry.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "assigneeUserId": {
                    "type": "string"
                  },
                  "dueDateKey": {
                    "description": "YYYY-MM-DD",
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "priority": {
                    "description": "One of the workspace's Priority options (default Low | Medium | High; case-insensitive).",
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Send proposal",
                "assigneeUserId": "user_bob",
                "dueDateKey": "2026-09-05"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/{entryId}/complete": {
      "post": {
        "operationId": "crm_tasks_complete",
        "tags": [
          "crm"
        ],
        "summary": "Mark a task done",
        "description": "Mark a task done.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/{entryId}/reopen": {
      "post": {
        "operationId": "crm_tasks_reopen",
        "tags": [
          "crm"
        ],
        "summary": "Reopen a completed task",
        "description": "Reopen a completed task.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/{entryId}/priority": {
      "put": {
        "operationId": "crm_tasks_setPriority",
        "tags": [
          "crm"
        ],
        "summary": "Set or clear a task's priority",
        "description": "Set or clear a task's priority.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "priority": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "One of the workspace's Priority options (\"high\"; case-insensitive), or null to clear."
                  }
                },
                "required": [
                  "priority"
                ]
              },
              "example": {
                "priority": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/{entryId}/subtasks": {
      "get": {
        "operationId": "crm_tasks_subtasks_list",
        "tags": [
          "crm"
        ],
        "summary": "A task's subtasks",
        "description": "A task's subtasks.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": {}
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "crm_tasks_subtasks_create",
        "tags": [
          "crm"
        ],
        "summary": "Create a subtask under a task (inherits the parent's record relations)",
        "description": "Create a subtask under a task (inherits the parent's record relations).",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The parent task."
            },
            "description": "The parent task."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "assigneeUserId": {
                    "type": "string"
                  },
                  "dueDateKey": {
                    "description": "YYYY-MM-DD",
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "priority": {
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/{entryId}/parent": {
      "put": {
        "operationId": "crm_tasks_setParent",
        "tags": [
          "crm"
        ],
        "summary": "Nest a task under a parent, or promote it (parentEntryId: null)",
        "description": "Nest a task under a parent, or promote it (parentEntryId: null).",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "parentEntryId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The parent task, or null to promote to a top-level task."
                  }
                },
                "required": [
                  "parentEntryId"
                ]
              },
              "example": {
                "parentEntryId": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/{entryId}": {
      "delete": {
        "operationId": "crm_tasks_delete",
        "tags": [
          "crm"
        ],
        "summary": "Delete a task and its subtasks, or keep them as tasks",
        "description": "Delete a task and its subtasks, or keep them as tasks.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subtasks": {
                    "description": "What happens to its subtasks: delete them too (default) or keep them as tasks.",
                    "type": "string",
                    "enum": [
                      "delete",
                      "keep"
                    ]
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/{entryId}/repeat": {
      "get": {
        "operationId": "crm_tasks_repeat_get",
        "tags": [
          "crm"
        ],
        "summary": "How a task repeats (rule, RRULE, trigger, ends, next due)",
        "description": "How a task repeats (rule, RRULE, trigger, ends, next due).",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {},
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "crm_tasks_repeat_set",
        "tags": [
          "crm"
        ],
        "summary": "Make a task repeat, or change how it repeats (JSON rule or RRULE). An undated task gets its due date anchored on the first matching day from today",
        "description": "Make a task repeat, or change how it repeats (JSON rule or RRULE). An undated task gets its due date anchored on the first matching day from today.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rule": {
                    "description": "Structured rule; alternative to `rrule`.",
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "freq": {
                            "type": "string",
                            "const": "daily"
                          },
                          "interval": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "freq",
                          "interval"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "freq": {
                            "type": "string",
                            "const": "weekly"
                          },
                          "interval": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "byWeekday": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "mo",
                                "tu",
                                "we",
                                "th",
                                "fr",
                                "sa",
                                "su"
                              ]
                            }
                          }
                        },
                        "required": [
                          "freq",
                          "interval",
                          "byWeekday"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "freq": {
                            "type": "string",
                            "const": "monthly"
                          },
                          "interval": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "byMonthDay": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "description": "1–31, or -1 for the last day of the month."
                          },
                          "bySetPos": {
                            "type": "object",
                            "properties": {
                              "ordinal": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991,
                                "description": "1–4, or -1 for the last week."
                              },
                              "weekday": {
                                "type": "string",
                                "enum": [
                                  "mo",
                                  "tu",
                                  "we",
                                  "th",
                                  "fr",
                                  "sa",
                                  "su"
                                ]
                              }
                            },
                            "required": [
                              "ordinal",
                              "weekday"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "freq",
                          "interval"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "freq": {
                            "type": "string",
                            "const": "yearly"
                          },
                          "interval": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "month": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 12
                          },
                          "day": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 31
                          }
                        },
                        "required": [
                          "freq",
                          "interval",
                          "month",
                          "day"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "rrule": {
                    "description": "RFC 5545 subset: FREQ, INTERVAL, BYDAY (ordinal allowed for MONTHLY, e.g. 2TU / -1FR), BYMONTHDAY, BYMONTH, COUNT, UNTIL. Bare FREQ=MONTHLY / YEARLY / WEEKLY take the day from the task's due date.",
                    "type": "string"
                  },
                  "trigger": {
                    "description": "When the next occurrence is created: after this one is done (default) or on schedule regardless.",
                    "type": "string",
                    "enum": [
                      "after_completion",
                      "on_schedule"
                    ]
                  },
                  "ends": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "never"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "count"
                          },
                          "count": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "count"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "until"
                          },
                          "dateKey": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          }
                        },
                        "required": [
                          "kind",
                          "dateKey"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "skipWeekends": {
                        "type": "boolean"
                      },
                      "keepAssignee": {
                        "type": "boolean"
                      },
                      "copyNotes": {
                        "type": "boolean"
                      },
                      "copySubtasks": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {},
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "crm_tasks_repeat_clear",
        "tags": [
          "crm"
        ],
        "summary": "Stop a task repeating (past occurrences are kept)",
        "description": "Stop a task repeating (past occurrences are kept).",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "null"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/{entryId}/repeat/skip": {
      "post": {
        "operationId": "crm_tasks_repeat_skip",
        "tags": [
          "crm"
        ],
        "summary": "Skip the current occurrence: the next one is created now",
        "description": "Skip the current occurrence: the next one is created now.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/{entryId}/repeat/pause": {
      "post": {
        "operationId": "crm_tasks_repeat_pause",
        "tags": [
          "crm"
        ],
        "summary": "Pause a repeating task",
        "description": "Pause a repeating task.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "null"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/{entryId}/repeat/resume": {
      "post": {
        "operationId": "crm_tasks_repeat_resume",
        "tags": [
          "crm"
        ],
        "summary": "Resume a paused repeating task",
        "description": "Resume a paused repeating task.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "null"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/series": {
      "get": {
        "operationId": "crm_tasks_series_list",
        "tags": [
          "crm"
        ],
        "summary": "Every repeating-task series in the workspace",
        "description": "Every repeating-task series in the workspace.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "paused",
                "ended"
              ]
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": {}
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/tasks/series/{seriesId}/occurrences": {
      "get": {
        "operationId": "crm_tasks_series_occurrences",
        "tags": [
          "crm"
        ],
        "summary": "Every occurrence (task) of one series",
        "description": "Every occurrence (task) of one series.",
        "parameters": [
          {
            "name": "seriesId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": {}
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/batch": {
      "post": {
        "operationId": "crm_entries_createMany",
        "tags": [
          "crm"
        ],
        "summary": "Create many entries",
        "description": "Create many CRM entries.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entries": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {},
                      "description": "Field-name -> value map. For `user` fields use one member userId or a userId array; preserve every assignee."
                    },
                    "description": "Up to 200 field maps."
                  }
                },
                "required": [
                  "entries"
                ]
              },
              "example": {
                "entries": [
                  {
                    "Name": "Jane",
                    "Email": "jane@example.com"
                  },
                  {
                    "Name": "Bob",
                    "Email": "bob@example.com"
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entryId": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "entryId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "count": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "results",
                    "count"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "results": [
                    {
                      "entryId": "ent_lead99"
                    },
                    {
                      "entryId": "ent_lead100"
                    }
                  ],
                  "count": 2
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "crm_entries_updateMany",
        "tags": [
          "crm"
        ],
        "summary": "Update many entries",
        "description": "Update many CRM entries.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Object the entries belong to."
            },
            "description": "Object the entries belong to."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "updates": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "entryId": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "data": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {},
                          "description": "Field-name -> value map. For `user` fields use one member userId or a userId array; preserve every assignee."
                        }
                      },
                      "required": [
                        "data"
                      ],
                      "additionalProperties": false
                    },
                    "description": "Per-entry partial updates (entryId or id + data)."
                  }
                },
                "required": [
                  "updates"
                ]
              },
              "example": {
                "updates": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entryId": {
                            "type": "string"
                          },
                          "deleted": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "entryId"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "count": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "results",
                    "count"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "results": [
                    {
                      "entryId": "ent_lead99"
                    },
                    {
                      "entryId": "ent_lead100"
                    }
                  ],
                  "count": 2
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/delete": {
      "post": {
        "operationId": "crm_entries_bulkDelete",
        "tags": [
          "crm"
        ],
        "summary": "Bulk delete entries",
        "description": "Bulk delete CRM entries.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entryIds": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "entryIds"
                ]
              },
              "example": {
                "entryIds": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "count"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "count": 3
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/fields/{fieldName}": {
      "get": {
        "operationId": "crm_cells_get",
        "tags": [
          "crm"
        ],
        "summary": "Get cell",
        "description": "Get a CRM cell value.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fieldName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Cell value. Enum=option string, tags=string array, user=one member userId or a userId array, relation=related entry id, boolean=true/false."
                },
                "example": "Qualified"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "crm_cells_set",
        "tags": [
          "crm"
        ],
        "summary": "Set cell",
        "description": "Set a CRM cell value.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fieldName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "description": "Cell value. Enum=option string, tags=string array, user=one member userId or a userId array, relation=related entry id, boolean=true/false."
                  }
                },
                "required": [
                  "value"
                ]
              },
              "example": {
                "value": [
                  "user_kumar",
                  "user_mark"
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entryId": {
                      "type": "string"
                    },
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "entryId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "entryId": "ent_lead99"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/cells/batch": {
      "post": {
        "operationId": "crm_cells_setMany",
        "tags": [
          "crm"
        ],
        "summary": "Set many cells",
        "description": "Set many CRM cell values.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cells": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "objectName": {
                          "type": "string"
                        },
                        "entryId": {
                          "type": "string"
                        },
                        "fieldName": {
                          "type": "string"
                        },
                        "value": {
                          "description": "Cell value. Enum=option string, tags=string array, user=one member userId or a userId array, relation=related entry id, boolean=true/false."
                        }
                      },
                      "required": [
                        "objectName",
                        "entryId",
                        "fieldName",
                        "value"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "cells"
                ]
              },
              "example": {
                "cells": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entryId": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "entryId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "count": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "results",
                    "count"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "results": [
                    {
                      "entryId": "ent_lead99"
                    },
                    {
                      "entryId": "ent_lead100"
                    }
                  ],
                  "count": 2
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/entries/{entryId}/fields/{fieldName}/append": {
      "post": {
        "operationId": "crm_cells_append",
        "tags": [
          "crm"
        ],
        "summary": "Append cell",
        "description": "Append to a CRM cell.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fieldName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "description": "Cell value. Enum=option string, tags=string array, user=one member userId or a userId array, relation=related entry id, boolean=true/false."
                  }
                },
                "required": [
                  "value"
                ]
              },
              "example": {
                "value": "value"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entryId": {
                      "type": "string"
                    },
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "entryId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "entryId": "ent_lead99"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/query": {
      "post": {
        "operationId": "crm_query",
        "tags": [
          "crm"
        ],
        "summary": "Query entries",
        "description": "Query CRM entries.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "withReferences": {
                    "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields.",
                    "type": "boolean"
                  },
                  "objectName": {
                    "type": "string"
                  },
                  "dsl": {
                    "description": "Query DSL. Bare equality only; use dslJson for $-operators.",
                    "type": "object",
                    "properties": {
                      "filter": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "select": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "sort": {
                        "description": "e.g. -Score,Name (- = desc).",
                        "type": "string"
                      },
                      "limit": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    },
                    "additionalProperties": false
                  },
                  "dslJson": {
                    "description": "JSON string of the DSL when filters use operators like $gt/$in/$contains/$and/$or. Date fields and the system timestamps created_at/updated_at also accept $datePreset (\"today\", \"yesterday\", \"this_week\", \"last_week\", \"this_month\", \"last_month\", \"this_quarter\", \"last_quarter\", \"this_year\", \"last_year\"), and $inLast/$inNext rolling windows (a day count like 7, or {\"amount\":2,\"unit\":\"weeks\"} with unit days|weeks|months|quarters|years). Example: {\"filter\":{\"updated_at\":{\"$datePreset\":\"this_month\"}}}.",
                    "type": "string"
                  },
                  "assignedTo": {
                    "description": "Personal scope: \"me\" (the signed-in member / the human behind an agent session), \"unassigned\", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view.",
                    "type": "string"
                  },
                  "assigneeField": {
                    "description": "Which `user` field \"assigned\" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field.",
                    "type": "string"
                  }
                },
                "required": [
                  "objectName"
                ]
              },
              "example": {
                "objectName": "lead",
                "dslJson": "{\"filter\":{\"Status\":\"Qualified\",\"Score\":{\"$gt\":50}},\"sort\":\"-Score\",\"limit\":50}"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "references": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-entry"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "entryId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "entryId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-object"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "campaign"
                                  },
                                  "sequenceId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sequenceId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "referenceCoverage": {
                          "type": "object",
                          "properties": {
                            "returned": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "truncated": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "returned",
                            "available",
                            "truncated"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "data",
                        "references",
                        "referenceCoverage"
                      ],
                      "additionalProperties": false
                    }
                  ],
                  "description": "Entry rows. With dsl.select the rows are flat {_id, ...selectedFields} objects instead."
                },
                "example": [
                  {
                    "id": "ent_lead99",
                    "objectId": "obj_lead01",
                    "fields": {
                      "Name": "Ada Lovelace",
                      "Status": "Qualified",
                      "Score": 85
                    },
                    "createdAt": 1765526400000,
                    "updatedAt": 1765612800000,
                    "updatedBy": "user:us_xyz789",
                    "sortOrder": 0
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/query/page": {
      "post": {
        "operationId": "crm_queryPage",
        "tags": [
          "crm"
        ],
        "summary": "Scan CRM entries with a resumable cursor. Empty filtered pages can have more results",
        "description": "Scan CRM entries with a resumable cursor. Empty filtered pages can have more results.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objectName": {
                    "type": "string"
                  },
                  "dsl": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "dslJson": {
                    "type": "string"
                  },
                  "assignedTo": {
                    "description": "Personal scope: \"me\" (the signed-in member / the human behind an agent session), \"unassigned\", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view.",
                    "type": "string"
                  },
                  "assigneeField": {
                    "description": "Which `user` field \"assigned\" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field.",
                    "type": "string"
                  },
                  "withReferences": {
                    "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields.",
                    "type": "boolean"
                  },
                  "paginationOpts": {
                    "type": "object",
                    "properties": {
                      "numItems": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100
                      },
                      "cursor": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "numItems",
                      "cursor"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "objectName",
                  "paginationOpts"
                ]
              },
              "example": {
                "objectName": "string",
                "paginationOpts": {}
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/sql": {
      "post": {
        "operationId": "crm_sql",
        "tags": [
          "crm"
        ],
        "summary": "SQL query",
        "description": "Run CRM SQL-compatible query.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objectName": {
                    "type": "string"
                  },
                  "dsl": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "dslJson": {
                    "type": "string"
                  }
                },
                "required": [
                  "objectName"
                ]
              },
              "example": {
                "objectName": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "objectId": {
                        "type": "string"
                      },
                      "fields": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {},
                        "description": "Field-name -> cell value map."
                      },
                      "createdAt": {
                        "type": "number"
                      },
                      "updatedAt": {
                        "type": "number"
                      },
                      "updatedBy": {
                        "type": "string"
                      },
                      "sortOrder": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "id",
                      "objectId",
                      "fields",
                      "createdAt",
                      "updatedAt",
                      "updatedBy",
                      "sortOrder"
                    ],
                    "additionalProperties": false,
                    "description": "A materialized CRM entry (row)."
                  },
                  "description": "Entry rows. With dsl.select the rows are flat {_id, ...selectedFields} objects instead."
                },
                "example": [
                  {
                    "id": "ent_lead99",
                    "objectId": "obj_lead01",
                    "fields": {
                      "Name": "Ada Lovelace",
                      "Status": "Qualified",
                      "Score": 85
                    },
                    "createdAt": 1765526400000,
                    "updatedAt": 1765612800000,
                    "updatedBy": "user:us_xyz789",
                    "sortOrder": 0
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/aggregate": {
      "post": {
        "operationId": "crm_aggregate",
        "tags": [
          "crm"
        ],
        "summary": "Aggregate",
        "description": "Aggregate CRM entries.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objectName": {
                    "type": "string"
                  },
                  "fieldName": {
                    "type": "string",
                    "description": "Field to bucket by."
                  },
                  "sumField": {
                    "description": "Number field to total per bucket (e.g. Amount grouped by Stage). Exact at any table size.",
                    "type": "string"
                  }
                },
                "required": [
                  "objectName",
                  "fieldName"
                ]
              },
              "example": {
                "objectName": "string",
                "fieldName": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string"
                      },
                      "count": {
                        "type": "number"
                      },
                      "sumNumber": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "key",
                      "count"
                    ],
                    "additionalProperties": false
                  }
                },
                "example": [
                  {
                    "key": "Stage:New",
                    "count": 12,
                    "sum": 48000
                  },
                  {
                    "key": "Stage:Qualified",
                    "count": 8,
                    "sum": 64000
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/search": {
      "get": {
        "operationId": "crm_search",
        "tags": [
          "crm"
        ],
        "summary": "Search entries",
        "description": "Search CRM entries.",
        "parameters": [
          {
            "name": "withReferences",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields.",
              "type": "boolean"
            },
            "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields."
          },
          {
            "name": "text",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Full-text query."
            },
            "description": "Full-text query."
          },
          {
            "name": "objectName",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Omit to search org-wide.",
              "type": "string"
            },
            "description": "Omit to search org-wide."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "_creationTime": {
                            "type": "number"
                          },
                          "objectId": {
                            "type": "string"
                          },
                          "data": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {},
                            "description": "Field-name -> cell value map."
                          },
                          "sortOrder": {
                            "type": "number"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          },
                          "updatedBy": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "_id",
                          "_creationTime",
                          "objectId",
                          "data",
                          "sortOrder",
                          "createdAt",
                          "updatedAt",
                          "updatedBy"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "_creationTime": {
                                "type": "number"
                              },
                              "objectId": {
                                "type": "string"
                              },
                              "data": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {},
                                "description": "Field-name -> cell value map."
                              },
                              "sortOrder": {
                                "type": "number"
                              },
                              "createdAt": {
                                "type": "number"
                              },
                              "updatedAt": {
                                "type": "number"
                              },
                              "updatedBy": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "_id",
                              "_creationTime",
                              "objectId",
                              "data",
                              "sortOrder",
                              "createdAt",
                              "updatedAt",
                              "updatedBy"
                            ],
                            "additionalProperties": {}
                          }
                        },
                        "references": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-entry"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "entryId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "entryId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-object"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "campaign"
                                  },
                                  "sequenceId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sequenceId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "referenceCoverage": {
                          "type": "object",
                          "properties": {
                            "returned": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "truncated": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "returned",
                            "available",
                            "truncated"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "data",
                        "references",
                        "referenceCoverage"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "example": [
                  {
                    "_id": "ent_lead99",
                    "_creationTime": 1765526400000,
                    "objectId": "obj_lead01",
                    "data": {
                      "Name": "Acme Corp",
                      "Status": "Qualified"
                    },
                    "sortOrder": 0,
                    "createdAt": 1765526400000,
                    "updatedAt": 1765612800000,
                    "updatedBy": "user:us_xyz789"
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/search/page": {
      "get": {
        "operationId": "crm_search_page",
        "tags": [
          "crm"
        ],
        "summary": "Search bounded pages of readable CRM entries, optionally projecting cells. Always follow continueCursor until isDone",
        "description": "Search bounded pages of readable CRM entries, optionally projecting cells. Always follow continueCursor until isDone.",
        "parameters": [
          {
            "name": "withReferences",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields.",
              "type": "boolean"
            },
            "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields."
          },
          {
            "name": "text",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Full-text query over readable entries."
            },
            "description": "Full-text query over readable entries."
          },
          {
            "name": "objectName",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "select",
            "in": "query",
            "required": false,
            "schema": {
              "minItems": 1,
              "maxItems": 30,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          {
            "name": "selectionMode",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Defaults to strict. Explicit modes require objectName and select. Compact recovers unknown selected names with bounded canonical columns and explicit selectionFallback metadata in the same response. Does not guess aliases.",
              "type": "string",
              "enum": [
                "strict",
                "compact"
              ]
            },
            "description": "Defaults to strict. Explicit modes require objectName and select. Compact recovers unknown selected names with bounded canonical columns and explicit selectionFallback metadata in the same response. Does not guess aliases."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Use the preceding continueCursor, with the same query and projection.",
              "type": "string"
            },
            "description": "Use the preceding continueCursor, with the same query and projection."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    },
                    "page": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "objectId": {
                            "type": "string"
                          },
                          "data": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {},
                            "description": "Field-name -> cell value map."
                          }
                        },
                        "required": [
                          "_id",
                          "objectId",
                          "data"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "isDone": {
                      "type": "boolean"
                    },
                    "continueCursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "returnedCount": {
                      "type": "number"
                    },
                    "selectedFields": {
                      "anyOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "selectionFallback": {
                      "description": "Present only when compact mode recovered unknown selected fields. selectedFields and row keys use actual canonical names; unresolved names are never fabricated as empty cells. Truncated values are previews, not complete cell values.",
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "const": "compact"
                        },
                        "requestedFields": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "unresolvedFields": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "availableFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "name",
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "availableFieldCount": {
                          "type": "number"
                        },
                        "schemaTruncated": {
                          "type": "boolean"
                        },
                        "omittedFieldCount": {
                          "type": "number"
                        },
                        "truncatedValues": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "entryId": {
                                "type": "string"
                              },
                              "fields": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "entryId",
                              "fields"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "mode",
                        "requestedFields",
                        "unresolvedFields",
                        "availableFields",
                        "availableFieldCount",
                        "schemaTruncated",
                        "omittedFieldCount",
                        "truncatedValues"
                      ],
                      "additionalProperties": false
                    },
                    "completeness": {
                      "type": "string",
                      "const": "page"
                    }
                  },
                  "required": [
                    "page",
                    "isDone",
                    "continueCursor",
                    "returnedCount",
                    "selectedFields",
                    "completeness"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/statuses": {
      "get": {
        "operationId": "crm_statuses_list",
        "tags": [
          "crm"
        ],
        "summary": "List statuses",
        "description": "List CRM statuses.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "_creationTime": {
                        "type": "number"
                      },
                      "objectId": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "color": {
                        "type": "string"
                      },
                      "sortOrder": {
                        "type": "number"
                      },
                      "isDefault": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "_id",
                      "_creationTime",
                      "objectId",
                      "name",
                      "color",
                      "sortOrder",
                      "isDefault"
                    ],
                    "additionalProperties": {}
                  }
                },
                "example": [
                  {
                    "_id": "sts_new01",
                    "_creationTime": 1765526400000,
                    "objectId": "obj_lead01",
                    "name": "New",
                    "color": "#94a3b8",
                    "sortOrder": 100,
                    "isDefault": true
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "crm_statuses_set",
        "tags": [
          "crm"
        ],
        "summary": "Set statuses",
        "description": "Set CRM statuses.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "statuses": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "color": {
                          "type": "string",
                          "description": "Hex color."
                        },
                        "sortOrder": {
                          "type": "number"
                        },
                        "isDefault": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "name",
                        "color"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "statuses"
                ]
              },
              "example": {
                "statuses": [
                  {
                    "name": "New",
                    "color": "#94a3b8"
                  },
                  {
                    "name": "Working",
                    "color": "#3b82f6"
                  },
                  {
                    "name": "Qualified",
                    "color": "#22c55e",
                    "isDefault": true
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/batch": {
      "post": {
        "operationId": "crm_batch",
        "tags": [
          "crm"
        ],
        "summary": "Batch operations",
        "description": "Apply a CRM batch.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "withReferences": {
                    "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields.",
                    "type": "boolean"
                  },
                  "ops": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "entries.create"
                            },
                            "objectName": {
                              "type": "string"
                            },
                            "data": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {},
                              "description": "Field-name -> value map. For `user` fields use one member userId or a userId array; preserve every assignee."
                            }
                          },
                          "required": [
                            "type",
                            "objectName",
                            "data"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "entries.update"
                            },
                            "entryId": {
                              "type": "string"
                            },
                            "data": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {},
                              "description": "Field-name -> value map. For `user` fields use one member userId or a userId array; preserve every assignee."
                            }
                          },
                          "required": [
                            "type",
                            "entryId",
                            "data"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "entries.delete"
                            },
                            "entryId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "entryId"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "description": "A single CRM batch/transaction operation."
                    }
                  },
                  "idempotencyKey": {
                    "type": "string"
                  }
                },
                "required": [
                  "ops"
                ]
              },
              "example": {
                "ops": [
                  {
                    "type": "entries.create",
                    "objectName": "people",
                    "data": {
                      "Name": "Jane"
                    }
                  }
                ],
                "idempotencyKey": "import-2026-06-01"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entryId": {
                            "type": "string"
                          },
                          "deleted": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "entryId"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "count": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "results",
                    "count"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "results": [
                    {
                      "entryId": "ent_lead101"
                    },
                    {
                      "entryId": "ent_lead99",
                      "deleted": true
                    }
                  ],
                  "count": 2
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/transactions": {
      "post": {
        "operationId": "crm_transaction_begin",
        "tags": [
          "crm"
        ],
        "summary": "Begin transaction",
        "description": "Begin a CRM transaction.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "txnId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "txnId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "txnId": "txn_abc01"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/transactions/{txnId}/operations": {
      "post": {
        "operationId": "crm_transaction_add",
        "tags": [
          "crm"
        ],
        "summary": "Add operation",
        "description": "Add an operation to a CRM transaction.",
        "parameters": [
          {
            "name": "txnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "op": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "entries.create"
                          },
                          "objectName": {
                            "type": "string"
                          },
                          "data": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {},
                            "description": "Field-name -> value map. For `user` fields use one member userId or a userId array; preserve every assignee."
                          }
                        },
                        "required": [
                          "type",
                          "objectName",
                          "data"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "entries.update"
                          },
                          "entryId": {
                            "type": "string"
                          },
                          "data": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {},
                            "description": "Field-name -> value map. For `user` fields use one member userId or a userId array; preserve every assignee."
                          }
                        },
                        "required": [
                          "type",
                          "entryId",
                          "data"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "entries.delete"
                          },
                          "entryId": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "entryId"
                        ],
                        "additionalProperties": false
                      }
                    ],
                    "description": "A single CRM batch/transaction operation."
                  }
                },
                "required": [
                  "op"
                ]
              },
              "example": {
                "op": {
                  "type": "entries.update",
                  "entryId": "ent_lead99",
                  "data": {
                    "Status": "Qualified"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/transactions/{txnId}/commit": {
      "post": {
        "operationId": "crm_transaction_commit",
        "tags": [
          "crm"
        ],
        "summary": "Commit transaction",
        "description": "Commit a CRM transaction.",
        "parameters": [
          {
            "name": "txnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entryId": {
                            "type": "string"
                          },
                          "deleted": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "entryId"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "count": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "results",
                    "count"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "results": [
                    {
                      "entryId": "ent_deal01"
                    }
                  ],
                  "count": 1
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/transactions/{txnId}/abort": {
      "post": {
        "operationId": "crm_transaction_abort",
        "tags": [
          "crm"
        ],
        "summary": "Abort transaction",
        "description": "Abort a CRM transaction.",
        "parameters": [
          {
            "name": "txnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/transactions/{txnId}": {
      "get": {
        "operationId": "crm_transaction_inspect",
        "tags": [
          "crm"
        ],
        "summary": "Inspect transaction",
        "description": "Inspect a CRM transaction.",
        "parameters": [
          {
            "name": "txnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "_creationTime": {
                          "type": "number"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "open",
                            "committed",
                            "aborted"
                          ]
                        },
                        "ops": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "committedAt": {
                          "type": "number"
                        },
                        "createdAt": {
                          "type": "number"
                        },
                        "updatedAt": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "_id",
                        "_creationTime",
                        "status",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "example": {
                  "_id": "txn_abc01",
                  "_creationTime": 1765526400000,
                  "status": "open",
                  "ops": [
                    {
                      "type": "entries.create",
                      "objectName": "lead",
                      "data": {
                        "Name": "Beta Inc"
                      }
                    }
                  ],
                  "createdAt": 1765526400000,
                  "updatedAt": 1765526400000
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/docs": {
      "get": {
        "operationId": "crm_docs_list",
        "tags": [
          "crm"
        ],
        "summary": "List documents",
        "description": "List CRM documents.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "_creationTime": {
                        "type": "number"
                      },
                      "title": {
                        "type": "string"
                      },
                      "icon": {
                        "type": "string"
                      },
                      "coverImage": {
                        "type": "string"
                      },
                      "filePath": {
                        "type": "string"
                      },
                      "parentId": {
                        "type": "string"
                      },
                      "parentObjectId": {
                        "type": "string"
                      },
                      "entryId": {
                        "type": "string"
                      },
                      "sortOrder": {
                        "type": "number"
                      },
                      "isPublished": {
                        "type": "boolean"
                      },
                      "createdAt": {
                        "type": "number"
                      },
                      "updatedAt": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "_id",
                      "_creationTime",
                      "title",
                      "filePath",
                      "sortOrder",
                      "isPublished",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": {}
                  }
                },
                "example": [
                  {
                    "_id": "doc_q2notes",
                    "_creationTime": 1765526400000,
                    "title": "Q2 Pipeline Notes",
                    "filePath": "/docs/q2-pipeline.md",
                    "sortOrder": 1765526400000,
                    "isPublished": false,
                    "createdAt": 1765526400000,
                    "updatedAt": 1765612800000
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "crm_docs_create",
        "tags": [
          "crm"
        ],
        "summary": "Create document",
        "description": "Create a CRM document.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "filePath": {
                    "type": "string"
                  },
                  "icon": {
                    "type": "string"
                  },
                  "coverImage": {
                    "type": "string"
                  },
                  "parentId": {
                    "type": "string"
                  },
                  "parentObjectName": {
                    "type": "string"
                  },
                  "entryId": {
                    "type": "string"
                  }
                },
                "required": [
                  "title",
                  "filePath"
                ]
              },
              "example": {
                "title": "string",
                "filePath": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "doc_q2notes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/docs/link": {
      "post": {
        "operationId": "crm_docs_link",
        "tags": [
          "crm"
        ],
        "summary": "Link document",
        "description": "Link a CRM document.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filePath": {
                    "type": "string"
                  },
                  "objectName": {
                    "type": "string"
                  },
                  "entryId": {
                    "type": "string"
                  }
                },
                "required": [
                  "filePath"
                ]
              },
              "example": {
                "filePath": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/docs/{documentId}": {
      "delete": {
        "operationId": "crm_docs_delete",
        "tags": [
          "crm"
        ],
        "summary": "Delete document",
        "description": "Delete a CRM document page; its workspace file stays and nested pages move up.",
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The id crm docs create returned."
            },
            "description": "The id crm docs create returned."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/actions": {
      "get": {
        "operationId": "crm_actions_list",
        "tags": [
          "crm"
        ],
        "summary": "List actions",
        "description": "List CRM actions.",
        "parameters": [
          {
            "name": "entryId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "_creationTime": {
                        "type": "number"
                      },
                      "actionId": {
                        "type": "string"
                      },
                      "fieldId": {
                        "type": "string"
                      },
                      "entryId": {
                        "type": "string"
                      },
                      "objectId": {
                        "type": "string"
                      },
                      "runId": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "pending",
                          "running",
                          "completed",
                          "failed"
                        ]
                      },
                      "startedAt": {
                        "type": "number"
                      },
                      "completedAt": {
                        "type": "number"
                      },
                      "result": {
                        "type": "string"
                      },
                      "error": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "_id",
                      "_creationTime",
                      "actionId",
                      "fieldId",
                      "entryId",
                      "objectId",
                      "status",
                      "startedAt"
                    ],
                    "additionalProperties": {}
                  }
                },
                "example": [
                  {
                    "_id": "arun_01",
                    "_creationTime": 1765526400000,
                    "actionId": "enrich_company",
                    "fieldId": "fld_action01",
                    "entryId": "ent_lead99",
                    "objectId": "obj_lead01",
                    "status": "completed",
                    "startedAt": 1765526400000,
                    "completedAt": 1765526460000,
                    "result": "Enriched 4 fields"
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "crm_actions_create",
        "tags": [
          "crm"
        ],
        "summary": "Create or upsert an action button on a named action column (fieldName is the column header; a column can hold multiple buttons — reuse fieldName to add more)",
        "description": "Create or upsert an action button on a named action column (fieldName is the column header; a column can hold multiple buttons — reuse fieldName to add more).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objectName": {
                    "type": "string"
                  },
                  "fieldName": {
                    "type": "string"
                  },
                  "actionId": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "variant": {
                    "type": "string"
                  },
                  "icon": {
                    "type": "string"
                  },
                  "confirmMessage": {
                    "type": "string"
                  },
                  "recipe": {
                    "type": "array",
                    "items": {}
                  },
                  "script": {
                    "type": "string"
                  },
                  "scriptPath": {
                    "type": "string"
                  }
                },
                "required": [
                  "objectName",
                  "fieldName"
                ]
              },
              "example": {
                "objectName": "string",
                "fieldName": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "fieldId": {
                      "type": "string"
                    },
                    "actionId": {
                      "type": "string"
                    },
                    "fieldCreated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "fieldId",
                    "actionId",
                    "fieldCreated"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "fieldId": "fld_actions",
                  "actionId": "mark_won",
                  "fieldCreated": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/actions/{actionId}": {
      "patch": {
        "operationId": "crm_actions_update",
        "tags": [
          "crm"
        ],
        "summary": "Update an action button on a CRM field",
        "description": "Update an action button on a CRM field.",
        "parameters": [
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objectName": {
                    "type": "string"
                  },
                  "fieldName": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "variant": {
                    "type": "string"
                  },
                  "icon": {
                    "type": "string"
                  },
                  "confirmMessage": {
                    "type": "string"
                  },
                  "recipe": {
                    "type": "array",
                    "items": {}
                  },
                  "script": {
                    "type": "string"
                  },
                  "scriptPath": {
                    "type": "string"
                  }
                },
                "required": [
                  "objectName",
                  "fieldName"
                ]
              },
              "example": {
                "objectName": "string",
                "fieldName": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "fieldId": {
                      "type": "string"
                    },
                    "actionId": {
                      "type": "string"
                    },
                    "fieldCreated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "fieldId",
                    "actionId",
                    "fieldCreated"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "fieldId": "fld_actions",
                  "actionId": "mark_won",
                  "fieldCreated": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "crm_actions_delete",
        "tags": [
          "crm"
        ],
        "summary": "Delete an action button from a CRM field",
        "description": "Delete an action button from a CRM field.",
        "parameters": [
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objectName": {
                    "type": "string"
                  },
                  "fieldName": {
                    "type": "string"
                  },
                  "fieldId": {
                    "type": "string"
                  },
                  "deleteFieldIfEmpty": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "objectName"
                ]
              },
              "example": {
                "objectName": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "remaining": {
                      "type": "number"
                    },
                    "fieldDeleted": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "remaining",
                    "fieldDeleted"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "remaining": 0,
                  "fieldDeleted": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/actions/{actionId}/runs": {
      "post": {
        "operationId": "crm_actions_run",
        "tags": [
          "crm"
        ],
        "summary": "Run action",
        "description": "Run a CRM action on one or more entries.",
        "parameters": [
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objectName": {
                    "type": "string"
                  },
                  "fieldId": {
                    "type": "string"
                  },
                  "entryIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "prompts": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "objectName",
                  "fieldId",
                  "entryIds"
                ]
              },
              "example": {
                "objectName": "string",
                "fieldId": "string",
                "entryIds": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entryId": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "success",
                              "error"
                            ]
                          },
                          "operations": {
                            "type": "number"
                          },
                          "error": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "entryId",
                          "status"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "results"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "results": [
                    {
                      "entryId": "ent_lead99",
                      "status": "success",
                      "operations": 1
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/members": {
      "get": {
        "operationId": "crm_members_list",
        "tags": [
          "crm"
        ],
        "summary": "List members",
        "description": "List workspace members for CRM user fields.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "members": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "userId": {
                            "type": "string"
                          },
                          "name": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "email": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "image": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "tagline": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "timezone": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "IANA zone, when the member set one."
                          },
                          "presence": {
                            "type": "string",
                            "enum": [
                              "online",
                              "away",
                              "offline"
                            ]
                          },
                          "lastActiveAt": {
                            "anyOf": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "role": {
                            "type": "string"
                          },
                          "joinedAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "userId",
                          "name",
                          "email",
                          "image",
                          "tagline",
                          "timezone",
                          "presence",
                          "lastActiveAt",
                          "role",
                          "joinedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "organizationId": {
                      "type": "string"
                    },
                    "organizationSlug": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organizationName": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "members",
                    "organizationId",
                    "organizationSlug",
                    "organizationName"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "members": [
                    {
                      "userId": "us_xyz789",
                      "name": "Jane Doe",
                      "email": "jane@acme.com",
                      "image": null,
                      "tagline": "Head of Ops",
                      "timezone": "America/New_York",
                      "presence": "online",
                      "lastActiveAt": 1765612790000,
                      "role": "ADMIN",
                      "joinedAt": 1765440000000
                    }
                  ],
                  "organizationId": "org_abc123",
                  "organizationSlug": "acme",
                  "organizationName": "Acme"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/members/presence": {
      "get": {
        "operationId": "members_presence",
        "tags": [
          "members"
        ],
        "summary": "Live presence (online / away / offline) for workspace members",
        "description": "Live presence (online / away / offline) for workspace members.",
        "parameters": [
          {
            "name": "userIds",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Comma-separated user ids; omit for every member.",
              "type": "string"
            },
            "description": "Comma-separated user ids; omit for every member."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "userId": {
                        "type": "string"
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "online",
                          "away",
                          "offline"
                        ]
                      },
                      "lastActiveAt": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "userId",
                      "state",
                      "lastActiveAt"
                    ],
                    "additionalProperties": false
                  }
                },
                "example": [
                  {
                    "userId": "us_xyz789",
                    "state": "online",
                    "lastActiveAt": 1765612790000
                  },
                  {
                    "userId": "us_abc123",
                    "state": "offline",
                    "lastActiveAt": null
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/members/{userId}": {
      "get": {
        "operationId": "members_get",
        "tags": [
          "members"
        ],
        "summary": "A member's profile: name, email, tagline, role, timezone, presence, open task count",
        "description": "A member's profile: name, email, tagline, role, timezone, presence, open task count.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string"
                        },
                        "name": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "email": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "image": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "tagline": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "ADMIN",
                            "MEMBER"
                          ]
                        },
                        "joinedAt": {
                          "type": "number"
                        },
                        "timezone": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "source": {
                                  "type": "string",
                                  "enum": [
                                    "auto",
                                    "manual",
                                    "agent"
                                  ]
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "value",
                                "source",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "presence": {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "online",
                                "away",
                                "offline"
                              ]
                            },
                            "lastActiveAt": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "state",
                            "lastActiveAt"
                          ],
                          "additionalProperties": false
                        },
                        "openTaskCount": {
                          "type": "number",
                          "description": "Capped at 500."
                        },
                        "openTaskCountCapped": {
                          "description": "True when openTaskCount stopped at its cap.",
                          "type": "boolean"
                        },
                        "commentCount": {
                          "type": "number",
                          "description": "Capped at 200."
                        },
                        "changeCount": {
                          "type": "number",
                          "description": "Capped at 200."
                        },
                        "lastContributionAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "isSelf": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "userId",
                        "name",
                        "email",
                        "image",
                        "tagline",
                        "role",
                        "joinedAt",
                        "timezone",
                        "presence",
                        "openTaskCount",
                        "commentCount",
                        "changeCount",
                        "lastContributionAt",
                        "isSelf"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "example": {
                  "userId": "us_xyz789",
                  "name": "Jane Doe",
                  "email": "jane@acme.com",
                  "image": null,
                  "tagline": "Head of Ops",
                  "role": "ADMIN",
                  "joinedAt": 1765440000000,
                  "timezone": {
                    "value": "America/New_York",
                    "source": "manual",
                    "updatedAt": 1765440000000
                  },
                  "presence": {
                    "state": "online",
                    "lastActiveAt": 1765612790000
                  },
                  "openTaskCount": 4,
                  "commentCount": 31,
                  "changeCount": 118,
                  "lastContributionAt": 1765612800000,
                  "isSelf": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/members/{userId}/activity": {
      "get": {
        "operationId": "members_activity",
        "tags": [
          "members"
        ],
        "summary": "A member's recent comments and record changes across the CRM, newest first",
        "description": "A member's recent comments and record changes across the CRM, newest first.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "kinds",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Comma-separated subset of comments,changes.",
              "type": "string"
            },
            "description": "Comma-separated subset of comments,changes."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "comment"
                          },
                          "id": {
                            "type": "string"
                          },
                          "entryId": {
                            "type": "string"
                          },
                          "objectName": {
                            "type": "string"
                          },
                          "entryLabel": {
                            "type": "string"
                          },
                          "body": {
                            "type": "string"
                          },
                          "parentCommentId": {
                            "type": "string"
                          },
                          "deleted": {
                            "type": "boolean"
                          },
                          "at": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "kind",
                          "id",
                          "entryId",
                          "objectName",
                          "entryLabel",
                          "body",
                          "deleted",
                          "at"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "change"
                          },
                          "id": {
                            "type": "string"
                          },
                          "entryId": {
                            "type": "string"
                          },
                          "objectName": {
                            "type": "string"
                          },
                          "entryLabel": {
                            "type": "string"
                          },
                          "changeKind": {
                            "type": "string",
                            "enum": [
                              "create",
                              "update",
                              "delete"
                            ]
                          },
                          "changes": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fieldName": {
                                  "type": "string"
                                },
                                "before": {},
                                "after": {}
                              },
                              "required": [
                                "fieldName"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "at": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "kind",
                          "id",
                          "entryId",
                          "objectName",
                          "entryLabel",
                          "changeKind",
                          "changes",
                          "at"
                        ],
                        "additionalProperties": {}
                      }
                    ]
                  }
                },
                "example": [
                  {
                    "kind": "comment",
                    "id": "cmt_01",
                    "entryId": "ent_lead99",
                    "objectName": "company",
                    "entryLabel": "Ramp",
                    "body": "Kickoff went well.",
                    "deleted": false,
                    "at": 1765612800000
                  },
                  {
                    "kind": "change",
                    "id": "hist_01",
                    "entryId": "ent_lead99",
                    "objectName": "company",
                    "entryLabel": "Ramp",
                    "changeKind": "update",
                    "changes": [
                      {
                        "fieldName": "Status",
                        "before": "New",
                        "after": "Qualified"
                      }
                    ],
                    "at": 1765612700000
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/members/{userId}/tasks": {
      "get": {
        "operationId": "members_tasks",
        "tags": [
          "members"
        ],
        "summary": "Open tasks assigned to a member (plus ones completed today)",
        "description": "Open tasks assigned to a member (plus ones completed today).",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "name": "todayStartMs",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string",
                        "description": "Same as name: the task's title field."
                      },
                      "status": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "dueDate": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "dueDateKey": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "done": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "title",
                      "status",
                      "dueDate",
                      "dueDateKey",
                      "done"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/me/profile": {
      "get": {
        "operationId": "me_profile_get",
        "tags": [
          "members"
        ],
        "summary": "Your own member profile",
        "description": "Your own member profile.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string"
                        },
                        "name": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "email": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "image": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "tagline": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "ADMIN",
                            "MEMBER"
                          ]
                        },
                        "joinedAt": {
                          "type": "number"
                        },
                        "timezone": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "source": {
                                  "type": "string",
                                  "enum": [
                                    "auto",
                                    "manual",
                                    "agent"
                                  ]
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "value",
                                "source",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "presence": {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "online",
                                "away",
                                "offline"
                              ]
                            },
                            "lastActiveAt": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "state",
                            "lastActiveAt"
                          ],
                          "additionalProperties": false
                        },
                        "openTaskCount": {
                          "type": "number",
                          "description": "Capped at 500."
                        },
                        "openTaskCountCapped": {
                          "description": "True when openTaskCount stopped at its cap.",
                          "type": "boolean"
                        },
                        "commentCount": {
                          "type": "number",
                          "description": "Capped at 200."
                        },
                        "changeCount": {
                          "type": "number",
                          "description": "Capped at 200."
                        },
                        "lastContributionAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "isSelf": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "userId",
                        "name",
                        "email",
                        "image",
                        "tagline",
                        "role",
                        "joinedAt",
                        "timezone",
                        "presence",
                        "openTaskCount",
                        "commentCount",
                        "changeCount",
                        "lastContributionAt",
                        "isSelf"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "me_profile_update",
        "tags": [
          "members"
        ],
        "summary": "Update your name, tagline, avatar URL, or timezone",
        "description": "Update your name, tagline, avatar URL, or timezone.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "tagline": {
                    "description": "Empty string clears.",
                    "type": "string",
                    "maxLength": 160
                  },
                  "imageUrl": {
                    "description": "http(s) image URL; empty string clears the avatar.",
                    "type": "string"
                  },
                  "timezone": {
                    "description": "IANA zone; null returns to browser detection.",
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "tagline": "Head of Ops",
                "timezone": "America/New_York"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "userId": {
                      "type": "string"
                    },
                    "name": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "email": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "image": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "tagline": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "ADMIN",
                        "MEMBER"
                      ]
                    },
                    "joinedAt": {
                      "type": "number"
                    },
                    "timezone": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "manual",
                                "agent"
                              ]
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "value",
                            "source",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "presence": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "online",
                            "away",
                            "offline"
                          ]
                        },
                        "lastActiveAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "state",
                        "lastActiveAt"
                      ],
                      "additionalProperties": false
                    },
                    "openTaskCount": {
                      "type": "number",
                      "description": "Capped at 500."
                    },
                    "openTaskCountCapped": {
                      "description": "True when openTaskCount stopped at its cap.",
                      "type": "boolean"
                    },
                    "commentCount": {
                      "type": "number",
                      "description": "Capped at 200."
                    },
                    "changeCount": {
                      "type": "number",
                      "description": "Capped at 200."
                    },
                    "lastContributionAt": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "isSelf": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "userId",
                    "name",
                    "email",
                    "image",
                    "tagline",
                    "role",
                    "joinedAt",
                    "timezone",
                    "presence",
                    "openTaskCount",
                    "commentCount",
                    "changeCount",
                    "lastContributionAt",
                    "isSelf"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/me/avatar/upload-url": {
      "post": {
        "operationId": "me_avatar_uploadUrl",
        "tags": [
          "members"
        ],
        "summary": "Get a one-time URL to POST an avatar image to; then PUT /me/avatar with the returned storageId",
        "description": "Get a one-time URL to POST an avatar image to; then PUT /me/avatar with the returned storageId.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string",
                  "description": "One-time upload URL."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/me/avatar": {
      "put": {
        "operationId": "me_avatar_set",
        "tags": [
          "members"
        ],
        "summary": "Set your avatar from an uploaded storageId",
        "description": "Set your avatar from an uploaded storageId.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "storageId": {
                    "type": "string",
                    "description": "storageId returned by the upload POST."
                  }
                },
                "required": [
                  "storageId"
                ]
              },
              "example": {
                "storageId": "kg2abc123def456"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "image": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "image"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "me_avatar_clear",
        "tags": [
          "members"
        ],
        "summary": "Remove your avatar",
        "description": "Remove your avatar.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/reports": {
      "post": {
        "operationId": "crm_reports_generate",
        "tags": [
          "crm"
        ],
        "summary": "Generate report",
        "description": "Generate a CRM report.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objectName": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "pie",
                      "bar",
                      "line",
                      "table"
                    ],
                    "description": "Chart type for the generated report."
                  },
                  "groupByField": {
                    "type": "string"
                  },
                  "metric": {
                    "type": "string",
                    "enum": [
                      "count",
                      "sum",
                      "avg",
                      "min",
                      "max"
                    ],
                    "description": "Aggregation metric. Defaults to `count`."
                  },
                  "metricField": {
                    "description": "Number field to sum/avg per bucket (e.g. Amount grouped by Stage). Defaults to the group field itself.",
                    "type": "string"
                  }
                },
                "required": [
                  "objectName",
                  "type",
                  "groupByField"
                ]
              },
              "example": {
                "objectName": "string",
                "type": "pie",
                "groupByField": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "spec": {
                      "type": "object",
                      "properties": {
                        "objectName": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "pie",
                            "bar",
                            "line",
                            "table"
                          ],
                          "description": "Chart type for the generated report."
                        },
                        "groupByField": {
                          "type": "string"
                        },
                        "metric": {
                          "type": "string",
                          "enum": [
                            "count",
                            "sum",
                            "avg",
                            "min",
                            "max"
                          ],
                          "description": "Aggregation metric. Defaults to `count`."
                        },
                        "metricField": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "objectName",
                        "type",
                        "groupByField",
                        "metric"
                      ],
                      "additionalProperties": false
                    },
                    "buckets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "count": {
                            "type": "number"
                          },
                          "sum": {
                            "type": "number"
                          },
                          "avg": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "key",
                          "label",
                          "count"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "totalCount": {
                      "type": "number"
                    },
                    "truncated": {
                      "description": "True when a bounded row scan (not the exact pre-aggregates) produced the sums.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "spec",
                    "buckets",
                    "totalCount"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "spec": {
                    "objectName": "lead",
                    "type": "bar",
                    "groupByField": "Status",
                    "metric": "count"
                  },
                  "buckets": [
                    {
                      "key": "New",
                      "label": "New",
                      "count": 12,
                      "sum": 0,
                      "avg": 0
                    },
                    {
                      "key": "Qualified",
                      "label": "Qualified",
                      "count": 8,
                      "sum": 640,
                      "avg": 80
                    }
                  ],
                  "totalCount": 20
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/analytics": {
      "get": {
        "operationId": "crm_analytics_get",
        "tags": [
          "crm"
        ],
        "summary": "Read an object's analytics dashboard: panels, field roles, the strip's collapsed flag, the named view's own dashboard (if any), and the fields panels may bucket on (synthetic $createdAt / $location last)",
        "description": "Read an object's analytics dashboard: panels, field roles, the strip's collapsed flag, the named view's own dashboard (if any), and the fields panels may bucket on (synthetic $createdAt / $location last).",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewName",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Also return this saved view's own dashboard (viewAnalytics) when it has one.",
              "type": "string"
            },
            "description": "Also return this saved view's own dashboard (viewAnalytics) when it has one."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "objectName": {
                      "type": "string"
                    },
                    "analytics": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "panels": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "description": "Stable id (template panels use `tpl:<template>:<slug>`)."
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "stat",
                                      "bar",
                                      "line",
                                      "area",
                                      "donut",
                                      "funnel",
                                      "leaderboard",
                                      "forecast",
                                      "map"
                                    ]
                                  },
                                  "metric": {
                                    "type": "string",
                                    "enum": [
                                      "count",
                                      "sum",
                                      "avg",
                                      "min",
                                      "max"
                                    ]
                                  },
                                  "metricField": {
                                    "description": "Numeric field for sum/avg/min/max. Ignored for count.",
                                    "type": "string"
                                  },
                                  "groupBy": {
                                    "description": "Bucketing field (enum/user/relation/boolean/text, or $location). On a time-series panel it splits the series into one line per value.",
                                    "type": "string"
                                  },
                                  "dateField": {
                                    "description": "Date field for line/area/forecast bucketing (or $createdAt).",
                                    "type": "string"
                                  },
                                  "dateBucket": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month",
                                      "quarter"
                                    ]
                                  },
                                  "filters": {
                                    "description": "Panel-scoped FilterGroup, same shape as saved-view filters.",
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {}
                                  },
                                  "size": {
                                    "description": "Deprecated; ignored for layout. Use `span`.",
                                    "type": "string",
                                    "enum": [
                                      "sm",
                                      "md",
                                      "lg"
                                    ]
                                  },
                                  "span": {
                                    "description": "Card width on the 6-track dashboard grid: 2 = a third, 3 = half, 4 = two thirds, 6 = full row. Defaults: funnel 4; map and leaderboard 2; bar/donut grouped by a user field 2, by anything else 4; trends 3.",
                                    "anyOf": [
                                      {
                                        "type": "number",
                                        "const": 2
                                      },
                                      {
                                        "type": "number",
                                        "const": 3
                                      },
                                      {
                                        "type": "number",
                                        "const": 4
                                      },
                                      {
                                        "type": "number",
                                        "const": 6
                                      }
                                    ]
                                  },
                                  "hidden": {
                                    "description": "Hide from the strip above the table; still shown in the full analytics view.",
                                    "type": "boolean"
                                  },
                                  "sortOrder": {
                                    "type": "number"
                                  },
                                  "derived": {
                                    "description": "Role-driven derived metric; when set the panel computes from fieldRoles instead of metric/groupBy.",
                                    "type": "string",
                                    "enum": [
                                      "conversion_rate",
                                      "win_rate",
                                      "won_amount",
                                      "lost_amount",
                                      "open_pipeline",
                                      "pipeline_forecast",
                                      "mrr",
                                      "arr"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "title",
                                  "type",
                                  "metric",
                                  "sortOrder"
                                ],
                                "additionalProperties": false,
                                "description": "One analytics panel definition."
                              }
                            },
                            "removedPanelIds": {
                              "description": "Template panel ids the user deleted; never resurrected.",
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "fieldRoles": {
                              "type": "object",
                              "properties": {
                                "amount": {
                                  "description": "Numeric field holding the deal value (\"Amount\") — the \"Value field\" in the setup sheet.",
                                  "type": "string"
                                },
                                "stage": {
                                  "description": "Enum field driving the pipeline (\"Stage\" / \"Status\") — the \"Progress field\".",
                                  "type": "string"
                                },
                                "wonValues": {
                                  "description": "`stage` options that count as won (closed, successful).",
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "lostValues": {
                                  "description": "`stage` options that count as lost (closed, gone).",
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "convertedValues": {
                                  "description": "`stage` options that count as converted (a lead reached \"Qualified\").",
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "closeDate": {
                                  "description": "Date field for time bucketing, forecasts and the period pill (falls back to $createdAt).",
                                  "type": "string"
                                },
                                "owner": {
                                  "description": "User field naming who owns each record (\"Owner\"). Rankings on it default to a narrow card and draw member faces.",
                                  "type": "string"
                                },
                                "location": {
                                  "description": "Place-name field maps plot. May be a relation path like \"Account.HQ Location\" (one hop through a relation).",
                                  "type": "string"
                                },
                                "recurrence": {
                                  "description": "How a won amount recurs: annual treats Amount as ARR, monthly as MRR, one_time disables MRR/ARR panels.",
                                  "type": "string",
                                  "enum": [
                                    "monthly",
                                    "annual",
                                    "one_time"
                                  ]
                                },
                                "stageProbabilities": {
                                  "description": "Chance of closing per OPEN stage, 0..1, for the weighted forecast. Unlisted stages are spaced evenly; won = 1, lost = 0.",
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {
                                    "type": "number"
                                  }
                                }
                              },
                              "additionalProperties": false,
                              "description": "The object's analytics setup, shared by every chart and every view: the semantic field roles derived metrics (win rate, won $, open pipeline, forecast, MRR/ARR), maps and card defaults read."
                            },
                            "stripCollapsed": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "panels"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "viewAnalytics": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "panels": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "description": "Stable id (template panels use `tpl:<template>:<slug>`)."
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "stat",
                                      "bar",
                                      "line",
                                      "area",
                                      "donut",
                                      "funnel",
                                      "leaderboard",
                                      "forecast",
                                      "map"
                                    ]
                                  },
                                  "metric": {
                                    "type": "string",
                                    "enum": [
                                      "count",
                                      "sum",
                                      "avg",
                                      "min",
                                      "max"
                                    ]
                                  },
                                  "metricField": {
                                    "description": "Numeric field for sum/avg/min/max. Ignored for count.",
                                    "type": "string"
                                  },
                                  "groupBy": {
                                    "description": "Bucketing field (enum/user/relation/boolean/text, or $location). On a time-series panel it splits the series into one line per value.",
                                    "type": "string"
                                  },
                                  "dateField": {
                                    "description": "Date field for line/area/forecast bucketing (or $createdAt).",
                                    "type": "string"
                                  },
                                  "dateBucket": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month",
                                      "quarter"
                                    ]
                                  },
                                  "filters": {
                                    "description": "Panel-scoped FilterGroup, same shape as saved-view filters.",
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {}
                                  },
                                  "size": {
                                    "description": "Deprecated; ignored for layout. Use `span`.",
                                    "type": "string",
                                    "enum": [
                                      "sm",
                                      "md",
                                      "lg"
                                    ]
                                  },
                                  "span": {
                                    "description": "Card width on the 6-track dashboard grid: 2 = a third, 3 = half, 4 = two thirds, 6 = full row. Defaults: funnel 4; map and leaderboard 2; bar/donut grouped by a user field 2, by anything else 4; trends 3.",
                                    "anyOf": [
                                      {
                                        "type": "number",
                                        "const": 2
                                      },
                                      {
                                        "type": "number",
                                        "const": 3
                                      },
                                      {
                                        "type": "number",
                                        "const": 4
                                      },
                                      {
                                        "type": "number",
                                        "const": 6
                                      }
                                    ]
                                  },
                                  "hidden": {
                                    "description": "Hide from the strip above the table; still shown in the full analytics view.",
                                    "type": "boolean"
                                  },
                                  "sortOrder": {
                                    "type": "number"
                                  },
                                  "derived": {
                                    "description": "Role-driven derived metric; when set the panel computes from fieldRoles instead of metric/groupBy.",
                                    "type": "string",
                                    "enum": [
                                      "conversion_rate",
                                      "win_rate",
                                      "won_amount",
                                      "lost_amount",
                                      "open_pipeline",
                                      "pipeline_forecast",
                                      "mrr",
                                      "arr"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "title",
                                  "type",
                                  "metric",
                                  "sortOrder"
                                ],
                                "additionalProperties": false,
                                "description": "One analytics panel definition."
                              }
                            },
                            "removedPanelIds": {
                              "description": "Template panel ids the user deleted; never resurrected.",
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "panels"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The named view's own dashboard, or null when it inherits."
                    },
                    "viewExists": {
                      "type": "boolean"
                    },
                    "fields": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "enumValues": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "enumColors": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "name",
                          "type",
                          "enumValues",
                          "enumColors"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "objectName",
                    "analytics",
                    "viewAnalytics",
                    "viewExists",
                    "fields"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "objectName": "lead",
                  "analytics": {
                    "panels": [
                      {
                        "id": "tpl:sales:total-leads",
                        "title": "Total leads",
                        "type": "stat",
                        "metric": "count",
                        "sortOrder": 0
                      },
                      {
                        "id": "tpl:sales:leads-by-source",
                        "title": "Leads by source",
                        "type": "donut",
                        "metric": "count",
                        "groupBy": "Source",
                        "sortOrder": 1
                      }
                    ],
                    "fieldRoles": {
                      "stage": "Status",
                      "convertedValues": [
                        "Qualified"
                      ]
                    },
                    "stripCollapsed": false
                  },
                  "viewAnalytics": null,
                  "viewExists": false,
                  "fields": [
                    {
                      "name": "Status",
                      "type": "enum",
                      "enumValues": [
                        "New",
                        "Qualified"
                      ],
                      "enumColors": null
                    },
                    {
                      "name": "$createdAt",
                      "type": "date",
                      "enumValues": null,
                      "enumColors": null
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/analytics/compute": {
      "post": {
        "operationId": "crm_analytics_compute",
        "tags": [
          "crm"
        ],
        "summary": "Compute chart-ready results (buckets / series / values) for the stored dashboard, a subset of its panels, or ad-hoc panel definitions — optionally scoped to a saved view, a period preset (with the previous interval as previousValue) and extra filters. Same query the strip renders from",
        "description": "Compute chart-ready results (buckets / series / values) for the stored dashboard, a subset of its panels, or ad-hoc panel definitions — optionally scoped to a saved view, a period preset (with the previous interval as previousValue) and extra filters. Same query the strip renders from.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "viewName": {
                    "description": "Compute the saved view's own dashboard instead of the object's (ignored when the view inherits).",
                    "type": "string"
                  },
                  "panelIds": {
                    "description": "Only these stored panels.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "panels": {
                    "description": "Ad-hoc panel definitions to compute instead of the stored dashboard (nothing is persisted). id/title/metric/sortOrder are filled in when omitted.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Stable id (template panels use `tpl:<template>:<slug>`)."
                        },
                        "title": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "stat",
                            "bar",
                            "line",
                            "area",
                            "donut",
                            "funnel",
                            "leaderboard",
                            "forecast",
                            "map"
                          ]
                        },
                        "metric": {
                          "type": "string",
                          "enum": [
                            "count",
                            "sum",
                            "avg",
                            "min",
                            "max"
                          ]
                        },
                        "metricField": {
                          "description": "Numeric field for sum/avg/min/max. Ignored for count.",
                          "type": "string"
                        },
                        "groupBy": {
                          "description": "Bucketing field (enum/user/relation/boolean/text, or $location). On a time-series panel it splits the series into one line per value.",
                          "type": "string"
                        },
                        "dateField": {
                          "description": "Date field for line/area/forecast bucketing (or $createdAt).",
                          "type": "string"
                        },
                        "dateBucket": {
                          "type": "string",
                          "enum": [
                            "day",
                            "week",
                            "month",
                            "quarter"
                          ]
                        },
                        "filters": {
                          "description": "Panel-scoped FilterGroup, same shape as saved-view filters.",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "size": {
                          "description": "Deprecated; ignored for layout. Use `span`.",
                          "type": "string",
                          "enum": [
                            "sm",
                            "md",
                            "lg"
                          ]
                        },
                        "span": {
                          "description": "Card width on the 6-track dashboard grid: 2 = a third, 3 = half, 4 = two thirds, 6 = full row. Defaults: funnel 4; map and leaderboard 2; bar/donut grouped by a user field 2, by anything else 4; trends 3.",
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            },
                            {
                              "type": "number",
                              "const": 4
                            },
                            {
                              "type": "number",
                              "const": 6
                            }
                          ]
                        },
                        "hidden": {
                          "description": "Hide from the strip above the table; still shown in the full analytics view.",
                          "type": "boolean"
                        },
                        "sortOrder": {
                          "type": "number"
                        },
                        "derived": {
                          "description": "Role-driven derived metric; when set the panel computes from fieldRoles instead of metric/groupBy.",
                          "type": "string",
                          "enum": [
                            "conversion_rate",
                            "win_rate",
                            "won_amount",
                            "lost_amount",
                            "open_pipeline",
                            "pipeline_forecast",
                            "mrr",
                            "arr"
                          ]
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": "One ad-hoc panel. `id`, `title`, `metric` (default count) and `sortOrder` (default: position) are optional."
                    }
                  },
                  "period": {
                    "type": "string",
                    "enum": [
                      "all",
                      "this_week",
                      "this_month",
                      "last_month",
                      "this_quarter",
                      "last_quarter",
                      "this_year"
                    ],
                    "description": "Period preset. Scopes every panel by a date_preset on the object's closeDate role (else $createdAt) and fills previousValue from the previous calendar interval. \"all\" = no scope."
                  },
                  "extraFilters": {
                    "description": "FilterGroup applied to every panel (e.g. the view's rules). Forces the bounded scan path.",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "compareFilters": {
                    "description": "FilterGroup for the comparison window; every panel's value over it comes back as previousValue. Derived automatically from `period`.",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "fieldRolesOverride": {
                    "description": "Preview an unsaved role mapping.",
                    "type": "object",
                    "properties": {
                      "amount": {
                        "description": "Numeric field holding the deal value (\"Amount\") — the \"Value field\" in the setup sheet.",
                        "type": "string"
                      },
                      "stage": {
                        "description": "Enum field driving the pipeline (\"Stage\" / \"Status\") — the \"Progress field\".",
                        "type": "string"
                      },
                      "wonValues": {
                        "description": "`stage` options that count as won (closed, successful).",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "lostValues": {
                        "description": "`stage` options that count as lost (closed, gone).",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "convertedValues": {
                        "description": "`stage` options that count as converted (a lead reached \"Qualified\").",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "closeDate": {
                        "description": "Date field for time bucketing, forecasts and the period pill (falls back to $createdAt).",
                        "type": "string"
                      },
                      "owner": {
                        "description": "User field naming who owns each record (\"Owner\"). Rankings on it default to a narrow card and draw member faces.",
                        "type": "string"
                      },
                      "location": {
                        "description": "Place-name field maps plot. May be a relation path like \"Account.HQ Location\" (one hop through a relation).",
                        "type": "string"
                      },
                      "recurrence": {
                        "description": "How a won amount recurs: annual treats Amount as ARR, monthly as MRR, one_time disables MRR/ARR panels.",
                        "type": "string",
                        "enum": [
                          "monthly",
                          "annual",
                          "one_time"
                        ]
                      },
                      "stageProbabilities": {
                        "description": "Chance of closing per OPEN stage, 0..1, for the weighted forecast. Unlisted stages are spaced evenly; won = 1, lost = 0.",
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "number"
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "assignedTo": {
                    "description": "Personal scope: \"me\" (the signed-in member / the human behind an agent session), \"unassigned\", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view.",
                    "type": "string"
                  },
                  "assigneeField": {
                    "description": "Which `user` field \"assigned\" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field.",
                    "type": "string"
                  },
                  "drillFilters": {
                    "description": "Click-to-filter chips, same as the strip: each scopes every panel EXCEPT those whose dimensions include `dimension`.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "dimension": {
                          "type": "string",
                          "description": "The bare field the click came from — a panel's groupBy or dateField, or `$location` for a map. Panels drawn along it keep their full picture; every other panel is scoped."
                        },
                        "filter": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {},
                          "description": "FilterGroup selecting the clicked bucket."
                        }
                      },
                      "required": [
                        "dimension",
                        "filter"
                      ],
                      "additionalProperties": false
                    }
                  }
                }
              },
              "example": {
                "period": "this_month",
                "panels": [
                  {
                    "id": "adhoc:leads-by-source",
                    "title": "New leads by source",
                    "type": "donut",
                    "metric": "count",
                    "groupBy": "Source",
                    "sortOrder": 0
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "objectName": {
                      "type": "string"
                    },
                    "truncated": {
                      "type": "boolean",
                      "description": "True when the table exceeded the 5,000-row scan and numbers are approximate."
                    },
                    "scannedRows": {
                      "type": "number"
                    },
                    "locationRole": {
                      "type": "string"
                    },
                    "panels": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "unit": {
                            "type": "string",
                            "enum": [
                              "number",
                              "currency",
                              "percent"
                            ]
                          },
                          "value": {
                            "type": "number"
                          },
                          "secondaryValue": {
                            "type": "number"
                          },
                          "previousValue": {
                            "description": "The same value over the comparison window (period / compareFilters).",
                            "type": "number"
                          },
                          "buckets": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "count": {
                                  "type": "number"
                                },
                                "value": {
                                  "type": "number"
                                },
                                "color": {
                                  "type": "string"
                                },
                                "amount": {
                                  "description": "Funnel only: sum of the amount role over the rows in this stage.",
                                  "type": "number"
                                }
                              },
                              "required": [
                                "key",
                                "label",
                                "count",
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "series": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "bucket": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "number"
                                },
                                "count": {
                                  "type": "number"
                                },
                                "projected": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "bucket",
                                "label",
                                "value",
                                "count"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "seriesGroups": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "color": {
                                  "type": "string"
                                },
                                "series": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "bucket": {
                                        "type": "string"
                                      },
                                      "label": {
                                        "type": "string"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "count": {
                                        "type": "number"
                                      },
                                      "projected": {
                                        "type": "boolean"
                                      }
                                    },
                                    "required": [
                                      "bucket",
                                      "label",
                                      "value",
                                      "count"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "key",
                                "label",
                                "series"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "error": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "unit"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "objectName",
                    "truncated",
                    "scannedRows",
                    "panels"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "objectName": "lead",
                  "truncated": false,
                  "scannedRows": 42,
                  "panels": [
                    {
                      "id": "adhoc:leads-by-source",
                      "unit": "number",
                      "value": 42,
                      "previousValue": 31,
                      "buckets": [
                        {
                          "key": "Website",
                          "label": "Website",
                          "count": 25,
                          "value": 25
                        },
                        {
                          "key": "Referral",
                          "label": "Referral",
                          "count": 17,
                          "value": 17
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/analytics/panels/{panelId}": {
      "put": {
        "operationId": "crm_analytics_save",
        "tags": [
          "crm"
        ],
        "summary": "Create or update one panel (upsert by id). With viewName the write lands on that saved view's own dashboard, forking a copy if it was still inheriting the object's",
        "description": "Create or update one panel (upsert by id). With viewName the write lands on that saved view's own dashboard, forking a copy if it was still inheriting the object's.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "panelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Panel id (path); becomes panel.id."
            },
            "description": "Panel id (path); becomes panel.id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "panel": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "stat",
                          "bar",
                          "line",
                          "area",
                          "donut",
                          "funnel",
                          "leaderboard",
                          "forecast",
                          "map"
                        ]
                      },
                      "metric": {
                        "type": "string",
                        "enum": [
                          "count",
                          "sum",
                          "avg",
                          "min",
                          "max"
                        ]
                      },
                      "metricField": {
                        "description": "Numeric field for sum/avg/min/max. Ignored for count.",
                        "type": "string"
                      },
                      "groupBy": {
                        "description": "Bucketing field (enum/user/relation/boolean/text, or $location). On a time-series panel it splits the series into one line per value.",
                        "type": "string"
                      },
                      "dateField": {
                        "description": "Date field for line/area/forecast bucketing (or $createdAt).",
                        "type": "string"
                      },
                      "dateBucket": {
                        "type": "string",
                        "enum": [
                          "day",
                          "week",
                          "month",
                          "quarter"
                        ]
                      },
                      "filters": {
                        "description": "Panel-scoped FilterGroup, same shape as saved-view filters.",
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "size": {
                        "description": "Deprecated; ignored for layout. Use `span`.",
                        "type": "string",
                        "enum": [
                          "sm",
                          "md",
                          "lg"
                        ]
                      },
                      "span": {
                        "description": "Card width on the 6-track dashboard grid: 2 = a third, 3 = half, 4 = two thirds, 6 = full row. Defaults: funnel 4; map and leaderboard 2; bar/donut grouped by a user field 2, by anything else 4; trends 3.",
                        "anyOf": [
                          {
                            "type": "number",
                            "const": 2
                          },
                          {
                            "type": "number",
                            "const": 3
                          },
                          {
                            "type": "number",
                            "const": 4
                          },
                          {
                            "type": "number",
                            "const": 6
                          }
                        ]
                      },
                      "hidden": {
                        "description": "Hide from the strip above the table; still shown in the full analytics view.",
                        "type": "boolean"
                      },
                      "sortOrder": {
                        "type": "number"
                      },
                      "derived": {
                        "description": "Role-driven derived metric; when set the panel computes from fieldRoles instead of metric/groupBy.",
                        "type": "string",
                        "enum": [
                          "conversion_rate",
                          "win_rate",
                          "won_amount",
                          "lost_amount",
                          "open_pipeline",
                          "pipeline_forecast",
                          "mrr",
                          "arr"
                        ]
                      },
                      "id": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "title",
                      "type",
                      "metric",
                      "sortOrder"
                    ],
                    "additionalProperties": false,
                    "description": "The panel definition to upsert."
                  },
                  "viewName": {
                    "description": "Write the saved view's own dashboard (forks a copy if it was inheriting).",
                    "type": "string"
                  }
                },
                "required": [
                  "panel"
                ]
              },
              "example": {
                "panel": {
                  "title": "Open pipeline",
                  "type": "stat",
                  "metric": "sum",
                  "derived": "open_pipeline",
                  "sortOrder": 10
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "panelId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "panelId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "panelId": "adhoc:open-pipeline"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "crm_analytics_update",
        "tags": [
          "crm"
        ],
        "summary": "Edit part of one stored panel: only the keys in `patch` change (title, type, metric, metricField, groupBy, dateField, dateBucket, filters, derived, span, hidden, sortOrder); null clears an optional key. What the card's ⋮ menu writes",
        "description": "Edit part of one stored panel: only the keys in `patch` change (title, type, metric, metricField, groupBy, dateField, dateBucket, filters, derived, span, hidden, sortOrder); null clears an optional key. What the card's ⋮ menu writes.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "panelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Stored panel id (path)."
            },
            "description": "Stored panel id (path)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "patch": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "stat",
                          "bar",
                          "line",
                          "area",
                          "donut",
                          "funnel",
                          "leaderboard",
                          "forecast",
                          "map"
                        ]
                      },
                      "metric": {
                        "type": "string",
                        "enum": [
                          "count",
                          "sum",
                          "avg",
                          "min",
                          "max"
                        ]
                      },
                      "metricField": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "groupBy": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "dateField": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "dateBucket": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "day",
                              "week",
                              "month",
                              "quarter"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "filters": {
                        "anyOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "span": {
                        "description": "Width in tracks; null restores the chart kind's default.",
                        "anyOf": [
                          {
                            "anyOf": [
                              {
                                "type": "number",
                                "const": 2
                              },
                              {
                                "type": "number",
                                "const": 3
                              },
                              {
                                "type": "number",
                                "const": 4
                              },
                              {
                                "type": "number",
                                "const": 6
                              }
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "hidden": {
                        "description": "Hide from the strip above the table; still shown in the full analytics view.",
                        "type": "boolean"
                      },
                      "sortOrder": {
                        "type": "number"
                      },
                      "derived": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "conversion_rate",
                              "win_rate",
                              "won_amount",
                              "lost_amount",
                              "open_pipeline",
                              "pipeline_forecast",
                              "mrr",
                              "arr"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "additionalProperties": false,
                    "description": "Partial panel edit: only the keys present change; null clears an optional key; hidden: false is stored as absent."
                  },
                  "viewName": {
                    "description": "Edit the saved view's own dashboard (forks a copy if it was inheriting).",
                    "type": "string"
                  }
                },
                "required": [
                  "patch"
                ]
              },
              "example": {
                "patch": {}
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "panel": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Stable id (template panels use `tpl:<template>:<slug>`)."
                        },
                        "title": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "stat",
                            "bar",
                            "line",
                            "area",
                            "donut",
                            "funnel",
                            "leaderboard",
                            "forecast",
                            "map"
                          ]
                        },
                        "metric": {
                          "type": "string",
                          "enum": [
                            "count",
                            "sum",
                            "avg",
                            "min",
                            "max"
                          ]
                        },
                        "metricField": {
                          "description": "Numeric field for sum/avg/min/max. Ignored for count.",
                          "type": "string"
                        },
                        "groupBy": {
                          "description": "Bucketing field (enum/user/relation/boolean/text, or $location). On a time-series panel it splits the series into one line per value.",
                          "type": "string"
                        },
                        "dateField": {
                          "description": "Date field for line/area/forecast bucketing (or $createdAt).",
                          "type": "string"
                        },
                        "dateBucket": {
                          "type": "string",
                          "enum": [
                            "day",
                            "week",
                            "month",
                            "quarter"
                          ]
                        },
                        "filters": {
                          "description": "Panel-scoped FilterGroup, same shape as saved-view filters.",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "size": {
                          "description": "Deprecated; ignored for layout. Use `span`.",
                          "type": "string",
                          "enum": [
                            "sm",
                            "md",
                            "lg"
                          ]
                        },
                        "span": {
                          "description": "Card width on the 6-track dashboard grid: 2 = a third, 3 = half, 4 = two thirds, 6 = full row. Defaults: funnel 4; map and leaderboard 2; bar/donut grouped by a user field 2, by anything else 4; trends 3.",
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            },
                            {
                              "type": "number",
                              "const": 4
                            },
                            {
                              "type": "number",
                              "const": 6
                            }
                          ]
                        },
                        "hidden": {
                          "description": "Hide from the strip above the table; still shown in the full analytics view.",
                          "type": "boolean"
                        },
                        "sortOrder": {
                          "type": "number"
                        },
                        "derived": {
                          "description": "Role-driven derived metric; when set the panel computes from fieldRoles instead of metric/groupBy.",
                          "type": "string",
                          "enum": [
                            "conversion_rate",
                            "win_rate",
                            "won_amount",
                            "lost_amount",
                            "open_pipeline",
                            "pipeline_forecast",
                            "mrr",
                            "arr"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "title",
                        "type",
                        "metric",
                        "sortOrder"
                      ],
                      "additionalProperties": false,
                      "description": "One analytics panel definition."
                    }
                  },
                  "required": [
                    "ok",
                    "panel"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "crm_analytics_delete",
        "tags": [
          "crm"
        ],
        "summary": "Delete one panel (idempotent). Template panels are tombstoned so a re-install never resurrects them",
        "description": "Delete one panel (idempotent). Template panels are tombstoned so a re-install never resurrects them.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "panelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "viewName": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "removed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "removed"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "removed": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/analytics/panels/{panelId}/hide": {
      "post": {
        "operationId": "crm_analytics_hide",
        "tags": [
          "crm"
        ],
        "summary": "Take a chart off the strip above the table (hidden: true). It stays in the full analytics view, counted by the strip's “+N more”",
        "description": "Take a chart off the strip above the table (hidden: true). It stays in the full analytics view, counted by the strip's “+N more”.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "panelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "viewName": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "panel": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Stable id (template panels use `tpl:<template>:<slug>`)."
                        },
                        "title": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "stat",
                            "bar",
                            "line",
                            "area",
                            "donut",
                            "funnel",
                            "leaderboard",
                            "forecast",
                            "map"
                          ]
                        },
                        "metric": {
                          "type": "string",
                          "enum": [
                            "count",
                            "sum",
                            "avg",
                            "min",
                            "max"
                          ]
                        },
                        "metricField": {
                          "description": "Numeric field for sum/avg/min/max. Ignored for count.",
                          "type": "string"
                        },
                        "groupBy": {
                          "description": "Bucketing field (enum/user/relation/boolean/text, or $location). On a time-series panel it splits the series into one line per value.",
                          "type": "string"
                        },
                        "dateField": {
                          "description": "Date field for line/area/forecast bucketing (or $createdAt).",
                          "type": "string"
                        },
                        "dateBucket": {
                          "type": "string",
                          "enum": [
                            "day",
                            "week",
                            "month",
                            "quarter"
                          ]
                        },
                        "filters": {
                          "description": "Panel-scoped FilterGroup, same shape as saved-view filters.",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "size": {
                          "description": "Deprecated; ignored for layout. Use `span`.",
                          "type": "string",
                          "enum": [
                            "sm",
                            "md",
                            "lg"
                          ]
                        },
                        "span": {
                          "description": "Card width on the 6-track dashboard grid: 2 = a third, 3 = half, 4 = two thirds, 6 = full row. Defaults: funnel 4; map and leaderboard 2; bar/donut grouped by a user field 2, by anything else 4; trends 3.",
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            },
                            {
                              "type": "number",
                              "const": 4
                            },
                            {
                              "type": "number",
                              "const": 6
                            }
                          ]
                        },
                        "hidden": {
                          "description": "Hide from the strip above the table; still shown in the full analytics view.",
                          "type": "boolean"
                        },
                        "sortOrder": {
                          "type": "number"
                        },
                        "derived": {
                          "description": "Role-driven derived metric; when set the panel computes from fieldRoles instead of metric/groupBy.",
                          "type": "string",
                          "enum": [
                            "conversion_rate",
                            "win_rate",
                            "won_amount",
                            "lost_amount",
                            "open_pipeline",
                            "pipeline_forecast",
                            "mrr",
                            "arr"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "title",
                        "type",
                        "metric",
                        "sortOrder"
                      ],
                      "additionalProperties": false,
                      "description": "One analytics panel definition."
                    }
                  },
                  "required": [
                    "ok",
                    "panel"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/analytics/panels/{panelId}/show": {
      "post": {
        "operationId": "crm_analytics_show",
        "tags": [
          "crm"
        ],
        "summary": "Bring a hidden chart back onto the strip (hidden: false)",
        "description": "Bring a hidden chart back onto the strip (hidden: false).",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "panelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "viewName": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "panel": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Stable id (template panels use `tpl:<template>:<slug>`)."
                        },
                        "title": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "stat",
                            "bar",
                            "line",
                            "area",
                            "donut",
                            "funnel",
                            "leaderboard",
                            "forecast",
                            "map"
                          ]
                        },
                        "metric": {
                          "type": "string",
                          "enum": [
                            "count",
                            "sum",
                            "avg",
                            "min",
                            "max"
                          ]
                        },
                        "metricField": {
                          "description": "Numeric field for sum/avg/min/max. Ignored for count.",
                          "type": "string"
                        },
                        "groupBy": {
                          "description": "Bucketing field (enum/user/relation/boolean/text, or $location). On a time-series panel it splits the series into one line per value.",
                          "type": "string"
                        },
                        "dateField": {
                          "description": "Date field for line/area/forecast bucketing (or $createdAt).",
                          "type": "string"
                        },
                        "dateBucket": {
                          "type": "string",
                          "enum": [
                            "day",
                            "week",
                            "month",
                            "quarter"
                          ]
                        },
                        "filters": {
                          "description": "Panel-scoped FilterGroup, same shape as saved-view filters.",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "size": {
                          "description": "Deprecated; ignored for layout. Use `span`.",
                          "type": "string",
                          "enum": [
                            "sm",
                            "md",
                            "lg"
                          ]
                        },
                        "span": {
                          "description": "Card width on the 6-track dashboard grid: 2 = a third, 3 = half, 4 = two thirds, 6 = full row. Defaults: funnel 4; map and leaderboard 2; bar/donut grouped by a user field 2, by anything else 4; trends 3.",
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            },
                            {
                              "type": "number",
                              "const": 4
                            },
                            {
                              "type": "number",
                              "const": 6
                            }
                          ]
                        },
                        "hidden": {
                          "description": "Hide from the strip above the table; still shown in the full analytics view.",
                          "type": "boolean"
                        },
                        "sortOrder": {
                          "type": "number"
                        },
                        "derived": {
                          "description": "Role-driven derived metric; when set the panel computes from fieldRoles instead of metric/groupBy.",
                          "type": "string",
                          "enum": [
                            "conversion_rate",
                            "win_rate",
                            "won_amount",
                            "lost_amount",
                            "open_pipeline",
                            "pipeline_forecast",
                            "mrr",
                            "arr"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "title",
                        "type",
                        "metric",
                        "sortOrder"
                      ],
                      "additionalProperties": false,
                      "description": "One analytics panel definition."
                    }
                  },
                  "required": [
                    "ok",
                    "panel"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/analytics/panels/{panelId}/resize": {
      "post": {
        "operationId": "crm_analytics_resize",
        "tags": [
          "crm"
        ],
        "summary": "Set a card's width on the 6-track dashboard grid: span 2 (third), 3 (half), 4 (two thirds), 6 (full), or null for the chart kind's default",
        "description": "Set a card's width on the 6-track dashboard grid: span 2 (third), 3 (half), 4 (two thirds), 6 (full), or null for the chart kind's default.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "panelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "span": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number",
                            "const": 2
                          },
                          {
                            "type": "number",
                            "const": 3
                          },
                          {
                            "type": "number",
                            "const": 4
                          },
                          {
                            "type": "number",
                            "const": 6
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "2 = third, 3 = half, 4 = two thirds, 6 = full row; null = the chart kind's default."
                  },
                  "viewName": {
                    "type": "string"
                  }
                },
                "required": [
                  "span"
                ]
              },
              "example": {
                "span": 0
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "panel": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Stable id (template panels use `tpl:<template>:<slug>`)."
                        },
                        "title": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "stat",
                            "bar",
                            "line",
                            "area",
                            "donut",
                            "funnel",
                            "leaderboard",
                            "forecast",
                            "map"
                          ]
                        },
                        "metric": {
                          "type": "string",
                          "enum": [
                            "count",
                            "sum",
                            "avg",
                            "min",
                            "max"
                          ]
                        },
                        "metricField": {
                          "description": "Numeric field for sum/avg/min/max. Ignored for count.",
                          "type": "string"
                        },
                        "groupBy": {
                          "description": "Bucketing field (enum/user/relation/boolean/text, or $location). On a time-series panel it splits the series into one line per value.",
                          "type": "string"
                        },
                        "dateField": {
                          "description": "Date field for line/area/forecast bucketing (or $createdAt).",
                          "type": "string"
                        },
                        "dateBucket": {
                          "type": "string",
                          "enum": [
                            "day",
                            "week",
                            "month",
                            "quarter"
                          ]
                        },
                        "filters": {
                          "description": "Panel-scoped FilterGroup, same shape as saved-view filters.",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "size": {
                          "description": "Deprecated; ignored for layout. Use `span`.",
                          "type": "string",
                          "enum": [
                            "sm",
                            "md",
                            "lg"
                          ]
                        },
                        "span": {
                          "description": "Card width on the 6-track dashboard grid: 2 = a third, 3 = half, 4 = two thirds, 6 = full row. Defaults: funnel 4; map and leaderboard 2; bar/donut grouped by a user field 2, by anything else 4; trends 3.",
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 2
                            },
                            {
                              "type": "number",
                              "const": 3
                            },
                            {
                              "type": "number",
                              "const": 4
                            },
                            {
                              "type": "number",
                              "const": 6
                            }
                          ]
                        },
                        "hidden": {
                          "description": "Hide from the strip above the table; still shown in the full analytics view.",
                          "type": "boolean"
                        },
                        "sortOrder": {
                          "type": "number"
                        },
                        "derived": {
                          "description": "Role-driven derived metric; when set the panel computes from fieldRoles instead of metric/groupBy.",
                          "type": "string",
                          "enum": [
                            "conversion_rate",
                            "win_rate",
                            "won_amount",
                            "lost_amount",
                            "open_pipeline",
                            "pipeline_forecast",
                            "mrr",
                            "arr"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "title",
                        "type",
                        "metric",
                        "sortOrder"
                      ],
                      "additionalProperties": false,
                      "description": "One analytics panel definition."
                    }
                  },
                  "required": [
                    "ok",
                    "panel"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/analytics/reorder": {
      "post": {
        "operationId": "crm_analytics_reorder",
        "tags": [
          "crm"
        ],
        "summary": "Persist the full panel order. panelIds must name every stored panel of the targeted dashboard",
        "description": "Persist the full panel order. panelIds must name every stored panel of the targeted dashboard.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "panelIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Every stored panel id of the targeted dashboard, in order."
                  },
                  "viewName": {
                    "type": "string"
                  }
                },
                "required": [
                  "panelIds"
                ]
              },
              "example": {
                "panelIds": [
                  "tpl:sales:total-leads",
                  "tpl:sales:leads-by-source"
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/analytics/roles": {
      "put": {
        "operationId": "crm_analytics_roles",
        "tags": [
          "crm"
        ],
        "summary": "Set the object's analytics setup — the field roles shared by every chart and view (amount, stage, won/lost/converted values, stageProbabilities, closeDate, recurrence, owner, location). Replaces the mapping; with merge: true only the keys given change and null clears one",
        "description": "Set the object's analytics setup — the field roles shared by every chart and view (amount, stage, won/lost/converted values, stageProbabilities, closeDate, recurrence, owner, location). Replaces the mapping; with merge: true only the keys given change and null clears one.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fieldRoles": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "description": "Numeric field holding the deal value (\"Amount\") — the \"Value field\" in the setup sheet.",
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "stage": {
                        "description": "Enum field driving the pipeline (\"Stage\" / \"Status\") — the \"Progress field\".",
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "wonValues": {
                        "description": "`stage` options that count as won (closed, successful).",
                        "anyOf": [
                          {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "lostValues": {
                        "description": "`stage` options that count as lost (closed, gone).",
                        "anyOf": [
                          {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "convertedValues": {
                        "description": "`stage` options that count as converted (a lead reached \"Qualified\").",
                        "anyOf": [
                          {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "closeDate": {
                        "description": "Date field for time bucketing, forecasts and the period pill (falls back to $createdAt).",
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "owner": {
                        "description": "User field naming who owns each record (\"Owner\"). Rankings on it default to a narrow card and draw member faces.",
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "location": {
                        "description": "Place-name field maps plot. May be a relation path like \"Account.HQ Location\" (one hop through a relation).",
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "recurrence": {
                        "description": "How a won amount recurs: annual treats Amount as ARR, monthly as MRR, one_time disables MRR/ARR panels.",
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "monthly",
                              "annual",
                              "one_time"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "stageProbabilities": {
                        "description": "Chance of closing per OPEN stage, 0..1, for the weighted forecast. Unlisted stages are spaced evenly; won = 1, lost = 0.",
                        "anyOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "number"
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "additionalProperties": false,
                    "description": "Field roles as an edit: the same keys; null clears one. Applied onto the stored mapping with merge: true, otherwise replaces it."
                  },
                  "merge": {
                    "description": "true: change only the keys given (null clears one). Default replaces the whole mapping.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "fieldRoles"
                ]
              },
              "example": {
                "fieldRoles": {
                  "amount": "Amount",
                  "stage": "Stage",
                  "wonValues": [
                    "Closed Won"
                  ],
                  "lostValues": [
                    "Closed Lost"
                  ],
                  "closeDate": "Close Date",
                  "owner": "Owner",
                  "location": "Account.HQ Location",
                  "recurrence": "annual"
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "fieldRoles": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "description": "Numeric field holding the deal value (\"Amount\") — the \"Value field\" in the setup sheet.",
                          "type": "string"
                        },
                        "stage": {
                          "description": "Enum field driving the pipeline (\"Stage\" / \"Status\") — the \"Progress field\".",
                          "type": "string"
                        },
                        "wonValues": {
                          "description": "`stage` options that count as won (closed, successful).",
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "lostValues": {
                          "description": "`stage` options that count as lost (closed, gone).",
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "convertedValues": {
                          "description": "`stage` options that count as converted (a lead reached \"Qualified\").",
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "closeDate": {
                          "description": "Date field for time bucketing, forecasts and the period pill (falls back to $createdAt).",
                          "type": "string"
                        },
                        "owner": {
                          "description": "User field naming who owns each record (\"Owner\"). Rankings on it default to a narrow card and draw member faces.",
                          "type": "string"
                        },
                        "location": {
                          "description": "Place-name field maps plot. May be a relation path like \"Account.HQ Location\" (one hop through a relation).",
                          "type": "string"
                        },
                        "recurrence": {
                          "description": "How a won amount recurs: annual treats Amount as ARR, monthly as MRR, one_time disables MRR/ARR panels.",
                          "type": "string",
                          "enum": [
                            "monthly",
                            "annual",
                            "one_time"
                          ]
                        },
                        "stageProbabilities": {
                          "description": "Chance of closing per OPEN stage, 0..1, for the weighted forecast. Unlisted stages are spaced evenly; won = 1, lost = 0.",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "number"
                          }
                        }
                      },
                      "additionalProperties": false,
                      "description": "The mapping as stored after the write."
                    }
                  },
                  "required": [
                    "ok",
                    "fieldRoles"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/analytics/collapse": {
      "post": {
        "operationId": "crm_analytics_collapse",
        "tags": [
          "crm"
        ],
        "summary": "Collapse the analytics strip above the object's table (team-shared, like saved views)",
        "description": "Collapse the analytics strip above the object's table (team-shared, like saved views).",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/analytics/expand": {
      "post": {
        "operationId": "crm_analytics_expand",
        "tags": [
          "crm"
        ],
        "summary": "Expand the analytics strip above the object's table",
        "description": "Expand the analytics strip above the object's table.",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/objects/{objectName}/views/{viewName}/analytics/scope": {
      "post": {
        "operationId": "crm_analytics_scope",
        "tags": [
          "crm"
        ],
        "summary": "Give a saved view its own dashboard (mode \"own\": starts as a copy of the object's panels) or hand it back to the object's shared one (mode \"shared\")",
        "description": "Give a saved view its own dashboard (mode \"own\": starts as a copy of the object's panels) or hand it back to the object's shared one (mode \"shared\").",
        "parameters": [
          {
            "name": "objectName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "own",
                      "shared"
                    ],
                    "description": "\"own\": the view gets its own dashboard (a copy of the object's panels); \"shared\": it shows the object's again."
                  }
                },
                "required": [
                  "mode"
                ]
              },
              "example": {
                "mode": "own"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "changed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok",
                    "changed"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "changed": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/enrich/cell": {
      "post": {
        "operationId": "crm_enrich_cell",
        "tags": [
          "crm"
        ],
        "summary": "Enrich cell",
        "description": "Request enrichment for one CRM cell.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objectName": {
                    "type": "string"
                  },
                  "entryId": {
                    "type": "string"
                  },
                  "fieldName": {
                    "type": "string"
                  }
                },
                "required": [
                  "objectName",
                  "entryId",
                  "fieldName"
                ]
              },
              "example": {
                "objectName": "string",
                "entryId": "string",
                "fieldName": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "enqueued": {
                      "type": "boolean"
                    },
                    "hint": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "enqueued",
                    "hint"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "enqueued": true,
                  "hint": "Enrichment queued; the cell fills in once search responds."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/enrich/object": {
      "post": {
        "operationId": "crm_enrich_object",
        "tags": [
          "crm"
        ],
        "summary": "Enrich object",
        "description": "Request enrichment for a CRM object.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objectName": {
                    "type": "string"
                  },
                  "fieldName": {
                    "type": "string"
                  },
                  "missingOnly": {
                    "description": "Only enrich empty cells. Defaults true.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "objectName",
                  "fieldName"
                ]
              },
              "example": {
                "objectName": "string",
                "fieldName": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "enqueued": {
                      "type": "number",
                      "description": "Number of cells queued for enrichment."
                    }
                  },
                  "required": [
                    "enqueued"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "enqueued": 37
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/enrichment/people/search": {
      "post": {
        "operationId": "crm_people_search",
        "tags": [
          "crm"
        ],
        "summary": "Search people",
        "description": "Search for people through the enrichment gateway. `companyDomains` takes up to 1000 domains (e.g. a resolved company list; `dench leads find --company-list <id|view>` resolves one for you) — the gateway fans large lists out as sequential vendor-safe chunks behind one `nextPageToken` stream.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "linkedinUrl": {
                    "type": "string"
                  },
                  "fullName": {
                    "type": "string"
                  },
                  "firstName": {
                    "type": "string"
                  },
                  "lastName": {
                    "type": "string"
                  },
                  "keywords": {
                    "description": "Current-title text only. For profile or work descriptions, use profileKeywords. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "type": "string"
                  },
                  "companyDomain": {
                    "type": "string"
                  },
                  "companyName": {
                    "type": "string"
                  },
                  "titles": {
                    "description": "Current job titles (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "pastTitles": {
                    "description": "Past job titles (free text).",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "personNames": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "pastSeniorities": {
                    "description": "Seniority in any past role, independent of pastCompanyNames/pastTitles. Current seniority vocabulary plus Founding Team. Founder includes Co-Founder; C-level and Founding Team do not imply founder. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "profileKeywords": {
                    "description": "Text in headline/about or any current/past work description. OR includes, global exclusions. Always loose text matching; missing evidence does not match.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "companyKeywords": {
                    "description": "Current employer business focus/model (e.g. SaaS, B2B, Cloud), from description/tagline/business tags; distinct from legal companyTypes. Same employer as other current-job filters. Always loose text matching. May need another filter to retrieve candidates.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "seniorities": {
                    "description": "Exact enum: Owner, Founder, C-level, Partner, VP, Head, Director, Manager, Senior.",
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "jobFunctions": {
                    "description": "Exact enum, e.g. Sales, Marketing, Software. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "subFunctions": {
                    "description": "Exact enum, e.g. SDR/BDR, Demand Generation. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "industries": {
                    "description": "Exact enum, e.g. Software Development. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "locations": {
                    "description": "Person locations — cities, states, countries, or metros (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "headcountRanges": {
                    "description": "Exact buckets: 1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10001+.",
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "companyNames": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "pastCompanyNames": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "companyDomains": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "companyHeadquarters": {
                    "description": "Company HQ locations — cities, states, countries, or metros (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "companyTypes": {
                    "description": "Exact enum: Partnership, Nonprofit, Educational, Privately Held, Public Company, Self-Owned, Self-Employed, Government Agency.",
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "universities": {
                    "description": "Universities attended (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "skills": {
                    "description": "Profile skills (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "languages": {
                    "description": "Spoken languages, e.g. English, German. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "exclude": {
                              "type": "boolean"
                            },
                            "exactMatch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "yearsInRole": {
                    "type": "object",
                    "properties": {
                      "min": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "max": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "additionalProperties": false
                  },
                  "yearsAtCompany": {
                    "type": "object",
                    "properties": {
                      "min": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "max": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "additionalProperties": false
                  },
                  "daysSinceJobChange": {
                    "type": "object",
                    "properties": {
                      "min": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "max": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "additionalProperties": false
                  },
                  "foundedYears": {
                    "description": "Company founded-year range, e.g. {min: 2015, max: 2024}.",
                    "type": "object",
                    "properties": {
                      "min": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "max": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "additionalProperties": false
                  },
                  "exactMatch": {
                    "description": "Match free-text filters as whole strings. Default false: titles ['Founder'] also returns 'Co-Founder' and 'Founder & CEO'. Set true to narrow. Domains, LinkedIn URLs, enum filters and numeric ranges are always exact; keywords is always a loose text probe.",
                    "type": "boolean"
                  },
                  "limit": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 5000
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "pageToken": {
                    "description": "Opaque token from a previous response's metadata.nextPageToken.",
                    "type": "string"
                  },
                  "preferCache": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "titles": [
                  "Head of Sales"
                ],
                "industries": [
                  "SaaS"
                ],
                "companyDomains": [
                  "acme.com",
                  "globex.com"
                ],
                "limit": 10
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "enum": [
                        "live",
                        "cache"
                      ]
                    },
                    "people": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fullName": {
                            "type": "string"
                          },
                          "firstName": {
                            "type": "string"
                          },
                          "lastName": {
                            "type": "string"
                          },
                          "headline": {
                            "type": "string"
                          },
                          "seniority": {
                            "type": "string"
                          },
                          "jobFunctions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "currentCompanyName": {
                            "type": "string"
                          },
                          "currentCompanyWebsite": {
                            "type": "string"
                          },
                          "linkedinID": {
                            "type": "string"
                          },
                          "emails": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          },
                          "phones": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "additionalProperties": {}
                      },
                      "description": "Search results normalized to the CRM upsert shape."
                    },
                    "resolvedPersonIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "creditsCharged": {
                      "type": "number"
                    },
                    "billing": {
                      "type": "object",
                      "properties": {
                        "estimatedCents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "Search cost ceiling authorized by Dench billing, in cents."
                        },
                        "chargedCents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "Actual workspace search charge reported by Dench billing, in cents."
                        }
                      },
                      "required": [
                        "estimatedCents",
                        "chargedCents"
                      ],
                      "additionalProperties": false
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "description": "Total matches for the search. Stable across pages; absent when only an estimate exists.",
                          "type": "number"
                        },
                        "totalIsEstimate": {
                          "description": "True when the total is a lower bound rather than exact.",
                          "type": "boolean"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "nextPageToken": {
                          "description": "Opaque token for the next page. Pass it back as pageToken; absent on the last page.",
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "source",
                    "people",
                    "resolvedPersonIds",
                    "creditsCharged"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "source": "live",
                  "people": [
                    {
                      "fullName": "Jane Doe",
                      "firstName": "Jane",
                      "lastName": "Doe",
                      "headline": "VP Engineering",
                      "currentCompanyName": "Acme",
                      "currentCompanyWebsite": "acme.com",
                      "linkedinID": "janedoe"
                    }
                  ],
                  "resolvedPersonIds": [
                    "per_abc123"
                  ],
                  "creditsCharged": 1,
                  "billing": {
                    "estimatedCents": 1,
                    "chargedCents": 1
                  },
                  "metadata": {
                    "total": 1,
                    "offset": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/enrichment/company/search": {
      "post": {
        "operationId": "crm_companies_search",
        "tags": [
          "crm"
        ],
        "summary": "Search companies",
        "description": "Search for companies through the enrichment gateway (also `dench companies find`).",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "linkedinUrl": {
                    "type": "string"
                  },
                  "keywords": {
                    "type": "string"
                  },
                  "industries": {
                    "description": "Exact enum, e.g. Software Development. Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "locations": {
                    "description": "Cities, states, countries, or metros (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "headcountRanges": {
                    "description": "Exact buckets: 1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10001+.",
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "exactMatch": {
                    "description": "Match free-text filters (name, locations, keywords) as whole strings. Default false. Domain, linkedinUrl and enum filters are always exact.",
                    "type": "boolean"
                  },
                  "limit": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 5000
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "pageToken": {
                    "description": "Opaque token from a previous response's metadata.nextPageToken.",
                    "type": "string"
                  },
                  "preferCache": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "domain": "example.com"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "enum": [
                        "live",
                        "cache"
                      ]
                    },
                    "companies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "website": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "founded": {
                            "type": "number"
                          },
                          "headcount": {
                            "type": "number"
                          },
                          "industry": {
                            "type": "string"
                          },
                          "linkedinUrl": {
                            "type": "string"
                          },
                          "linkedinID": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      },
                      "description": "Search results normalized to the CRM upsert shape."
                    },
                    "resolvedCompanyIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "creditsCharged": {
                      "type": "number"
                    },
                    "billing": {
                      "type": "object",
                      "properties": {
                        "estimatedCents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "Search cost ceiling authorized by Dench billing, in cents."
                        },
                        "chargedCents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "Actual workspace search charge reported by Dench billing, in cents."
                        }
                      },
                      "required": [
                        "estimatedCents",
                        "chargedCents"
                      ],
                      "additionalProperties": false
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "description": "Total matches for the search. Stable across pages; absent when only an estimate exists.",
                          "type": "number"
                        },
                        "totalIsEstimate": {
                          "description": "True when the total is a lower bound rather than exact.",
                          "type": "boolean"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "nextPageToken": {
                          "description": "Opaque token for the next page. Pass it back as pageToken; absent on the last page.",
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "source",
                    "companies",
                    "resolvedCompanyIds",
                    "creditsCharged"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "source": "live",
                  "companies": [
                    {
                      "name": "Acme",
                      "website": "acme.com",
                      "description": "An example company",
                      "linkedinUrl": "https://linkedin.com/company/acme",
                      "linkedinID": "acme"
                    }
                  ],
                  "resolvedCompanyIds": [
                    "com_abc123"
                  ],
                  "creditsCharged": 1,
                  "billing": {
                    "estimatedCents": 1,
                    "chargedCents": 1
                  },
                  "metadata": {
                    "total": 1,
                    "offset": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/enrichment/jobs/search": {
      "post": {
        "operationId": "enrichment_jobs_search",
        "tags": [
          "crm"
        ],
        "summary": "Search jobs",
        "description": "Search job postings through Dench find. `companyDomains` takes up to 1000 domains (chunked automatically); `dench jobs find --company-list <id|view>` resolves a saved company list into it.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "titles": {
                    "description": "Job titles (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "locations": {
                    "description": "Cities, states, countries, or metros (free text). Accepted values: see `dench leads filters` or https://dench.com/references/find-filter-options.json.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "companyDomain": {
                    "type": "string"
                  },
                  "companyName": {
                    "type": "string"
                  },
                  "companyLinkedinUrl": {
                    "type": "string"
                  },
                  "keywords": {
                    "type": "string"
                  },
                  "postedAfter": {
                    "type": "string"
                  },
                  "postedBefore": {
                    "description": "Inclusive posting end date (YYYY-MM-DD); includes the whole UTC day.",
                    "type": "string"
                  },
                  "limit": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 5000
                  },
                  "pageToken": {
                    "description": "Opaque token from a previous response's metadata.nextPageToken.",
                    "type": "string"
                  },
                  "preferCache": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "titles": [
                  "Account Executive"
                ],
                "locations": [
                  "San Francisco"
                ],
                "companyDomains": [
                  "acme.com",
                  "globex.com"
                ],
                "limit": 50
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "enum": [
                        "live",
                        "cache"
                      ]
                    },
                    "jobs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string"
                          },
                          "company": {
                            "type": "string"
                          },
                          "location": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "workplaceType": {
                            "type": "string"
                          },
                          "postedAt": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      },
                      "description": "Job postings in the canonical job_posting shape."
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "description": "Total matches for the search. Stable across pages; absent when only an estimate exists.",
                          "type": "number"
                        },
                        "totalIsEstimate": {
                          "description": "True when the total is a lower bound rather than exact.",
                          "type": "boolean"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "nextPageToken": {
                          "description": "Opaque token for the next page. Pass it back as pageToken; absent on the last page.",
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "source",
                    "jobs"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "source": "live",
                  "jobs": [
                    {
                      "title": "Account Executive",
                      "company": "Acme",
                      "location": "San Francisco",
                      "url": "https://example.com/jobs/ae",
                      "workplaceType": "hybrid"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/enrichment/person": {
      "post": {
        "operationId": "enrichment_person",
        "tags": [
          "crm"
        ],
        "summary": "Person profile",
        "description": "Look up one person profile.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "linkedinURL": {
                    "type": "string"
                  },
                  "linkedinID": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "linkedinURL": "https://www.linkedin.com/in/janedoe"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "enum": [
                        "live",
                        "cache"
                      ]
                    },
                    "data": {
                      "anyOf": [
                        {},
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "source",
                    "data"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "source": "live",
                  "data": {
                    "fullName": "Jane Doe",
                    "linkedinID": "janedoe"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/enrichment/company": {
      "post": {
        "operationId": "enrichment_company",
        "tags": [
          "crm"
        ],
        "summary": "Company profile",
        "description": "Look up one company profile.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "website": {
                    "type": "string"
                  },
                  "linkedinURL": {
                    "type": "string"
                  },
                  "linkedinID": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "website": "acme.com"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "enum": [
                        "live",
                        "cache"
                      ]
                    },
                    "data": {
                      "anyOf": [
                        {},
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "source",
                    "data"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "source": "live",
                  "data": {
                    "name": "Acme",
                    "website": "acme.com"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/enrichment/person/contact": {
      "post": {
        "operationId": "enrichment_person_contact",
        "tags": [
          "crm"
        ],
        "summary": "Person contact",
        "description": "Look up verified emails and phones for people.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contacts": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  }
                },
                "required": [
                  "contacts"
                ]
              },
              "example": {
                "contacts": [
                  {
                    "linkedinUrl": "https://www.linkedin.com/in/janedoe"
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                },
                "example": {
                  "enrichmentId": "job_123",
                  "status": "queued"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/enrichment/profiles/bulk": {
      "post": {
        "operationId": "enrichment_profiles_bulk",
        "tags": [
          "crm"
        ],
        "summary": "Look up up to 100 people or company profiles without buying emails or phones. Pass kind (people|companies) and lookups; results preserve inputIndex. People require linkedinUrl or email; companies require domain or linkedinUrl",
        "description": "Look up up to 100 people or company profiles without buying emails or phones. Pass kind (people|companies) and lookups; results preserve inputIndex. People require linkedinUrl or email; companies require domain or linkedinUrl.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "people",
                      "companies"
                    ]
                  },
                  "lookups": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "linkedinUrl": {
                              "type": "string",
                              "format": "uri"
                            }
                          },
                          "required": [
                            "linkedinUrl"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string",
                              "format": "email",
                              "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                            }
                          },
                          "required": [
                            "email"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "domain": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "domain"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "description": "Exactly one identifier per lookup. People: linkedinUrl or email. Companies: domain or linkedinUrl. The gateway validates the identifier against kind."
                    },
                    "description": "Input order is preserved. Does not purchase contact data or write CRM records."
                  }
                },
                "required": [
                  "kind",
                  "lookups"
                ]
              },
              "example": {
                "kind": "companies",
                "lookups": [
                  {
                    "domain": "acme.com"
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "people",
                        "companies"
                      ]
                    },
                    "records": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "inputIndex": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "data": {
                            "anyOf": [
                              {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {}
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Dench person/company profile, or null for a genuine miss. No provider-specific IDs or payloads."
                          }
                        },
                        "required": [
                          "inputIndex",
                          "data"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "billing": {
                      "type": "object",
                      "properties": {
                        "charged_cents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "charged_cents"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "kind",
                    "records",
                    "billing"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "kind": "companies",
                  "records": [
                    {
                      "inputIndex": 0,
                      "data": {
                        "name": "Acme",
                        "website": "acme.com"
                      }
                    }
                  ],
                  "billing": {
                    "charged_cents": 3
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/enrichment/company/related": {
      "post": {
        "operationId": "enrichment_company_related",
        "tags": [
          "crm"
        ],
        "summary": "Read company employees, founders, funding, investors, acquisitions, or investments. Pass domain or linkedinUrl, kind, limit (1–100), and optional pageToken. Does not import CRM records or buy contacts",
        "description": "Read company employees, founders, funding, investors, acquisitions, or investments. Pass domain or linkedinUrl, kind, limit (1–100), and optional pageToken. Does not import CRM records or buy contacts.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain": {
                    "description": "Company domain. Provide exactly one of domain or linkedinUrl.",
                    "type": "string",
                    "minLength": 1
                  },
                  "linkedinUrl": {
                    "description": "Company LinkedIn URL. Omit when domain is provided.",
                    "type": "string",
                    "format": "uri"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "employees",
                      "founders",
                      "funding",
                      "investors",
                      "acquisitions",
                      "investments"
                    ]
                  },
                  "limit": {
                    "description": "Records per page; defaults to 25. Keep unchanged when using pageToken.",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "pageToken": {
                    "description": "Opaque metadata.nextPageToken from this same company, kind, and page size.",
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "kind"
                ]
              },
              "example": {
                "domain": "acme.com",
                "kind": "founders",
                "limit": 10
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "employees",
                        "founders",
                        "funding",
                        "investors",
                        "acquisitions",
                        "investments"
                      ]
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "description": "Normalized records for the requested kind; employees include employment, funding includes USD amounts and investors."
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "nextPageToken": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "billing": {
                      "type": "object",
                      "properties": {
                        "charged_cents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "charged_cents"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "kind",
                    "items",
                    "metadata",
                    "billing"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "kind": "founders",
                  "items": [
                    {
                      "fullName": "Jane Doe",
                      "linkedinUrl": "https://www.linkedin.com/in/janedoe"
                    }
                  ],
                  "metadata": {
                    "total": 1
                  },
                  "billing": {
                    "charged_cents": 1
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/enrichment/search/preview": {
      "post": {
        "operationId": "enrichment_search_preview",
        "tags": [
          "crm"
        ],
        "summary": "Preview search",
        "description": "Preview how many records a find would return.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "people",
                      "companies",
                      "jobs"
                    ]
                  }
                }
              },
              "example": {
                "kind": "people",
                "titles": [
                  "VP Sales"
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "number"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "live",
                        "cache"
                      ]
                    }
                  },
                  "required": [
                    "count"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "count": 247,
                  "source": "live"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/local/enrichment/filter-options": {
      "get": {
        "operationId": "enrichment_filters_options",
        "tags": [
          "crm"
        ],
        "summary": "List Lead Finder filter vocabularies: exact enum values (seniorities, functions, industries, headcount, company types, languages) and curated suggestions (titles, locations, company HQ, universities, skills, keywords)",
        "description": "List Lead Finder filter vocabularies: exact enum values (seniorities, functions, industries, headcount, company types, languages) and curated suggestions (titles, locations, company HQ, universities, skills, keywords).",
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local-only CLI operation. Catalogs are bundled with the CLI. Over HTTPS, fetch https://dench.com/references/find-filter-options.json instead.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "Catalogs are bundled with the CLI. Over HTTPS, fetch https://dench.com/references/find-filter-options.json instead.",
                    "type": "invalid_request_error",
                    "code": "local_only"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/templates": {
      "get": {
        "operationId": "crm_templates_list",
        "tags": [
          "crm"
        ],
        "summary": "List CRM templates",
        "description": "List one-click CRM templates (objects + automations + sample rows) with per-workspace installed flags.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/templates/{templateId}/install": {
      "post": {
        "operationId": "crm_templates_install",
        "tags": [
          "crm"
        ],
        "summary": "Install CRM template",
        "description": "Install a CRM template. Idempotent: re-installs top up missing pieces and never duplicate objects, automations, or sample rows.",
        "parameters": [
          {
            "name": "templateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/templates/{templateId}/remove-sample-data": {
      "post": {
        "operationId": "crm_templates_removeSampleData",
        "tags": [
          "crm"
        ],
        "summary": "Remove template sample data",
        "description": "Delete a CRM template's sample rows (tagged \"Sample\"); schema, views, and automations stay.",
        "parameters": [
          {
            "name": "templateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/automations": {
      "get": {
        "operationId": "crm_automations_list",
        "tags": [
          "crm"
        ],
        "summary": "List CRM automations",
        "description": "List deterministic CRM automations (rules that fire inside entry writes, e.g. qualified prospect → opportunity).",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/crm/automations/{automationId}": {
      "patch": {
        "operationId": "crm_automations_setEnabled",
        "tags": [
          "crm"
        ],
        "summary": "Toggle CRM automation",
        "description": "Enable or disable a CRM automation.",
        "parameters": [
          {
            "name": "automationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/local/crm/import": {
      "post": {
        "operationId": "crm_import",
        "tags": [
          "local"
        ],
        "summary": "Import CSV",
        "description": "Import a local CSV into a CRM object.",
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local-only CLI operation. Reads a CSV from the caller's local filesystem. Over the API, parse the CSV client-side and POST rows to /crm/objects/{objectName}/entries/batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "Reads a CSV from the caller's local filesystem. Over the API, parse the CSV client-side and POST rows to /crm/objects/{objectName}/entries/batch.",
                    "type": "invalid_request_error",
                    "code": "local_only"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/local/crm/export": {
      "post": {
        "operationId": "crm_export",
        "tags": [
          "local"
        ],
        "summary": "Export CSV",
        "description": "Export a CRM object to a local CSV.",
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local-only CLI operation. Writes a CSV to the caller's local filesystem. Over the API, call POST /crm/query and format CSV client-side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "Writes a CSV to the caller's local filesystem. Over the API, call POST /crm/query and format CSV client-side.",
                    "type": "invalid_request_error",
                    "code": "local_only"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/meetings": {
      "get": {
        "operationId": "meetings_list",
        "tags": [
          "meetings"
        ],
        "summary": "List meetings, newest first, with status and participants",
        "description": "List meetings, newest first, with status and participants.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "description": "continueCursor from the prior page.",
              "type": "string"
            },
            "description": "continueCursor from the prior page."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/meetings/{meetingEntryId}/transcript": {
      "get": {
        "operationId": "meetings_transcript_list",
        "tags": [
          "meetings"
        ],
        "summary": "Read a meeting's transcript, in order, one page at a time",
        "description": "Read a meeting's transcript, in order, one page at a time.",
        "parameters": [
          {
            "name": "meetingEntryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "meetings_transcript_append",
        "tags": [
          "meetings"
        ],
        "summary": "Append up to 500 transcript segments to a meeting (speakers with an email link to existing people)",
        "description": "Append up to 500 transcript segments to a meeting (speakers with an email link to existing people).",
        "parameters": [
          {
            "name": "meetingEntryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "segments": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "seq": {
                          "description": "Ordinal; omitted continues after the last row.",
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "speakerName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "speakerEmail": {
                          "description": "Links the speaker to an existing person by exact email.",
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "startMs": {
                          "type": "number",
                          "minimum": 0
                        },
                        "endMs": {
                          "type": "number",
                          "minimum": 0
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "text"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "segments"
                ]
              },
              "example": {
                "segments": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "meetings_transcript_clear",
        "tags": [
          "meetings"
        ],
        "summary": "Delete a batch of a meeting's transcript segments; repeat until `done` before re-appending",
        "description": "Delete a batch of a meeting's transcript segments; repeat until `done` before re-appending.",
        "parameters": [
          {
            "name": "meetingEntryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/meetings/{meetingEntryId}/action-items": {
      "get": {
        "operationId": "meetings_actionItems_list",
        "tags": [
          "meetings"
        ],
        "summary": "List a meeting's action items",
        "description": "List a meeting's action items.",
        "parameters": [
          {
            "name": "meetingEntryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "meetings_actionItems_add",
        "tags": [
          "meetings"
        ],
        "summary": "Add action items to a meeting; `replace: true` swaps the whole list",
        "description": "Add action items to a meeting; `replace: true` swaps the whole list.",
        "parameters": [
          {
            "name": "meetingEntryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "text": {
                          "type": "string",
                          "minLength": 1
                        },
                        "ownerName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "done": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "text"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "replace": {
                    "description": "Delete the existing list first.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "items"
                ]
              },
              "example": {
                "items": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/meetings/action-items/{itemId}": {
      "patch": {
        "operationId": "meetings_actionItems_setDone",
        "tags": [
          "meetings"
        ],
        "summary": "Tick or untick one action item",
        "description": "Tick or untick one action item.",
        "parameters": [
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "done": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "done"
                ]
              },
              "example": {
                "done": true
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "meetings_actionItems_delete",
        "tags": [
          "meetings"
        ],
        "summary": "Delete one action item",
        "description": "Delete one action item.",
        "parameters": [
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/meetings/{meetingEntryId}/participants": {
      "get": {
        "operationId": "meetings_participants_list",
        "tags": [
          "meetings"
        ],
        "summary": "Who was in the meeting, merged with the linked calendar invite",
        "description": "Who was in the meeting, merged with the linked calendar invite.",
        "parameters": [
          {
            "name": "meetingEntryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "meetings_participants_set",
        "tags": [
          "meetings"
        ],
        "summary": "Record attendees by name/email; known members and existing people are linked, nobody is created",
        "description": "Record attendees by name/email; known members and existing people are linked, nobody is created.",
        "parameters": [
          {
            "name": "meetingEntryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "participants": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "email": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "isHost": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "replace": {
                    "description": "Drop attendees not in this list. Default merges.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "participants"
                ]
              },
              "example": {
                "participants": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/meetings/{meetingEntryId}/sharing": {
      "get": {
        "operationId": "meetings_sharing_get",
        "tags": [
          "meetings"
        ],
        "summary": "Whether a meeting is shared with the whole workspace, and whether you may change that",
        "description": "Whether a meeting is shared with the whole workspace, and whether you may change that.",
        "parameters": [
          {
            "name": "meetingEntryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "meetings_sharing_set",
        "tags": [
          "meetings"
        ],
        "summary": "Share one meeting with the workspace, or take it back to owner + invitees",
        "description": "Share one meeting with the workspace, or take it back to owner + invitees.",
        "parameters": [
          {
            "name": "meetingEntryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "shared": {
                    "type": "boolean",
                    "description": "true opens the meeting to every workspace member; false returns it to the owner plus the members who were on the invite."
                  }
                },
                "required": [
                  "shared"
                ]
              },
              "example": {
                "shared": true
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/local/meetings/import": {
      "post": {
        "operationId": "meetings_import",
        "tags": [
          "local"
        ],
        "summary": "Import calls from a local CSV/JSONL: meeting fields plus transcript, action items and attendees per row",
        "description": "Import calls from a local CSV/JSONL: meeting fields plus transcript, action items and attendees per row.",
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local-only CLI operation. Reads a CSV/JSONL from the caller's local filesystem. Over the API: POST /crm/objects/meeting/entries/batch with seedKey per row, then POST /meetings/{meetingEntryId}/transcript, POST …/action-items and PUT …/participants for each created meeting.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "Reads a CSV/JSONL from the caller's local filesystem. Over the API: POST /crm/objects/meeting/entries/batch with seedKey per row, then POST /meetings/{meetingEntryId}/transcript, POST …/action-items and PUT …/participants for each created meeting.",
                    "type": "invalid_request_error",
                    "code": "local_only"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/identities/verify": {
      "post": {
        "operationId": "email_identity_verify",
        "tags": [
          "email"
        ],
        "summary": "Verify sender",
        "description": "Start Dench Emailing Service sender verification.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "domain",
                      "email"
                    ],
                    "description": "Identity scope. `domain` verifies via DNS (DKIM); `email` verifies a single mailbox via a confirmation email."
                  },
                  "identity": {
                    "type": "string",
                    "description": "Domain (example.com) or mailbox (founder@example.com)."
                  },
                  "configurationSetName": {
                    "description": "Optional provider configuration set override.",
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "identity"
                ]
              },
              "example": {
                "type": "email",
                "identity": "founder@example.com"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "identity": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "domain",
                        "email"
                      ],
                      "description": "Identity scope. `domain` verifies via DNS (DKIM); `email` verifies a single mailbox via a confirmation email."
                    },
                    "identityType": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Provider identity type, e.g. \"DOMAIN\" or \"EMAIL_ADDRESS\"."
                    },
                    "verifiedForSendingStatus": {
                      "type": "boolean"
                    },
                    "messageId": {
                      "description": "Verification email id (email identities only).",
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "dkimTokens": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "DKIM tokens for DNS records (domain identities)."
                    }
                  },
                  "required": [
                    "ok",
                    "identity",
                    "type",
                    "identityType",
                    "verifiedForSendingStatus",
                    "dkimTokens"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "ok": true,
                  "identity": "example.com",
                  "type": "domain",
                  "identityType": "DOMAIN",
                  "verifiedForSendingStatus": false,
                  "dkimTokens": [
                    "abc123token",
                    "def456token",
                    "ghi789token"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sending-identities": {
      "post": {
        "operationId": "email_identity_create",
        "tags": [
          "email"
        ],
        "summary": "Create sending identity",
        "description": "Create a durable Dench email sending identity record.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "domain",
                      "email"
                    ],
                    "description": "Identity scope. `domain` verifies via DNS (DKIM); `email` verifies a single mailbox via a confirmation email."
                  },
                  "domain": {
                    "description": "Lowercase domain; required when type is `domain`.",
                    "type": "string"
                  },
                  "fromEmail": {
                    "type": "string",
                    "description": "Sender mailbox, e.g. founder@example.com."
                  },
                  "fromName": {
                    "description": "Default display name for the sender.",
                    "type": "string"
                  },
                  "replyToEmail": {
                    "type": "string"
                  },
                  "configurationSetName": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "fromEmail"
                ]
              },
              "example": {
                "type": "domain",
                "domain": "example.com",
                "fromEmail": "founder@example.com",
                "fromName": "Ada at Example"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "identityId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "identityId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "identityId": "esi_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "get": {
        "operationId": "email_identity_list",
        "tags": [
          "email"
        ],
        "summary": "List identities",
        "description": "List the workspace's email sending identities.",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Filter identities by domain.",
              "type": "string"
            },
            "description": "Filter identities by domain."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "identityId": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "domain",
                          "email"
                        ],
                        "description": "Identity scope. `domain` verifies via DNS (DKIM); `email` verifies a single mailbox via a confirmation email."
                      },
                      "domain": {
                        "type": "string"
                      },
                      "fromEmail": {
                        "type": "string"
                      },
                      "fromName": {
                        "type": "string"
                      },
                      "deliveryVerificationStatus": {
                        "type": "string",
                        "enum": [
                          "pending",
                          "verified",
                          "failed",
                          "disabled"
                        ],
                        "description": "Provider-side (DNS/mailbox) verification status."
                      },
                      "denchVerificationStatus": {
                        "type": "string",
                        "enum": [
                          "pending",
                          "verified",
                          "expired",
                          "disabled"
                        ],
                        "description": "Workspace-side sender verification status."
                      },
                      "disabled": {
                        "type": "boolean"
                      },
                      "disabledAt": {
                        "type": "number"
                      },
                      "createdAt": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "identityId",
                      "type",
                      "fromEmail",
                      "deliveryVerificationStatus",
                      "denchVerificationStatus",
                      "disabled",
                      "createdAt"
                    ],
                    "additionalProperties": false
                  }
                },
                "example": [
                  {
                    "identityId": "esi_abc123",
                    "type": "email",
                    "fromEmail": "founder@example.com",
                    "fromName": "Ada at Example",
                    "deliveryVerificationStatus": "verified",
                    "denchVerificationStatus": "verified",
                    "disabled": false,
                    "createdAt": 1765526400000
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sending-identities/{identityId}/status": {
      "post": {
        "operationId": "email_identity_refresh",
        "tags": [
          "email"
        ],
        "summary": "Refresh identity status",
        "description": "Refresh a Dench Emailing Service sender verification status.",
        "parameters": [
          {
            "name": "identityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Sending identity id."
            },
            "description": "Sending identity id."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "identityId": {
                      "type": "string"
                    },
                    "identity": {
                      "type": "string"
                    },
                    "deliveryVerificationStatus": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "verified",
                        "failed",
                        "disabled"
                      ],
                      "description": "Provider-side (DNS/mailbox) verification status."
                    },
                    "deliveryVerified": {
                      "type": "boolean"
                    },
                    "domain": {
                      "type": "string"
                    },
                    "domainVerified": {
                      "type": "boolean"
                    },
                    "emailVerified": {
                      "type": "boolean"
                    },
                    "denchVerificationStatus": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "verified",
                        "expired",
                        "disabled"
                      ],
                      "description": "Workspace-side sender verification status."
                    },
                    "disabled": {
                      "type": "boolean"
                    },
                    "dnsRecords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "description": "Record type, e.g. CNAME or TXT."
                          },
                          "name": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "purpose": {
                            "type": "string",
                            "description": "Why the record is needed (DKIM/SPF/DMARC)."
                          }
                        },
                        "required": [
                          "type",
                          "name",
                          "value",
                          "purpose"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "domainVerificationInfo": {
                      "description": "Provider DNS poll info for pending domains.",
                      "type": "object",
                      "properties": {
                        "errorType": {
                          "type": "string"
                        },
                        "lastCheckedAt": {
                          "type": "string"
                        },
                        "lastSuccessAt": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "identityId",
                    "identity",
                    "deliveryVerificationStatus",
                    "deliveryVerified",
                    "domainVerified",
                    "emailVerified",
                    "denchVerificationStatus",
                    "disabled"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "identityId": "esi_abc123",
                  "identity": "example.com",
                  "deliveryVerificationStatus": "pending",
                  "deliveryVerified": false,
                  "domain": "example.com",
                  "domainVerified": false,
                  "emailVerified": true,
                  "denchVerificationStatus": "verified",
                  "disabled": false,
                  "dnsRecords": [
                    {
                      "type": "CNAME",
                      "name": "abc123token._domainkey.example.com",
                      "value": "abc123token.dkim.amazonses.com",
                      "purpose": "DKIM (required for domain verification)"
                    }
                  ],
                  "message": "Domain example.com is pending DNS verification."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sending-identities/{identityId}/verify": {
      "post": {
        "operationId": "email_identity_beginVerification",
        "tags": [
          "email"
        ],
        "summary": "Begin verification",
        "description": "Begin the full Dench sender verification flow for a sending identity.",
        "parameters": [
          {
            "name": "identityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Sending identity id from `POST /email/sending-identities`."
            },
            "description": "Sending identity id from `POST /email/sending-identities`."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "identityId": {
                      "type": "string"
                    },
                    "fromEmail": {
                      "type": "string"
                    },
                    "denchVerificationStatus": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "verified"
                      ]
                    },
                    "deliveryVerificationStatus": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "verified"
                      ]
                    },
                    "action": {
                      "type": "string",
                      "enum": [
                        "already_verified",
                        "mailbox_verification_sent",
                        "domain_dns_ready",
                        "workspace_verification_sent"
                      ]
                    },
                    "dkimTokens": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "dnsRecords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "description": "Record type, e.g. CNAME or TXT."
                          },
                          "name": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "purpose": {
                            "type": "string",
                            "description": "Why the record is needed (DKIM/SPF/DMARC)."
                          }
                        },
                        "required": [
                          "type",
                          "name",
                          "value",
                          "purpose"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "identityId",
                    "fromEmail",
                    "denchVerificationStatus",
                    "deliveryVerificationStatus",
                    "action",
                    "message"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "identityId": "esi_abc123",
                  "fromEmail": "founder@example.com",
                  "denchVerificationStatus": "pending",
                  "deliveryVerificationStatus": "pending",
                  "action": "mailbox_verification_sent",
                  "message": "Verification email sent. Open the link in that mailbox, then check sender status again."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/identities/{identity}/status": {
      "get": {
        "operationId": "email_identity_status",
        "tags": [
          "email"
        ],
        "summary": "Sender status",
        "description": "Read Dench Emailing Service sender verification status.",
        "parameters": [
          {
            "name": "identity",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Email address or domain to check."
            },
            "description": "Email address or domain to check."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "identity": {
                      "type": "string"
                    },
                    "verifiedForSendingStatus": {
                      "type": "boolean"
                    },
                    "verificationStatus": {
                      "type": "string",
                      "description": "Provider status, e.g. \"PENDING\" | \"SUCCESS\" | \"FAILED\"."
                    },
                    "dkimAttributes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Provider DKIM attributes (Tokens, Status, ...)."
                    },
                    "mailFromAttributes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "verificationInfo": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "errorType": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "lastCheckedAt": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "lastSuccessAt": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "errorType",
                            "lastCheckedAt",
                            "lastSuccessAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "ok",
                    "identity",
                    "verifiedForSendingStatus",
                    "verificationStatus",
                    "dkimAttributes",
                    "mailFromAttributes",
                    "verificationInfo"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "ok": true,
                  "identity": "example.com",
                  "verifiedForSendingStatus": false,
                  "verificationStatus": "PENDING",
                  "dkimAttributes": {
                    "Tokens": [
                      "abc123token"
                    ],
                    "Status": "PENDING"
                  },
                  "mailFromAttributes": null,
                  "verificationInfo": {
                    "errorType": null,
                    "lastCheckedAt": "2026-06-12T10:00:00.000Z",
                    "lastSuccessAt": null
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sending-identities/{identityId}/dns": {
      "get": {
        "operationId": "email_identity_dns",
        "tags": [
          "email"
        ],
        "summary": "Identity DNS records",
        "description": "Fetch DNS records (DKIM/SPF/DMARC) for a pending domain sender verification.",
        "parameters": [
          {
            "name": "identityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Sending identity id."
            },
            "description": "Sending identity id."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "identityId": {
                      "type": "string"
                    },
                    "identity": {
                      "type": "string"
                    },
                    "deliveryVerificationStatus": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "verified",
                        "failed",
                        "disabled"
                      ],
                      "description": "Provider-side (DNS/mailbox) verification status."
                    },
                    "deliveryVerified": {
                      "type": "boolean"
                    },
                    "domain": {
                      "type": "string"
                    },
                    "domainVerified": {
                      "type": "boolean"
                    },
                    "emailVerified": {
                      "type": "boolean"
                    },
                    "denchVerificationStatus": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "verified",
                        "expired",
                        "disabled"
                      ],
                      "description": "Workspace-side sender verification status."
                    },
                    "disabled": {
                      "type": "boolean"
                    },
                    "dnsRecords": {
                      "description": "DKIM/SPF/DMARC records to add for a pending domain.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "description": "Record type, e.g. CNAME or TXT."
                          },
                          "name": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "purpose": {
                            "type": "string",
                            "description": "Why the record is needed (DKIM/SPF/DMARC)."
                          }
                        },
                        "required": [
                          "type",
                          "name",
                          "value",
                          "purpose"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "identityId",
                    "identity",
                    "deliveryVerificationStatus",
                    "deliveryVerified",
                    "domainVerified",
                    "emailVerified",
                    "denchVerificationStatus",
                    "disabled"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "identityId": "esi_abc123",
                  "identity": "example.com",
                  "deliveryVerificationStatus": "pending",
                  "deliveryVerified": false,
                  "domain": "example.com",
                  "domainVerified": false,
                  "emailVerified": false,
                  "denchVerificationStatus": "verified",
                  "disabled": false,
                  "dnsRecords": [
                    {
                      "type": "CNAME",
                      "name": "abc123token._domainkey.example.com",
                      "value": "abc123token.dkim.amazonses.com",
                      "purpose": "DKIM (required for domain verification)"
                    },
                    {
                      "type": "TXT",
                      "name": "example.com",
                      "value": "v=spf1 include:amazonses.com ~all",
                      "purpose": "SPF (recommended)"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sending-identities/{identity}/disable": {
      "post": {
        "operationId": "email_identity_disable",
        "tags": [
          "email"
        ],
        "summary": "Disable sender",
        "description": "Soft-disable a sender (or every sender on a domain) for the workspace; sends are blocked until restored.",
        "parameters": [
          {
            "name": "identity",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Identity id, sender email, or domain (disables every sender on the domain)."
            },
            "description": "Identity id, sender email, or domain (disables every sender on the domain)."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "disabled": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "identityId": {
                            "type": "string"
                          },
                          "fromEmail": {
                            "type": "string"
                          },
                          "domain": {
                            "type": "string"
                          },
                          "disabled": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "identityId",
                          "fromEmail",
                          "disabled"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "ok",
                    "disabled"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "disabled": [
                    {
                      "identityId": "esi_abc123",
                      "fromEmail": "founder@example.com",
                      "disabled": true
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sending-identities/{identity}/restore": {
      "post": {
        "operationId": "email_identity_restore",
        "tags": [
          "email"
        ],
        "summary": "Restore sender",
        "description": "Restore a previously disabled sender for the workspace.",
        "parameters": [
          {
            "name": "identity",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Identity id, sender email, or domain."
            },
            "description": "Identity id, sender email, or domain."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "restored": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "identityId": {
                            "type": "string"
                          },
                          "fromEmail": {
                            "type": "string"
                          },
                          "domain": {
                            "type": "string"
                          },
                          "disabled": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "identityId",
                          "fromEmail",
                          "disabled"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "ok",
                    "restored"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "restored": [
                    {
                      "identityId": "esi_abc123",
                      "fromEmail": "founder@example.com",
                      "disabled": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sending-identities/{identity}": {
      "delete": {
        "operationId": "email_identity_delete",
        "tags": [
          "email"
        ],
        "summary": "Permanently delete a sender (or every sender on a domain) from the workspace; re-adding it requires verification from scratch",
        "description": "Permanently delete a sender (or every sender on a domain) from the workspace; re-adding it requires verification from scratch.",
        "parameters": [
          {
            "name": "identity",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Identity id, sender email, or domain (deletes every sender on the domain). Permanent: re-adding requires re-verification."
            },
            "description": "Identity id, sender email, or domain (deletes every sender on the domain). Permanent: re-adding requires re-verification."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "deleted": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "identityId": {
                            "type": "string"
                          },
                          "fromEmail": {
                            "type": "string"
                          },
                          "domain": {
                            "type": "string"
                          },
                          "disabled": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "identityId",
                          "fromEmail",
                          "disabled"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "ok",
                    "deleted"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "deleted": [
                    {
                      "identityId": "esi_abc123",
                      "fromEmail": "founder@example.com",
                      "disabled": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/inbox/search": {
      "get": {
        "operationId": "email_inbox_search",
        "tags": [
          "email"
        ],
        "summary": "Search authorized synced mailbox headers with bounded cursor pagination. isDone covers stored records, not provider completeness",
        "description": "Search authorized synced mailbox headers with bounded cursor pagination. isDone covers stored records, not provider completeness.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mailbox",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          {
            "name": "subject",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Words that must all appear in the subject, sender or recipients (case-insensitive).",
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "description": "Words that must all appear in the subject, sender or recipients (case-insensitive)."
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Inclusive Unix milliseconds; missing sentAt falls back to createdAt.",
              "type": "number"
            },
            "description": "Inclusive Unix milliseconds; missing sentAt falls back to createdAt."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Exclusive Unix milliseconds.",
              "type": "number"
            },
            "description": "Exclusive Unix milliseconds."
          },
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "inbound",
                "outbound"
              ]
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "messageHandle": {
                            "type": "string"
                          },
                          "threadHandle": {
                            "type": "string"
                          },
                          "mailboxId": {
                            "type": "string"
                          },
                          "from": {
                            "type": "object",
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "email"
                            ],
                            "additionalProperties": false
                          },
                          "to": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "email": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "email"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "subject": {
                            "type": "string"
                          },
                          "at": {
                            "type": "number"
                          },
                          "dateSource": {
                            "type": "string",
                            "enum": [
                              "sentAt",
                              "createdAt"
                            ]
                          },
                          "direction": {
                            "type": "string",
                            "enum": [
                              "inbound",
                              "outbound"
                            ]
                          },
                          "status": {
                            "type": "string"
                          },
                          "hasAttachments": {
                            "type": "boolean"
                          },
                          "headersTruncated": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "messageHandle",
                          "threadHandle",
                          "mailboxId",
                          "from",
                          "to",
                          "subject",
                          "at",
                          "dateSource",
                          "direction",
                          "status",
                          "hasAttachments",
                          "headersTruncated"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continueCursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "isDone": {
                      "type": "boolean"
                    },
                    "coverage": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "type": "string",
                          "const": "synced"
                        },
                        "scope": {
                          "type": "string",
                          "const": "mailbox_linked_messages"
                        },
                        "mailboxId": {
                          "type": "string"
                        },
                        "mailboxEmail": {
                          "type": "string"
                        },
                        "mailboxStatus": {
                          "type": "string"
                        },
                        "ingestionMode": {
                          "type": "string"
                        },
                        "phase": {
                          "type": "string"
                        },
                        "syncStatus": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastPolledAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastBackfillCompletedAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "oldestSeenAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "backfillStatus": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "backfillCapped": {
                          "type": "boolean"
                        },
                        "providerComplete": {
                          "type": "boolean",
                          "const": false
                        },
                        "privacyLimited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "source",
                        "scope",
                        "mailboxId",
                        "mailboxEmail",
                        "mailboxStatus",
                        "ingestionMode",
                        "phase",
                        "syncStatus",
                        "lastPolledAt",
                        "lastBackfillCompletedAt",
                        "oldestSeenAt",
                        "backfillStatus",
                        "backfillCapped",
                        "providerComplete",
                        "privacyLimited"
                      ],
                      "additionalProperties": false
                    },
                    "order": {
                      "type": "string",
                      "const": "sentAt_desc_then_undated"
                    }
                  },
                  "required": [
                    "page",
                    "continueCursor",
                    "isDone",
                    "coverage",
                    "order"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/inbox/threads/{threadHandle}": {
      "get": {
        "operationId": "email_inbox_thread",
        "tags": [
          "email"
        ],
        "summary": "Read a bounded page of synced headers using an exact thread handle from inbox search; bodies remain on demand",
        "description": "Read a bounded page of synced headers using an exact thread handle from inbox search; bodies remain on demand.",
        "parameters": [
          {
            "name": "threadHandle",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "messageHandle": {
                            "type": "string"
                          },
                          "threadHandle": {
                            "type": "string"
                          },
                          "mailboxId": {
                            "type": "string"
                          },
                          "from": {
                            "type": "object",
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "email"
                            ],
                            "additionalProperties": false
                          },
                          "to": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "email": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "email"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "subject": {
                            "type": "string"
                          },
                          "at": {
                            "type": "number"
                          },
                          "dateSource": {
                            "type": "string",
                            "enum": [
                              "sentAt",
                              "createdAt"
                            ]
                          },
                          "direction": {
                            "type": "string",
                            "enum": [
                              "inbound",
                              "outbound"
                            ]
                          },
                          "status": {
                            "type": "string"
                          },
                          "hasAttachments": {
                            "type": "boolean"
                          },
                          "headersTruncated": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "messageHandle",
                          "threadHandle",
                          "mailboxId",
                          "from",
                          "to",
                          "subject",
                          "at",
                          "dateSource",
                          "direction",
                          "status",
                          "hasAttachments",
                          "headersTruncated"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "continueCursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "isDone": {
                      "type": "boolean"
                    },
                    "coverage": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "type": "string",
                          "const": "synced"
                        },
                        "scope": {
                          "type": "string",
                          "const": "mailbox_linked_messages"
                        },
                        "mailboxId": {
                          "type": "string"
                        },
                        "mailboxEmail": {
                          "type": "string"
                        },
                        "mailboxStatus": {
                          "type": "string"
                        },
                        "ingestionMode": {
                          "type": "string"
                        },
                        "phase": {
                          "type": "string"
                        },
                        "syncStatus": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastPolledAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastBackfillCompletedAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "oldestSeenAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "backfillStatus": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "backfillCapped": {
                          "type": "boolean"
                        },
                        "providerComplete": {
                          "type": "boolean",
                          "const": false
                        },
                        "privacyLimited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "source",
                        "scope",
                        "mailboxId",
                        "mailboxEmail",
                        "mailboxStatus",
                        "ingestionMode",
                        "phase",
                        "syncStatus",
                        "lastPolledAt",
                        "lastBackfillCompletedAt",
                        "oldestSeenAt",
                        "backfillStatus",
                        "backfillCapped",
                        "providerComplete",
                        "privacyLimited"
                      ],
                      "additionalProperties": false
                    },
                    "order": {
                      "type": "string",
                      "const": "sentAt_desc_then_undated"
                    }
                  },
                  "required": [
                    "page",
                    "continueCursor",
                    "isDone",
                    "coverage",
                    "order"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/inbox/messages/{messageHandle}": {
      "get": {
        "operationId": "email_inbox_message",
        "tags": [
          "email"
        ],
        "summary": "Read a bounded stored body using an exact message handle from inbox search; rechecks mailbox and record privacy",
        "description": "Read a bounded stored body using an exact message handle from inbox search; rechecks mailbox and record privacy.",
        "parameters": [
          {
            "name": "messageHandle",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "text",
                "html"
              ]
            }
          },
          {
            "name": "maxBytes",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100000
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "header": {
                      "type": "object",
                      "properties": {
                        "messageHandle": {
                          "type": "string"
                        },
                        "threadHandle": {
                          "type": "string"
                        },
                        "mailboxId": {
                          "type": "string"
                        },
                        "from": {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "email"
                          ],
                          "additionalProperties": false
                        },
                        "to": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "email"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "subject": {
                          "type": "string"
                        },
                        "at": {
                          "type": "number"
                        },
                        "dateSource": {
                          "type": "string",
                          "enum": [
                            "sentAt",
                            "createdAt"
                          ]
                        },
                        "direction": {
                          "type": "string",
                          "enum": [
                            "inbound",
                            "outbound"
                          ]
                        },
                        "status": {
                          "type": "string"
                        },
                        "hasAttachments": {
                          "type": "boolean"
                        },
                        "headersTruncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "messageHandle",
                        "threadHandle",
                        "mailboxId",
                        "from",
                        "to",
                        "subject",
                        "at",
                        "dateSource",
                        "direction",
                        "status",
                        "hasAttachments",
                        "headersTruncated"
                      ],
                      "additionalProperties": false
                    },
                    "coverage": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "type": "string",
                          "const": "synced"
                        },
                        "scope": {
                          "type": "string",
                          "const": "mailbox_linked_messages"
                        },
                        "mailboxId": {
                          "type": "string"
                        },
                        "mailboxEmail": {
                          "type": "string"
                        },
                        "mailboxStatus": {
                          "type": "string"
                        },
                        "ingestionMode": {
                          "type": "string"
                        },
                        "phase": {
                          "type": "string"
                        },
                        "syncStatus": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastPolledAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastBackfillCompletedAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "oldestSeenAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "backfillStatus": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "backfillCapped": {
                          "type": "boolean"
                        },
                        "providerComplete": {
                          "type": "boolean",
                          "const": false
                        },
                        "privacyLimited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "source",
                        "scope",
                        "mailboxId",
                        "mailboxEmail",
                        "mailboxStatus",
                        "ingestionMode",
                        "phase",
                        "syncStatus",
                        "lastPolledAt",
                        "lastBackfillCompletedAt",
                        "oldestSeenAt",
                        "backfillStatus",
                        "backfillCapped",
                        "providerComplete",
                        "privacyLimited"
                      ],
                      "additionalProperties": false
                    },
                    "body": {
                      "type": "object",
                      "properties": {
                        "format": {
                          "type": "string",
                          "enum": [
                            "text",
                            "html"
                          ]
                        },
                        "content": {
                          "type": "string"
                        },
                        "truncated": {
                          "type": "boolean"
                        },
                        "totalBytes": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "format",
                        "content",
                        "truncated",
                        "totalBytes"
                      ],
                      "additionalProperties": false
                    },
                    "recipients": {
                      "type": "object",
                      "properties": {
                        "to": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "email"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "cc": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "email"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "bcc": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "email"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "to",
                        "cc",
                        "bcc",
                        "truncated"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "header",
                    "coverage",
                    "body",
                    "recipients"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/drafts": {
      "post": {
        "operationId": "email_drafts_create",
        "tags": [
          "email"
        ],
        "summary": "Create an editable Dench email draft and synchronize its selected native mailbox asynchronously. Use a stable requestId for retries",
        "description": "Create an editable Dench email draft and synchronize its selected native mailbox asynchronously. Use a stable requestId for retries.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "organizationId": {
                    "type": "string"
                  },
                  "threadId": {
                    "type": "string"
                  },
                  "mailbox": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  },
                  "to": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "email"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "cc": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "email"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "bcc": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "email"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "subject": {
                    "type": "string"
                  },
                  "htmlBody": {
                    "type": "string"
                  },
                  "textBody": {
                    "type": "string"
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "storageId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "contentType": {
                          "type": "string"
                        },
                        "size": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "storageId",
                        "name",
                        "contentType",
                        "size"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "requestId"
                ]
              },
              "example": {
                "requestId": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "kind": {
                      "type": "string",
                      "const": "email"
                    },
                    "draftId": {
                      "type": "string"
                    },
                    "syncStatus": {
                      "type": "string"
                    },
                    "revision": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "ok",
                    "kind",
                    "draftId",
                    "syncStatus",
                    "revision"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/drafts/{draftId}": {
      "get": {
        "operationId": "email_drafts_get",
        "tags": [
          "email"
        ],
        "summary": "Read an email draft, eligible senders and provider sync status",
        "description": "Read an email draft, eligible senders and provider sync status.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "kind": {
                      "type": "string",
                      "const": "email"
                    },
                    "draftId": {
                      "type": "string"
                    },
                    "syncStatus": {
                      "type": "string"
                    },
                    "revision": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "ok",
                    "kind",
                    "draftId",
                    "syncStatus",
                    "revision"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "email_drafts_update",
        "tags": [
          "email"
        ],
        "summary": "Save draft content using expectedRevision; sender changes require a new draft after provider binding",
        "description": "Save draft content using expectedRevision; sender changes require a new draft after provider binding.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "patch": {
                    "type": "object",
                    "properties": {
                      "mailboxAccountId": {
                        "type": "string"
                      },
                      "to": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "email"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "cc": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "email"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "bcc": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "email"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "subject": {
                        "type": "string"
                      },
                      "htmlBody": {
                        "type": "string"
                      },
                      "textBody": {
                        "type": "string"
                      },
                      "attachments": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "storageId": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "contentType": {
                              "type": "string"
                            },
                            "size": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "storageId",
                            "name",
                            "contentType",
                            "size"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "expectedRevision",
                  "patch"
                ]
              },
              "example": {
                "expectedRevision": 0,
                "patch": {}
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "kind": {
                      "type": "string",
                      "const": "email"
                    },
                    "draftId": {
                      "type": "string"
                    },
                    "syncStatus": {
                      "type": "string"
                    },
                    "revision": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "ok",
                    "kind",
                    "draftId",
                    "syncStatus",
                    "revision"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/drafts/senders": {
      "get": {
        "operationId": "email_drafts_senders",
        "tags": [
          "email"
        ],
        "summary": "List native mailboxes this caller may use",
        "description": "List native mailboxes this caller may use.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": {}
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/drafts/{draftId}/send": {
      "post": {
        "operationId": "email_drafts_send",
        "tags": [
          "email"
        ],
        "summary": "Send the current Dench draft revision through its native mailbox. Repeated requests share a durable receipt",
        "description": "Send the current Dench draft revision through its native mailbox. Repeated requests share a durable receipt.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "requestId": {
                    "type": "string"
                  }
                },
                "required": [
                  "expectedRevision"
                ]
              },
              "example": {
                "expectedRevision": 0
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "kind": {
                      "type": "string",
                      "const": "email"
                    },
                    "draftId": {
                      "type": "string"
                    },
                    "syncStatus": {
                      "type": "string"
                    },
                    "revision": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "ok",
                    "kind",
                    "draftId",
                    "syncStatus",
                    "revision"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/drafts/{draftId}/attachments": {
      "post": {
        "operationId": "email_drafts_upload",
        "tags": [
          "email"
        ],
        "summary": "Upload attachment bytes authorized against this draft before adding its storage reference",
        "description": "Upload attachment bytes authorized against this draft before adding its storage reference.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "contentType": {
                    "type": "string"
                  },
                  "contentBase64": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "contentType",
                  "contentBase64"
                ]
              },
              "example": {
                "name": "string",
                "contentType": "string",
                "contentBase64": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "storageId": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "contentType": {
                      "type": "string"
                    },
                    "size": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "storageId",
                    "name",
                    "contentType",
                    "size"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/drafts/{draftId}/signature": {
      "get": {
        "operationId": "email_drafts_signature",
        "tags": [
          "email"
        ],
        "summary": "Load the selected mailbox signature for explicit visible insertion",
        "description": "Load the selected mailbox signature for explicit visible insertion.",
        "parameters": [
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/native/send": {
      "post": {
        "operationId": "email_native_send",
        "tags": [
          "email"
        ],
        "summary": "Send through a native Gmail or Outlook mailbox with a durable request receipt. Only use for an explicit send request",
        "description": "Send through a native Gmail or Outlook mailbox with a durable request receipt. Only use for an explicit send request.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "organizationId": {
                    "type": "string"
                  },
                  "threadId": {
                    "type": "string"
                  },
                  "mailbox": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  },
                  "to": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "email"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "cc": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "email"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "bcc": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "email"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "subject": {
                    "type": "string"
                  },
                  "htmlBody": {
                    "type": "string"
                  },
                  "textBody": {
                    "type": "string"
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "storageId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "contentType": {
                          "type": "string"
                        },
                        "size": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "storageId",
                        "name",
                        "contentType",
                        "size"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "requestId",
                  "to"
                ]
              },
              "example": {
                "requestId": "send-intro-001",
                "to": [
                  {
                    "email": "ada@example.com",
                    "name": "Ada"
                  }
                ],
                "subject": "Introduction",
                "textBody": "Hello Ada"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "kind": {
                      "type": "string",
                      "const": "email"
                    },
                    "draftId": {
                      "type": "string"
                    },
                    "syncStatus": {
                      "type": "string"
                    },
                    "revision": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "ok",
                    "kind",
                    "draftId",
                    "syncStatus",
                    "revision"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/send": {
      "post": {
        "operationId": "email_send",
        "tags": [
          "email"
        ],
        "summary": "Send email",
        "description": "Send one raw email (no campaign): to/cc/bcc, custom from-name and reply-to, optional reply threading via replyToMessageId.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fromEmail": {
                    "type": "string",
                    "description": "Verified sender mailbox."
                  },
                  "fromName": {
                    "description": "Display name override.",
                    "type": "string"
                  },
                  "to": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string",
                          "description": "Recipient email address."
                        },
                        "name": {
                          "description": "Optional display name.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "email"
                      ],
                      "additionalProperties": false
                    },
                    "description": "Primary recipients. to+cc+bcc is capped at 50."
                  },
                  "cc": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string",
                          "description": "Recipient email address."
                        },
                        "name": {
                          "description": "Optional display name.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "email"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "bcc": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string",
                          "description": "Recipient email address."
                        },
                        "name": {
                          "description": "Optional display name.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "email"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "replyToEmail": {
                    "type": "string"
                  },
                  "subject": {
                    "type": "string"
                  },
                  "htmlBody": {
                    "description": "HTML body. Provide htmlBody and/or textBody.",
                    "type": "string"
                  },
                  "textBody": {
                    "type": "string"
                  },
                  "replyToMessageId": {
                    "description": "Dench messageId or RFC 5322 Message-ID to thread this send as a reply.",
                    "type": "string"
                  },
                  "configurationSetName": {
                    "type": "string"
                  }
                },
                "required": [
                  "fromEmail",
                  "to",
                  "subject"
                ]
              },
              "example": {
                "fromEmail": "founder@example.com",
                "to": [
                  {
                    "email": "ada@lovelace.dev",
                    "name": "Ada"
                  }
                ],
                "subject": "Quick intro",
                "htmlBody": "<p>Hi Ada — great meeting you!</p>"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "messageId": {
                      "type": "string",
                      "description": "Dench message id for `dench email message status`."
                    },
                    "providerMessageId": {
                      "type": "string"
                    },
                    "rfcMessageId": {
                      "description": "RFC 5322 Message-ID usable for reply threading.",
                      "type": "string"
                    },
                    "recipients": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string",
                      "const": "sent"
                    },
                    "inReplyTo": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "messageId",
                    "providerMessageId",
                    "recipients",
                    "status",
                    "message"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "messageId": "emsg_abc123",
                  "providerMessageId": "0100018abc-provider-id",
                  "rfcMessageId": "<0100018abc@email.amazonses.com>",
                  "recipients": 1,
                  "status": "sent",
                  "message": "Email sent. Track opens/clicks with `dench email message status`."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/messages/{messageId}": {
      "get": {
        "operationId": "email_message_get",
        "tags": [
          "email"
        ],
        "summary": "Message status",
        "description": "Read a raw email message's status and open/click counters.",
        "parameters": [
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Raw email message id."
            },
            "description": "Raw email message id."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "messageId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "sent",
                        "failed",
                        "delivered",
                        "opened",
                        "clicked",
                        "bounced",
                        "complained"
                      ],
                      "description": "Raw email message lifecycle status."
                    },
                    "fromEmail": {
                      "type": "string"
                    },
                    "fromName": {
                      "type": "string"
                    },
                    "to": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": "string",
                            "description": "Recipient email address."
                          },
                          "name": {
                            "description": "Optional display name.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "email"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "cc": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": "string",
                            "description": "Recipient email address."
                          },
                          "name": {
                            "description": "Optional display name.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "email"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "bcc": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": "string",
                            "description": "Recipient email address."
                          },
                          "name": {
                            "description": "Optional display name.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "email"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "subject": {
                      "type": "string"
                    },
                    "inReplyTo": {
                      "type": "string"
                    },
                    "references": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "providerMessageId": {
                      "type": "string"
                    },
                    "rfcMessageId": {
                      "type": "string"
                    },
                    "recipientCount": {
                      "type": "number"
                    },
                    "openCount": {
                      "type": "number"
                    },
                    "clickCount": {
                      "type": "number"
                    },
                    "sentAt": {
                      "type": "number"
                    },
                    "deliveredAt": {
                      "type": "number"
                    },
                    "firstOpenedAt": {
                      "type": "number"
                    },
                    "lastOpenedAt": {
                      "type": "number"
                    },
                    "firstClickedAt": {
                      "type": "number"
                    },
                    "bouncedAt": {
                      "type": "number"
                    },
                    "complainedAt": {
                      "type": "number"
                    },
                    "lastError": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "messageId",
                    "status",
                    "fromEmail",
                    "to",
                    "subject",
                    "recipientCount",
                    "openCount",
                    "clickCount",
                    "createdAt"
                  ],
                  "additionalProperties": false,
                  "description": "A raw email message with delivery + engagement counters."
                },
                "example": {
                  "messageId": "emsg_abc123",
                  "status": "opened",
                  "fromEmail": "founder@example.com",
                  "to": [
                    {
                      "email": "ada@lovelace.dev",
                      "name": "Ada"
                    }
                  ],
                  "subject": "Quick intro",
                  "providerMessageId": "0100018abc-provider-id",
                  "rfcMessageId": "<0100018abc@email.amazonses.com>",
                  "recipientCount": 1,
                  "openCount": 2,
                  "clickCount": 1,
                  "sentAt": 1765526400000,
                  "deliveredAt": 1765526410000,
                  "firstOpenedAt": 1765529700000,
                  "createdAt": 1765526395000
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/messages": {
      "get": {
        "operationId": "email_message_list",
        "tags": [
          "email"
        ],
        "summary": "List messages",
        "description": "List recent raw email messages for the workspace.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "sent",
                "failed",
                "delivered",
                "opened",
                "clicked",
                "bounced",
                "complained"
              ],
              "description": "Raw email message lifecycle status."
            },
            "description": "Raw email message lifecycle status."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "messageId": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "queued",
                          "sent",
                          "failed",
                          "delivered",
                          "opened",
                          "clicked",
                          "bounced",
                          "complained"
                        ],
                        "description": "Raw email message lifecycle status."
                      },
                      "fromEmail": {
                        "type": "string"
                      },
                      "fromName": {
                        "type": "string"
                      },
                      "to": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string",
                              "description": "Recipient email address."
                            },
                            "name": {
                              "description": "Optional display name.",
                              "type": "string"
                            }
                          },
                          "required": [
                            "email"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "cc": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string",
                              "description": "Recipient email address."
                            },
                            "name": {
                              "description": "Optional display name.",
                              "type": "string"
                            }
                          },
                          "required": [
                            "email"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "bcc": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string",
                              "description": "Recipient email address."
                            },
                            "name": {
                              "description": "Optional display name.",
                              "type": "string"
                            }
                          },
                          "required": [
                            "email"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "subject": {
                        "type": "string"
                      },
                      "inReplyTo": {
                        "type": "string"
                      },
                      "references": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "providerMessageId": {
                        "type": "string"
                      },
                      "rfcMessageId": {
                        "type": "string"
                      },
                      "recipientCount": {
                        "type": "number"
                      },
                      "openCount": {
                        "type": "number"
                      },
                      "clickCount": {
                        "type": "number"
                      },
                      "sentAt": {
                        "type": "number"
                      },
                      "deliveredAt": {
                        "type": "number"
                      },
                      "firstOpenedAt": {
                        "type": "number"
                      },
                      "lastOpenedAt": {
                        "type": "number"
                      },
                      "firstClickedAt": {
                        "type": "number"
                      },
                      "bouncedAt": {
                        "type": "number"
                      },
                      "complainedAt": {
                        "type": "number"
                      },
                      "lastError": {
                        "type": "string"
                      },
                      "createdAt": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "messageId",
                      "status",
                      "fromEmail",
                      "to",
                      "subject",
                      "recipientCount",
                      "openCount",
                      "clickCount",
                      "createdAt"
                    ],
                    "additionalProperties": false,
                    "description": "A raw email message with delivery + engagement counters."
                  }
                },
                "example": [
                  {
                    "messageId": "emsg_abc123",
                    "status": "sent",
                    "fromEmail": "founder@example.com",
                    "to": [
                      {
                        "email": "ada@lovelace.dev"
                      }
                    ],
                    "subject": "Quick intro",
                    "recipientCount": 1,
                    "openCount": 0,
                    "clickCount": 0,
                    "sentAt": 1765526400000,
                    "createdAt": 1765526395000
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/templates": {
      "post": {
        "operationId": "email_template_create",
        "tags": [
          "email"
        ],
        "summary": "Create template",
        "description": "Create a managed email campaign template.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "subject": {
                    "type": "string",
                    "description": "Supports {{variable}} placeholders."
                  },
                  "htmlBody": {
                    "type": "string",
                    "description": "HTML body with {{variable}} placeholders."
                  },
                  "textBody": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "active",
                      "archived"
                    ],
                    "description": "Template lifecycle status. Defaults to `active`."
                  }
                },
                "required": [
                  "name",
                  "subject",
                  "htmlBody"
                ]
              },
              "example": {
                "name": "Intro outreach",
                "subject": "Hi {{firstName}}",
                "htmlBody": "<p>Hi {{firstName}}, saw your work at {{company}}.</p>"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "templateId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "templateId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "templateId": "etpl_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/templates/{templateId}/preview": {
      "post": {
        "operationId": "email_template_preview",
        "tags": [
          "email"
        ],
        "summary": "Preview template",
        "description": "Preview a managed email campaign template.",
        "parameters": [
          {
            "name": "templateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "description": "Personalization data for {{variable}} placeholders.",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                }
              },
              "example": {
                "data": {
                  "firstName": "Ada",
                  "company": "Lovelace Labs"
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "subject": {
                      "type": "string"
                    },
                    "htmlBody": {
                      "type": "string"
                    },
                    "textBody": {
                      "type": "string"
                    },
                    "variableNames": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "subject",
                    "htmlBody",
                    "variableNames"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "subject": "Hi Ada",
                  "htmlBody": "<p>Hi Ada, saw your work at Lovelace Labs.</p>",
                  "variableNames": [
                    "company",
                    "firstName"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/campaigns": {
      "post": {
        "operationId": "email_campaign_create",
        "tags": [
          "email"
        ],
        "summary": "Create campaign",
        "description": "Create a managed email campaign draft from a connected inbox or verified sender.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "identityId": {
                    "type": "string",
                    "description": "Sending identity id OR a verified from-email."
                  },
                  "templateId": {
                    "type": "string"
                  },
                  "scheduledAt": {
                    "description": "Epoch ms to start sending; omit to send on submit.",
                    "type": "number"
                  },
                  "maxRecipients": {
                    "type": "number"
                  },
                  "batchSize": {
                    "type": "number"
                  },
                  "metadata": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "name",
                  "identityId",
                  "templateId"
                ]
              },
              "example": {
                "name": "Q2 outreach",
                "identityId": "founder@example.com",
                "templateId": "etpl_abc123"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaignId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "campaignId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "campaignId": "ecmp_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "get": {
        "operationId": "email_campaign_list",
        "tags": [
          "email"
        ],
        "summary": "List managed email campaigns (paginated, optional status filter)",
        "description": "List managed email campaigns (paginated, optional status filter).",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/campaigns/{campaignId}": {
      "get": {
        "operationId": "email_campaign_get",
        "tags": [
          "email"
        ],
        "summary": "Campaign status",
        "description": "Read campaign status and counters.",
        "parameters": [
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "_creationTime": {
                      "type": "number"
                    },
                    "organizationId": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "pending_approval",
                        "scheduled",
                        "sending",
                        "paused",
                        "completed",
                        "cancelled",
                        "failed"
                      ],
                      "description": "Campaign lifecycle status."
                    },
                    "sendingIdentityId": {
                      "type": "string"
                    },
                    "templateId": {
                      "type": "string"
                    },
                    "subjectSnapshot": {
                      "type": "string"
                    },
                    "htmlSnapshot": {
                      "type": "string"
                    },
                    "textSnapshot": {
                      "type": "string"
                    },
                    "fromEmailSnapshot": {
                      "type": "string"
                    },
                    "fromNameSnapshot": {
                      "type": "string"
                    },
                    "replyToEmailSnapshot": {
                      "type": "string"
                    },
                    "scheduledAt": {
                      "type": "number"
                    },
                    "submittedAt": {
                      "type": "number"
                    },
                    "startedAt": {
                      "type": "number"
                    },
                    "completedAt": {
                      "type": "number"
                    },
                    "cancelledAt": {
                      "type": "number"
                    },
                    "createdBy": {
                      "type": "string"
                    },
                    "totalRecipients": {
                      "type": "number"
                    },
                    "queuedCount": {
                      "type": "number"
                    },
                    "sendingCount": {
                      "type": "number"
                    },
                    "sentCount": {
                      "type": "number"
                    },
                    "deliveredCount": {
                      "type": "number"
                    },
                    "openedCount": {
                      "type": "number"
                    },
                    "clickedCount": {
                      "type": "number"
                    },
                    "bouncedCount": {
                      "type": "number"
                    },
                    "complainedCount": {
                      "type": "number"
                    },
                    "failedCount": {
                      "type": "number"
                    },
                    "suppressedCount": {
                      "type": "number"
                    },
                    "unsubscribedCount": {
                      "type": "number"
                    },
                    "maxRecipients": {
                      "type": "number"
                    },
                    "batchSize": {
                      "type": "number"
                    },
                    "lastError": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "number"
                    },
                    "updatedAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "_id",
                    "_creationTime",
                    "organizationId",
                    "name",
                    "status",
                    "sendingIdentityId",
                    "templateId",
                    "subjectSnapshot",
                    "htmlSnapshot",
                    "fromEmailSnapshot",
                    "createdBy",
                    "totalRecipients",
                    "queuedCount",
                    "sendingCount",
                    "sentCount",
                    "deliveredCount",
                    "openedCount",
                    "clickedCount",
                    "bouncedCount",
                    "complainedCount",
                    "failedCount",
                    "suppressedCount",
                    "unsubscribedCount",
                    "maxRecipients",
                    "batchSize",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": {},
                  "description": "The full campaign document with counters."
                },
                "example": {
                  "_id": "ecmp_abc123",
                  "_creationTime": 1765526395000,
                  "organizationId": "org_abc123",
                  "name": "Q2 outreach",
                  "status": "sending",
                  "sendingIdentityId": "esi_abc123",
                  "templateId": "etpl_abc123",
                  "subjectSnapshot": "Hi {{firstName}}",
                  "htmlSnapshot": "<p>Hi {{firstName}}, saw your work at {{company}}.</p>",
                  "fromEmailSnapshot": "founder@example.com",
                  "createdBy": "user:us_xyz789",
                  "totalRecipients": 120,
                  "queuedCount": 70,
                  "sendingCount": 0,
                  "sentCount": 50,
                  "deliveredCount": 48,
                  "openedCount": 12,
                  "clickedCount": 3,
                  "bouncedCount": 1,
                  "complainedCount": 0,
                  "failedCount": 0,
                  "suppressedCount": 2,
                  "unsubscribedCount": 0,
                  "maxRecipients": 0,
                  "batchSize": 50,
                  "createdAt": 1765526395000,
                  "updatedAt": 1765526460000
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/campaigns/{campaignId}/recipients": {
      "post": {
        "operationId": "email_campaign_recipients_add",
        "tags": [
          "email"
        ],
        "summary": "Add recipients",
        "description": "Add recipients to a managed email campaign.",
        "parameters": [
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipients": {
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string",
                          "description": "Recipient email address."
                        },
                        "displayName": {
                          "type": "string"
                        },
                        "personEntryId": {
                          "description": "Optional CRM people entry to link the send to.",
                          "type": "string"
                        },
                        "companyEntryId": {
                          "type": "string"
                        },
                        "personalization": {
                          "description": "Values for {{variable}} placeholders in the template.",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        }
                      },
                      "required": [
                        "email"
                      ],
                      "additionalProperties": false
                    },
                    "description": "Up to 500 recipients per call."
                  }
                },
                "required": [
                  "recipients"
                ]
              },
              "example": {
                "recipients": [
                  {
                    "email": "ada@lovelace.dev",
                    "displayName": "Ada Lovelace",
                    "personalization": {
                      "firstName": "Ada",
                      "company": "Lovelace Labs"
                    }
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "added": {
                      "type": "number"
                    },
                    "duplicates": {
                      "type": "number"
                    },
                    "suppressed": {
                      "type": "number"
                    },
                    "invalid": {
                      "type": "number"
                    },
                    "totalRecipients": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "added",
                    "duplicates",
                    "suppressed",
                    "invalid",
                    "totalRecipients"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "added": 47,
                  "duplicates": 2,
                  "suppressed": 1,
                  "invalid": 0,
                  "totalRecipients": 120
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "get": {
        "operationId": "email_campaign_recipients_list",
        "tags": [
          "email"
        ],
        "summary": "List a campaign's recipients (paginated, optional status filter)",
        "description": "List a campaign's recipients (paginated, optional status filter).",
        "parameters": [
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includePeople",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Default true: attach each recipient's CRM record.",
              "type": "boolean"
            },
            "description": "Default true: attach each recipient's CRM record."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/campaigns/{campaignId}/preview": {
      "post": {
        "operationId": "email_campaign_preview",
        "tags": [
          "email"
        ],
        "summary": "Preview campaign",
        "description": "Preview rendered messages for a campaign sample.",
        "parameters": [
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sample": {
                    "description": "Number of rendered previews to return (default 5).",
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                }
              },
              "example": {
                "sample": 5
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaignId": {
                      "type": "string"
                    },
                    "previews": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "recipientId": {
                            "type": "string"
                          },
                          "to": {
                            "type": "string"
                          },
                          "subject": {
                            "type": "string"
                          },
                          "htmlBody": {
                            "type": "string"
                          },
                          "textBody": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "recipientId",
                          "to",
                          "subject",
                          "htmlBody"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "campaignId",
                    "previews"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "campaignId": "ecmp_abc123",
                  "previews": [
                    {
                      "recipientId": "ecr_abc123",
                      "to": "ada@lovelace.dev",
                      "subject": "Hi Ada",
                      "htmlBody": "<p>Hi Ada, saw your work at Lovelace Labs.</p>"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/campaigns/{campaignId}/submit": {
      "post": {
        "operationId": "email_campaign_submit",
        "tags": [
          "email"
        ],
        "summary": "Submit campaign",
        "description": "Submit a campaign for approval or sending.",
        "parameters": [
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "approvalId": {
                    "description": "Approval request id when workspace policy requires human sign-off.",
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "summary": {
                      "type": "object",
                      "properties": {
                        "campaignId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "draft",
                            "pending_approval",
                            "scheduled",
                            "sending",
                            "paused",
                            "completed",
                            "cancelled",
                            "failed"
                          ],
                          "description": "Campaign lifecycle status."
                        },
                        "totalRecipients": {
                          "type": "number"
                        },
                        "queuedCount": {
                          "type": "number"
                        },
                        "sendingCount": {
                          "type": "number"
                        },
                        "sentCount": {
                          "type": "number"
                        },
                        "deliveredCount": {
                          "type": "number"
                        },
                        "openedCount": {
                          "type": "number"
                        },
                        "clickedCount": {
                          "type": "number"
                        },
                        "bouncedCount": {
                          "type": "number"
                        },
                        "complainedCount": {
                          "type": "number"
                        },
                        "failedCount": {
                          "type": "number"
                        },
                        "suppressedCount": {
                          "type": "number"
                        },
                        "unsubscribedCount": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "campaignId",
                        "status",
                        "totalRecipients",
                        "queuedCount",
                        "sendingCount",
                        "sentCount",
                        "deliveredCount",
                        "openedCount",
                        "clickedCount",
                        "bouncedCount",
                        "complainedCount",
                        "failedCount",
                        "suppressedCount",
                        "unsubscribedCount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "summary"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "summary": {
                    "campaignId": "ecmp_abc123",
                    "status": "sending",
                    "totalRecipients": 120,
                    "queuedCount": 120,
                    "sendingCount": 0,
                    "sentCount": 0,
                    "deliveredCount": 0,
                    "openedCount": 0,
                    "clickedCount": 0,
                    "bouncedCount": 0,
                    "complainedCount": 0,
                    "failedCount": 0,
                    "suppressedCount": 2,
                    "unsubscribedCount": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/campaigns/{campaignId}/pause": {
      "post": {
        "operationId": "email_campaign_pause",
        "tags": [
          "email"
        ],
        "summary": "Pause campaign",
        "description": "Pause a sending email campaign.",
        "parameters": [
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaignId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "pending_approval",
                        "scheduled",
                        "sending",
                        "paused",
                        "completed",
                        "cancelled",
                        "failed"
                      ],
                      "description": "Campaign lifecycle status."
                    },
                    "totalRecipients": {
                      "type": "number"
                    },
                    "queuedCount": {
                      "type": "number"
                    },
                    "sendingCount": {
                      "type": "number"
                    },
                    "sentCount": {
                      "type": "number"
                    },
                    "deliveredCount": {
                      "type": "number"
                    },
                    "openedCount": {
                      "type": "number"
                    },
                    "clickedCount": {
                      "type": "number"
                    },
                    "bouncedCount": {
                      "type": "number"
                    },
                    "complainedCount": {
                      "type": "number"
                    },
                    "failedCount": {
                      "type": "number"
                    },
                    "suppressedCount": {
                      "type": "number"
                    },
                    "unsubscribedCount": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "campaignId",
                    "status",
                    "totalRecipients",
                    "queuedCount",
                    "sendingCount",
                    "sentCount",
                    "deliveredCount",
                    "openedCount",
                    "clickedCount",
                    "bouncedCount",
                    "complainedCount",
                    "failedCount",
                    "suppressedCount",
                    "unsubscribedCount"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "campaignId": "ecmp_abc123",
                  "status": "paused",
                  "totalRecipients": 120,
                  "queuedCount": 70,
                  "sendingCount": 0,
                  "sentCount": 50,
                  "deliveredCount": 48,
                  "openedCount": 12,
                  "clickedCount": 3,
                  "bouncedCount": 1,
                  "complainedCount": 0,
                  "failedCount": 0,
                  "suppressedCount": 2,
                  "unsubscribedCount": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/campaigns/{campaignId}/resume": {
      "post": {
        "operationId": "email_campaign_resume",
        "tags": [
          "email"
        ],
        "summary": "Resume campaign",
        "description": "Resume a paused email campaign.",
        "parameters": [
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaignId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "pending_approval",
                        "scheduled",
                        "sending",
                        "paused",
                        "completed",
                        "cancelled",
                        "failed"
                      ],
                      "description": "Campaign lifecycle status."
                    },
                    "totalRecipients": {
                      "type": "number"
                    },
                    "queuedCount": {
                      "type": "number"
                    },
                    "sendingCount": {
                      "type": "number"
                    },
                    "sentCount": {
                      "type": "number"
                    },
                    "deliveredCount": {
                      "type": "number"
                    },
                    "openedCount": {
                      "type": "number"
                    },
                    "clickedCount": {
                      "type": "number"
                    },
                    "bouncedCount": {
                      "type": "number"
                    },
                    "complainedCount": {
                      "type": "number"
                    },
                    "failedCount": {
                      "type": "number"
                    },
                    "suppressedCount": {
                      "type": "number"
                    },
                    "unsubscribedCount": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "campaignId",
                    "status",
                    "totalRecipients",
                    "queuedCount",
                    "sendingCount",
                    "sentCount",
                    "deliveredCount",
                    "openedCount",
                    "clickedCount",
                    "bouncedCount",
                    "complainedCount",
                    "failedCount",
                    "suppressedCount",
                    "unsubscribedCount"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "campaignId": "ecmp_abc123",
                  "status": "sending",
                  "totalRecipients": 120,
                  "queuedCount": 70,
                  "sendingCount": 0,
                  "sentCount": 50,
                  "deliveredCount": 48,
                  "openedCount": 12,
                  "clickedCount": 3,
                  "bouncedCount": 1,
                  "complainedCount": 0,
                  "failedCount": 0,
                  "suppressedCount": 2,
                  "unsubscribedCount": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/campaigns/{campaignId}/cancel": {
      "post": {
        "operationId": "email_campaign_cancel",
        "tags": [
          "email"
        ],
        "summary": "Cancel campaign",
        "description": "Cancel an email campaign.",
        "parameters": [
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaignId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "pending_approval",
                        "scheduled",
                        "sending",
                        "paused",
                        "completed",
                        "cancelled",
                        "failed"
                      ],
                      "description": "Campaign lifecycle status."
                    },
                    "totalRecipients": {
                      "type": "number"
                    },
                    "queuedCount": {
                      "type": "number"
                    },
                    "sendingCount": {
                      "type": "number"
                    },
                    "sentCount": {
                      "type": "number"
                    },
                    "deliveredCount": {
                      "type": "number"
                    },
                    "openedCount": {
                      "type": "number"
                    },
                    "clickedCount": {
                      "type": "number"
                    },
                    "bouncedCount": {
                      "type": "number"
                    },
                    "complainedCount": {
                      "type": "number"
                    },
                    "failedCount": {
                      "type": "number"
                    },
                    "suppressedCount": {
                      "type": "number"
                    },
                    "unsubscribedCount": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "campaignId",
                    "status",
                    "totalRecipients",
                    "queuedCount",
                    "sendingCount",
                    "sentCount",
                    "deliveredCount",
                    "openedCount",
                    "clickedCount",
                    "bouncedCount",
                    "complainedCount",
                    "failedCount",
                    "suppressedCount",
                    "unsubscribedCount"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "campaignId": "ecmp_abc123",
                  "status": "cancelled",
                  "totalRecipients": 120,
                  "queuedCount": 70,
                  "sendingCount": 0,
                  "sentCount": 50,
                  "deliveredCount": 48,
                  "openedCount": 12,
                  "clickedCount": 3,
                  "bouncedCount": 1,
                  "complainedCount": 0,
                  "failedCount": 0,
                  "suppressedCount": 2,
                  "unsubscribedCount": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/campaigns/{campaignId}/recipients/from-object": {
      "post": {
        "operationId": "email_campaign_recipients_addFromObject",
        "tags": [
          "email"
        ],
        "summary": "Add campaign recipients from a CRM object: pick the object, the email field, and the entry ids",
        "description": "Add campaign recipients from a CRM object: pick the object, the email field, and the entry ids.",
        "parameters": [
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences": {
      "post": {
        "operationId": "email_sequence_create",
        "tags": [
          "email"
        ],
        "summary": "Create a follow-up sequence from a connected inbox or verified sender",
        "description": "Create a follow-up sequence from a connected inbox or verified sender.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "get": {
        "operationId": "email_sequence_list",
        "tags": [
          "email"
        ],
        "summary": "List the workspace's follow-up sequences",
        "description": "List the workspace's follow-up sequences.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/{sequenceId}": {
      "post": {
        "operationId": "email_sequence_update",
        "tags": [
          "email"
        ],
        "summary": "Update a sequence's name, sender, or reply/stop settings",
        "description": "Update a sequence's name, sender, or reply/stop settings.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "get": {
        "operationId": "email_sequence_get",
        "tags": [
          "email"
        ],
        "summary": "Read a sequence with its ordered steps",
        "description": "Read a sequence with its ordered steps.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/{sequenceId}/activate": {
      "post": {
        "operationId": "email_sequence_activate",
        "tags": [
          "email"
        ],
        "summary": "Activate a sequence so its enrollments begin sending",
        "description": "Activate a sequence so its enrollments begin sending.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/{sequenceId}/deactivate": {
      "post": {
        "operationId": "email_sequence_deactivate",
        "tags": [
          "email"
        ],
        "summary": "Deactivate a sequence (pause sending, revert to draft)",
        "description": "Deactivate a sequence (pause sending, revert to draft).",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/{sequenceId}/archive": {
      "post": {
        "operationId": "email_sequence_archive",
        "tags": [
          "email"
        ],
        "summary": "Archive a sequence (stops all sending)",
        "description": "Archive a sequence (stops all sending).",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/{sequenceId}/steps": {
      "post": {
        "operationId": "email_sequence_step_add",
        "tags": [
          "email"
        ],
        "summary": "Add a step (subject, body, and wait delay) to a sequence",
        "description": "Add a step (subject, body, and wait delay) to a sequence.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/steps/{stepId}": {
      "post": {
        "operationId": "email_sequence_step_update",
        "tags": [
          "email"
        ],
        "summary": "Update a sequence step's subject, body, or delay",
        "description": "Update a sequence step's subject, body, or delay.",
        "parameters": [
          {
            "name": "stepId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/steps/{stepId}/remove": {
      "post": {
        "operationId": "email_sequence_step_remove",
        "tags": [
          "email"
        ],
        "summary": "Remove a step from a sequence",
        "description": "Remove a step from a sequence.",
        "parameters": [
          {
            "name": "stepId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/{sequenceId}/steps/reorder": {
      "post": {
        "operationId": "email_sequence_step_reorder",
        "tags": [
          "email"
        ],
        "summary": "Reorder a sequence's steps",
        "description": "Reorder a sequence's steps.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/{sequenceId}/enroll": {
      "post": {
        "operationId": "email_sequence_enroll",
        "tags": [
          "email"
        ],
        "summary": "Enroll explicit recipients into a sequence",
        "description": "Enroll explicit recipients into a sequence.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/{sequenceId}/enroll/from-object": {
      "post": {
        "operationId": "email_sequence_enrollFromObject",
        "tags": [
          "email"
        ],
        "summary": "Enroll people from a CRM object: pick the object, the email field, and the entry ids",
        "description": "Enroll people from a CRM object: pick the object, the email field, and the entry ids.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/{sequenceId}/enrollments": {
      "get": {
        "operationId": "email_sequence_enrollments_list",
        "tags": [
          "email"
        ],
        "summary": "List a sequence's enrollments (paginated, optional status filter)",
        "description": "List a sequence's enrollments (paginated, optional status filter).",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/enrollments/{enrollmentId}/pause": {
      "post": {
        "operationId": "email_sequence_enrollment_pause",
        "tags": [
          "email"
        ],
        "summary": "Pause one enrollment",
        "description": "Pause one enrollment.",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/enrollments/{enrollmentId}/resume": {
      "post": {
        "operationId": "email_sequence_enrollment_resume",
        "tags": [
          "email"
        ],
        "summary": "Resume one paused enrollment",
        "description": "Resume one paused enrollment.",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/email/sequences/enrollments/{enrollmentId}/stop": {
      "post": {
        "operationId": "email_sequence_enrollment_stop",
        "tags": [
          "email"
        ],
        "summary": "Stop one enrollment (no further steps send)",
        "description": "Stop one enrollment (no further steps send).",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/accounts/linkedin": {
      "get": {
        "operationId": "campaigns_accounts_linkedin",
        "tags": [
          "campaigns"
        ],
        "summary": "Discover LinkedIn sender ids, labels, availability and remaining capacity visible to the acting workspace member. Never returns provider credentials",
        "description": "Discover LinkedIn sender ids, labels, availability and remaining capacity visible to the acting workspace member. Never returns provider credentials.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "linkedinAccountId": {
                        "type": "string",
                        "description": "Local sender id for linkedinAccountIds, never a provider credential."
                      },
                      "displayName": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "running",
                          "paused",
                          "disconnected",
                          "errored"
                        ]
                      },
                      "ownerName": {
                        "type": "string"
                      },
                      "isOwner": {
                        "type": "boolean"
                      },
                      "visibility": {
                        "type": "string",
                        "enum": [
                          "private",
                          "shared"
                        ]
                      },
                      "remainingToday": {
                        "type": "object",
                        "properties": {
                          "invites": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Daily capacity, also bounded by the rolling weekly invite limit."
                          },
                          "messages": {
                            "type": "number",
                            "minimum": 0
                          },
                          "profiles": {
                            "type": "number",
                            "minimum": 0
                          }
                        },
                        "required": [
                          "invites",
                          "messages",
                          "profiles"
                        ],
                        "additionalProperties": false
                      },
                      "remainingInvitesThisWeek": {
                        "type": "number",
                        "minimum": 0
                      },
                      "availability": {
                        "type": "string",
                        "enum": [
                          "ready",
                          "paused",
                          "disconnected",
                          "errored",
                          "disabled",
                          "circuit_break",
                          "spacing",
                          "outside_window",
                          "daily_cap"
                        ],
                        "description": "Account availability snapshot. Queued work, campaign limits and launch/dispatch checks still apply."
                      }
                    },
                    "required": [
                      "linkedinAccountId",
                      "displayName",
                      "status",
                      "ownerName",
                      "isOwner",
                      "visibility",
                      "remainingToday",
                      "remainingInvitesThisWeek",
                      "availability"
                    ],
                    "additionalProperties": false
                  }
                },
                "example": [
                  {
                    "linkedinAccountId": "<linkedinAccountId>",
                    "displayName": "Ada Lovelace",
                    "status": "running",
                    "ownerName": "Ada",
                    "isOwner": true,
                    "visibility": "private",
                    "remainingToday": {
                      "invites": 12,
                      "messages": 36,
                      "profiles": 40
                    },
                    "remainingInvitesThisWeek": 50,
                    "availability": "ready"
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/accounts/email": {
      "get": {
        "operationId": "campaigns_accounts_email",
        "tags": [
          "campaigns"
        ],
        "summary": "Discover the mailboxes the acting workspace member can send campaign email from: ids for emailMailboxAccountIds, status, warm-up state and when it is done, the daily cold-email cap and what is left today. Never returns provider credentials",
        "description": "Discover the mailboxes the acting workspace member can send campaign email from: ids for emailMailboxAccountIds, status, warm-up state and when it is done, the daily cold-email cap and what is left today. Never returns provider credentials.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "description": "The emailMailboxAccountId to put in emailMailboxAccountIds."
                      },
                      "email": {
                        "type": "string"
                      },
                      "provider": {
                        "type": "string",
                        "enum": [
                          "gmail",
                          "outlook"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "running",
                          "disconnected",
                          "errored"
                        ]
                      },
                      "statusReason": {
                        "type": "string"
                      },
                      "warmupStatus": {
                        "type": "string",
                        "enum": [
                          "skipped",
                          "pending_auth",
                          "warming",
                          "ready",
                          "error"
                        ],
                        "description": "ready or skipped: sends at its cap. warming: sends less until readyAt. pending_auth and error need the owner in the app."
                      },
                      "readyAt": {
                        "description": "When warm-up finished, or is expected to finish while warming (epoch ms).",
                        "type": "number"
                      },
                      "dailyColdSendCap": {
                        "type": "number",
                        "description": "The most cold emails a day; the mailbox owner sets it in the app."
                      },
                      "remainingToday": {
                        "type": "number",
                        "description": "Cold emails it can still send today."
                      },
                      "ownerName": {
                        "type": "string"
                      },
                      "isOwner": {
                        "type": "boolean"
                      },
                      "visibility": {
                        "type": "string",
                        "enum": [
                          "private",
                          "shared"
                        ]
                      }
                    },
                    "required": [
                      "_id",
                      "email",
                      "provider",
                      "status",
                      "warmupStatus",
                      "dailyColdSendCap",
                      "remainingToday",
                      "ownerName",
                      "isOwner",
                      "visibility"
                    ],
                    "additionalProperties": {},
                    "description": "One mailbox a campaign can send from."
                  }
                },
                "example": [
                  {
                    "_id": "<emailMailboxAccountId>",
                    "email": "ada@example.com",
                    "provider": "gmail",
                    "status": "running",
                    "warmupStatus": "warming",
                    "readyAt": 1765526400000,
                    "dailyColdSendCap": 30,
                    "remainingToday": 12,
                    "ownerName": "Ada",
                    "isOwner": true,
                    "visibility": "shared"
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns": {
      "get": {
        "operationId": "campaigns_list",
        "tags": [
          "campaigns"
        ],
        "summary": "List outreach campaigns (archived ones on request)",
        "description": "List outreach campaigns (archived ones on request).",
        "parameters": [
          {
            "name": "withReferences",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields.",
              "type": "boolean"
            },
            "description": "Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields."
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Include archived campaigns.",
              "type": "boolean"
            },
            "description": "Include archived campaigns."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "active",
                              "paused",
                              "completed",
                              "archived"
                            ],
                            "description": "Campaign lifecycle status."
                          },
                          "stopOnReply": {
                            "type": "boolean"
                          },
                          "emailMailboxAccountIds": {
                            "description": "Campaign email sender pool: up to 50 emailMailboxAccounts ids both you and the campaign owner may use. Omit to preserve existing configuration; [] clears the pool. A person's sender stays fixed for their conversation. Launch validates sender availability.",
                            "maxItems": 50,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "linkedinAccountIds": {
                            "description": "Campaign LinkedIn sender pool: up to 50 linkedinAccounts ids both you and the campaign owner may use. Omit to preserve existing configuration; [] clears the pool. Legacy step senders remain until a pool is configured.",
                            "maxItems": 50,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "timezone": {
                            "type": "string"
                          },
                          "startsAt": {
                            "type": "number"
                          },
                          "endsAt": {
                            "type": "number"
                          },
                          "sendSchedules": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "description": "Label, e.g. \"Mon-Fri 9-18\"."
                                },
                                "timezone": {
                                  "type": "string",
                                  "description": "IANA timezone, e.g. America/Los_Angeles."
                                },
                                "startHour": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 23,
                                  "description": "First hour sends may go out (0-23)."
                                },
                                "endHour": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 24,
                                  "description": "Hour sends stop (1-24); must be after startHour."
                                },
                                "weekdays": {
                                  "minItems": 1,
                                  "type": "array",
                                  "items": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 6
                                  },
                                  "description": "Days sends may go out: 0 = Sunday ... 6 = Saturday."
                                }
                              },
                              "required": [
                                "name",
                                "timezone",
                                "startHour",
                                "endHour",
                                "weekdays"
                              ],
                              "additionalProperties": false,
                              "description": "One send window. A campaign has one to eight; the first one's timezone is the campaign's."
                            }
                          },
                          "dailySendCap": {
                            "type": "number"
                          },
                          "stepCount": {
                            "type": "number"
                          },
                          "stepModel": {
                            "type": "string",
                            "enum": [
                              "linear",
                              "workflow"
                            ],
                            "description": "linear: steps run in order. workflow: steps have keys and paths (next, yesNext, noNext) and may include condition and wait_for_connection. Left out, a workflow stays one and steps with keys, paths or those types make one; nothing turns a workflow back into a list."
                          },
                          "totalEnrolled": {
                            "type": "number"
                          },
                          "activeCount": {
                            "type": "number"
                          },
                          "pausedCount": {
                            "type": "number"
                          },
                          "finishedCount": {
                            "type": "number"
                          },
                          "repliedCount": {
                            "type": "number"
                          },
                          "failedCount": {
                            "type": "number"
                          },
                          "stoppedCount": {
                            "type": "number"
                          },
                          "launchedAt": {
                            "type": "number"
                          },
                          "ownerName": {
                            "type": "string"
                          },
                          "isOwner": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "_id",
                          "name",
                          "status",
                          "stopOnReply",
                          "stepCount",
                          "totalEnrolled",
                          "activeCount",
                          "pausedCount",
                          "finishedCount",
                          "repliedCount",
                          "failedCount",
                          "stoppedCount",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "draft",
                                  "active",
                                  "paused",
                                  "completed",
                                  "archived"
                                ],
                                "description": "Campaign lifecycle status."
                              },
                              "stopOnReply": {
                                "type": "boolean"
                              },
                              "emailMailboxAccountIds": {
                                "description": "Campaign email sender pool: up to 50 emailMailboxAccounts ids both you and the campaign owner may use. Omit to preserve existing configuration; [] clears the pool. A person's sender stays fixed for their conversation. Launch validates sender availability.",
                                "maxItems": 50,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "linkedinAccountIds": {
                                "description": "Campaign LinkedIn sender pool: up to 50 linkedinAccounts ids both you and the campaign owner may use. Omit to preserve existing configuration; [] clears the pool. Legacy step senders remain until a pool is configured.",
                                "maxItems": 50,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "timezone": {
                                "type": "string"
                              },
                              "startsAt": {
                                "type": "number"
                              },
                              "endsAt": {
                                "type": "number"
                              },
                              "sendSchedules": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "name": {
                                      "type": "string",
                                      "description": "Label, e.g. \"Mon-Fri 9-18\"."
                                    },
                                    "timezone": {
                                      "type": "string",
                                      "description": "IANA timezone, e.g. America/Los_Angeles."
                                    },
                                    "startHour": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 23,
                                      "description": "First hour sends may go out (0-23)."
                                    },
                                    "endHour": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 24,
                                      "description": "Hour sends stop (1-24); must be after startHour."
                                    },
                                    "weekdays": {
                                      "minItems": 1,
                                      "type": "array",
                                      "items": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 6
                                      },
                                      "description": "Days sends may go out: 0 = Sunday ... 6 = Saturday."
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "timezone",
                                    "startHour",
                                    "endHour",
                                    "weekdays"
                                  ],
                                  "additionalProperties": false,
                                  "description": "One send window. A campaign has one to eight; the first one's timezone is the campaign's."
                                }
                              },
                              "dailySendCap": {
                                "type": "number"
                              },
                              "stepCount": {
                                "type": "number"
                              },
                              "stepModel": {
                                "type": "string",
                                "enum": [
                                  "linear",
                                  "workflow"
                                ],
                                "description": "linear: steps run in order. workflow: steps have keys and paths (next, yesNext, noNext) and may include condition and wait_for_connection. Left out, a workflow stays one and steps with keys, paths or those types make one; nothing turns a workflow back into a list."
                              },
                              "totalEnrolled": {
                                "type": "number"
                              },
                              "activeCount": {
                                "type": "number"
                              },
                              "pausedCount": {
                                "type": "number"
                              },
                              "finishedCount": {
                                "type": "number"
                              },
                              "repliedCount": {
                                "type": "number"
                              },
                              "failedCount": {
                                "type": "number"
                              },
                              "stoppedCount": {
                                "type": "number"
                              },
                              "launchedAt": {
                                "type": "number"
                              },
                              "ownerName": {
                                "type": "string"
                              },
                              "isOwner": {
                                "type": "boolean"
                              },
                              "createdAt": {
                                "type": "number"
                              },
                              "updatedAt": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "_id",
                              "name",
                              "status",
                              "stopOnReply",
                              "stepCount",
                              "totalEnrolled",
                              "activeCount",
                              "pausedCount",
                              "finishedCount",
                              "repliedCount",
                              "failedCount",
                              "stoppedCount",
                              "createdAt",
                              "updatedAt"
                            ],
                            "additionalProperties": {}
                          }
                        },
                        "references": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-entry"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "entryId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "entryId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-object"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "campaign"
                                  },
                                  "sequenceId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sequenceId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "referenceCoverage": {
                          "type": "object",
                          "properties": {
                            "returned": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "truncated": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "returned",
                            "available",
                            "truncated"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "data",
                        "references",
                        "referenceCoverage"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "campaigns_create",
        "tags": [
          "campaigns"
        ],
        "summary": "Create a draft outreach campaign with email and LinkedIn sender pools and a business-hours send window in the given timezone",
        "description": "Create a draft outreach campaign with email and LinkedIn sender pools and a business-hours send window in the given timezone.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "emailMailboxAccountIds": {
                    "description": "Campaign email sender pool: up to 50 emailMailboxAccounts ids both you and the campaign owner may use. Omit to preserve existing configuration; [] clears the pool. A person's sender stays fixed for their conversation. Launch validates sender availability.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "linkedinAccountIds": {
                    "description": "Campaign LinkedIn sender pool: up to 50 linkedinAccounts ids both you and the campaign owner may use. Omit to preserve existing configuration; [] clears the pool. Legacy step senders remain until a pool is configured.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "timezone": {
                    "description": "IANA timezone for the default Mon-Fri 9-18 send window.",
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Founder outreach",
                "timezone": "America/Los_Angeles",
                "emailMailboxAccountIds": [
                  "<emailMailboxAccountId>"
                ],
                "linkedinAccountIds": [
                  "<linkedinAccountId>"
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sequenceId": {
                      "type": "string"
                    },
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "sequenceId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/duplicate": {
      "post": {
        "operationId": "campaigns_duplicate",
        "tags": [
          "campaigns"
        ],
        "summary": "Copy a campaign into a new draft named \"<name> copy\": the same steps, schedule, sender pools and personalized lines, its lead source paused, and no people. To reach more than 300 people, duplicate and add the next page of the search to the copy",
        "description": "Copy a campaign into a new draft named \"<name> copy\": the same steps, schedule, sender pools and personalized lines, its lead source paused, and no people. To reach more than 300 people, duplicate and add the next page of the search to the copy.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The campaign to copy; any status, including archived."
            },
            "description": "The campaign to copy; any status, including archived."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "references": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-entry"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "entryId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "crm-object"
                              },
                              "objectName": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "objectName",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "campaign"
                              },
                              "sequenceId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "href": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "imageUrl": {
                                "type": "string"
                              },
                              "objectIcon": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "sequenceId",
                              "label",
                              "href"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "referenceCoverage": {
                      "type": "object",
                      "properties": {
                        "returned": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "returned",
                        "available",
                        "truncated"
                      ],
                      "additionalProperties": false
                    },
                    "sequenceId": {
                      "type": "string",
                      "description": "The new draft. Rename it with campaigns.update."
                    }
                  },
                  "required": [
                    "sequenceId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}": {
      "get": {
        "operationId": "campaigns_get",
        "tags": [
          "campaigns"
        ],
        "summary": "Read a campaign: settings, steps, people, their current step and hold, last touches, linked leads",
        "description": "Read a campaign: settings, steps, people, their current step and hold, last touches, linked leads.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "references": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-entry"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "entryId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "entryId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "crm-object"
                                  },
                                  "objectName": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "objectName",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "campaign"
                                  },
                                  "sequenceId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "href": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "imageUrl": {
                                    "type": "string"
                                  },
                                  "objectIcon": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sequenceId",
                                  "label",
                                  "href"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "referenceCoverage": {
                          "type": "object",
                          "properties": {
                            "returned": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "truncated": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "returned",
                            "available",
                            "truncated"
                          ],
                          "additionalProperties": false
                        },
                        "sequence": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "active",
                                "paused",
                                "completed",
                                "archived"
                              ],
                              "description": "Campaign lifecycle status."
                            },
                            "stopOnReply": {
                              "type": "boolean"
                            },
                            "emailMailboxAccountIds": {
                              "description": "Campaign email sender pool: up to 50 emailMailboxAccounts ids both you and the campaign owner may use. Omit to preserve existing configuration; [] clears the pool. A person's sender stays fixed for their conversation. Launch validates sender availability.",
                              "maxItems": 50,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "linkedinAccountIds": {
                              "description": "Campaign LinkedIn sender pool: up to 50 linkedinAccounts ids both you and the campaign owner may use. Omit to preserve existing configuration; [] clears the pool. Legacy step senders remain until a pool is configured.",
                              "maxItems": 50,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "timezone": {
                              "type": "string"
                            },
                            "startsAt": {
                              "type": "number"
                            },
                            "endsAt": {
                              "type": "number"
                            },
                            "sendSchedules": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "description": "Label, e.g. \"Mon-Fri 9-18\"."
                                  },
                                  "timezone": {
                                    "type": "string",
                                    "description": "IANA timezone, e.g. America/Los_Angeles."
                                  },
                                  "startHour": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 23,
                                    "description": "First hour sends may go out (0-23)."
                                  },
                                  "endHour": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 24,
                                    "description": "Hour sends stop (1-24); must be after startHour."
                                  },
                                  "weekdays": {
                                    "minItems": 1,
                                    "type": "array",
                                    "items": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 6
                                    },
                                    "description": "Days sends may go out: 0 = Sunday ... 6 = Saturday."
                                  }
                                },
                                "required": [
                                  "name",
                                  "timezone",
                                  "startHour",
                                  "endHour",
                                  "weekdays"
                                ],
                                "additionalProperties": false,
                                "description": "One send window. A campaign has one to eight; the first one's timezone is the campaign's."
                              }
                            },
                            "dailySendCap": {
                              "type": "number"
                            },
                            "stepCount": {
                              "type": "number"
                            },
                            "stepModel": {
                              "type": "string",
                              "enum": [
                                "linear",
                                "workflow"
                              ],
                              "description": "linear: steps run in order. workflow: steps have keys and paths (next, yesNext, noNext) and may include condition and wait_for_connection. Left out, a workflow stays one and steps with keys, paths or those types make one; nothing turns a workflow back into a list."
                            },
                            "totalEnrolled": {
                              "type": "number"
                            },
                            "activeCount": {
                              "type": "number"
                            },
                            "pausedCount": {
                              "type": "number"
                            },
                            "finishedCount": {
                              "type": "number"
                            },
                            "repliedCount": {
                              "type": "number"
                            },
                            "failedCount": {
                              "type": "number"
                            },
                            "stoppedCount": {
                              "type": "number"
                            },
                            "launchedAt": {
                              "type": "number"
                            },
                            "ownerName": {
                              "type": "string"
                            },
                            "isOwner": {
                              "type": "boolean"
                            },
                            "createdAt": {
                              "type": "number"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "_id",
                            "name",
                            "status",
                            "stopOnReply",
                            "stepCount",
                            "totalEnrolled",
                            "activeCount",
                            "pausedCount",
                            "finishedCount",
                            "repliedCount",
                            "failedCount",
                            "stoppedCount",
                            "createdAt",
                            "updatedAt"
                          ],
                          "additionalProperties": {}
                        },
                        "steps": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "wait",
                                  "email",
                                  "linkedin_connection",
                                  "linkedin_message",
                                  "linkedin_visit",
                                  "linkedin_like_post",
                                  "linkedin_inmail",
                                  "condition",
                                  "wait_for_connection"
                                ],
                                "description": "Step type. condition (If / else) and wait_for_connection (Wait for them to accept) send nothing; they continue on yesNext or noNext and make the campaign a workflow."
                              },
                              "waitHours": {
                                "description": "wait steps: hours to wait before the next step.",
                                "type": "number"
                              },
                              "emailMailboxAccountId": {
                                "description": "Legacy email step sender. Pool campaigns choose senders in emailMailboxAccountIds on the campaign, not on individual steps.",
                                "type": "string"
                              },
                              "emailSubject": {
                                "description": "email steps: subject; {{Column}} merge tokens allowed.",
                                "type": "string"
                              },
                              "emailHtmlBody": {
                                "description": "email steps: HTML body. Sent instead of emailTextBody when both are set, so when you edit the text, update or drop this too.",
                                "type": "string"
                              },
                              "emailTextBody": {
                                "description": "email steps: plain-text body; used as the email when there is no emailHtmlBody.",
                                "type": "string"
                              },
                              "emailReplyToPrevious": {
                                "description": "email steps: thread under the previous email step instead of a new subject.",
                                "type": "boolean"
                              },
                              "onlyIf": {
                                "description": "email and linkedin_like_post only: always (default), connected or not_connected. InMail automatically skips connected people; do not set a condition on it.",
                                "type": "string",
                                "enum": [
                                  "always",
                                  "connected",
                                  "not_connected"
                                ]
                              },
                              "linkedinAccountId": {
                                "description": "Legacy LinkedIn step sender (also on wait_for_connection, and on a condition that checks linkedin_connected). Pool campaigns use the campaign's linkedinAccountIds instead.",
                                "type": "string"
                              },
                              "linkedinMessageBody": {
                                "description": "linkedin_connection: the invite note (optional, up to 300 chars; sent without it if LinkedIn refuses the note); linkedin_message: the required message (up to 3000 chars); linkedin_inmail: the required message (up to 1900 chars).",
                                "type": "string"
                              },
                              "linkedinMessageMode": {
                                "description": "linkedin_message: what to do when the invite is still pending.",
                                "type": "string",
                                "enum": [
                                  "skip_if_not_connected",
                                  "wait_until_connected"
                                ]
                              },
                              "connectionTimeoutHours": {
                                "description": "linkedin_message with linkedinMessageMode=wait_until_connected: wait 1-2160 hours for acceptance (default 720); after a connection step this mode is the default in a linear campaign. wait_for_connection: wait 24-2160 hours (1-90 days, default 720) before taking the Not accepted path.",
                                "type": "number",
                                "minimum": 1,
                                "maximum": 2160
                              },
                              "likeReaction": {
                                "description": "linkedin_like_post only: the reaction to leave (default like).",
                                "type": "string",
                                "enum": [
                                  "like",
                                  "celebrate",
                                  "support",
                                  "love",
                                  "insightful",
                                  "funny"
                                ]
                              },
                              "likeMaxPostAgeDays": {
                                "description": "linkedin_like_post only: select the newest eligible original post from the last 1-365 days (default 30).",
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 365
                              },
                              "likeSkipPreviousWait": {
                                "description": "linkedin_like_post only: before the immediately preceding wait starts, check for eligible posts. If none exist, skip that wait and the like step, keeping following waits. Defaults to false when omitted.",
                                "type": "boolean"
                              },
                              "likeSkipNextWait": {
                                "description": "linkedin_like_post only: skip consecutive following wait steps whenever the reaction step is skipped (default true). False keeps those waits.",
                                "type": "boolean"
                              },
                              "likeCount": {
                                "description": "linkedin_like_post only: how many recent posts to react to, 1-3 (default 1).",
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 3
                              },
                              "inmailSubject": {
                                "description": "linkedin_inmail only: optional subject, up to 200 characters; merge tokens allowed. Clear with an empty string.",
                                "type": "string"
                              },
                              "withdrawAfterHours": {
                                "description": "linkedin_connection only: withdraw a still-pending invitation sent by this campaign after 168-2160 hours (7-90 days). Omitted means off on creation; null turns it off on edit.",
                                "anyOf": [
                                  {
                                    "type": "number",
                                    "minimum": 168,
                                    "maximum": 2160
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "key": {
                                "description": "Workflow steps: this step's id, unique in the campaign, which next, yesNext and noNext point at (not \"end\"). Left out, one is made.",
                                "type": "string",
                                "minLength": 1
                              },
                              "next": {
                                "description": "Workflow steps: where a step that isn't a condition or wait_for_connection goes; left out, the following step: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                                "type": "string",
                                "minLength": 1
                              },
                              "yesNext": {
                                "description": "Workflow steps: condition and wait_for_connection only, required: where the Yes (Accepted) path goes: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                                "type": "string",
                                "minLength": 1
                              },
                              "noNext": {
                                "description": "Workflow steps: condition and wait_for_connection only, required: where the No (Not accepted) path goes: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                                "type": "string",
                                "minLength": 1
                              },
                              "check": {
                                "description": "condition only, required: linkedin_connected, has_email, opened_last_email (needs an email before it on every path) or field_value. Fixed once the campaign launches.",
                                "type": "string",
                                "enum": [
                                  "linkedin_connected",
                                  "has_email",
                                  "opened_last_email",
                                  "field_value"
                                ]
                              },
                              "conditionField": {
                                "description": "condition with check=field_value: the lead field to check, like \"Job Title\" or \"Source\" (the campaign itself changes Status, Last touch and LinkedIn connection). Fixed once the campaign launches.",
                                "type": "string"
                              },
                              "conditionOperator": {
                                "description": "condition with check=field_value: is, is_not, contains, is_empty or is_not_empty (all case-insensitive). Fixed once the campaign launches.",
                                "type": "string",
                                "enum": [
                                  "is",
                                  "is_not",
                                  "is_empty",
                                  "is_not_empty",
                                  "contains"
                                ]
                              },
                              "conditionValue": {
                                "description": "condition with check=field_value and is, is_not or contains: the text to compare with. Editable after launch.",
                                "type": "string"
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": {}
                          },
                          "description": "The steps in order, each with its _id. condition and wait_for_connection steps also carry a readable label."
                        },
                        "enrollments": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "currentRuns": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {},
                          "description": "enrollmentId -> the step run in progress, its hold and LinkedIn action."
                        },
                        "lastTouches": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "at": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "type",
                              "at"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "connectedEntries": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {},
                          "description": "enrollmentId -> linked CRM record and lead status."
                        },
                        "connectedFieldNames": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "isOwner": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "sequence",
                        "steps",
                        "enrollments",
                        "currentRuns",
                        "lastTouches",
                        "connectedEntries",
                        "connectedFieldNames",
                        "isOwner"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "campaigns_update",
        "tags": [
          "campaigns"
        ],
        "summary": "Change a campaign's name, sender pools, send windows, daily email cap, stop-on-reply, start or end. Works until archived; existing conversations keep their assigned sender",
        "description": "Change a campaign's name, sender pools, send windows, daily email cap, stop-on-reply, start or end. Works until archived; existing conversations keep their assigned sender.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "emailMailboxAccountIds": {
                    "description": "Campaign email sender pool: up to 50 emailMailboxAccounts ids both you and the campaign owner may use. Omit to preserve existing configuration; [] clears the pool. A person's sender stays fixed for their conversation. Launch validates sender availability.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "linkedinAccountIds": {
                    "description": "Campaign LinkedIn sender pool: up to 50 linkedinAccounts ids both you and the campaign owner may use. Omit to preserve existing configuration; [] clears the pool. Legacy step senders remain until a pool is configured.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "stopOnReply": {
                    "description": "Stop a person's remaining steps when they reply.",
                    "type": "boolean"
                  },
                  "startsAt": {
                    "description": "Epoch ms; null clears the start.",
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "endsAt": {
                    "description": "Epoch ms; null clears the end.",
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sendSchedules": {
                    "minItems": 1,
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Label, e.g. \"Mon-Fri 9-18\"."
                        },
                        "timezone": {
                          "type": "string",
                          "description": "IANA timezone, e.g. America/Los_Angeles."
                        },
                        "startHour": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 23,
                          "description": "First hour sends may go out (0-23)."
                        },
                        "endHour": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 24,
                          "description": "Hour sends stop (1-24); must be after startHour."
                        },
                        "weekdays": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 6
                          },
                          "description": "Days sends may go out: 0 = Sunday ... 6 = Saturday."
                        }
                      },
                      "required": [
                        "name",
                        "timezone",
                        "startHour",
                        "endHour",
                        "weekdays"
                      ],
                      "additionalProperties": false,
                      "description": "One send window. A campaign has one to eight; the first one's timezone is the campaign's."
                    }
                  },
                  "timezone": {
                    "description": "Legacy single-window timezone. Prefer sendSchedules.",
                    "type": "string"
                  },
                  "sendWindowStartHour": {
                    "description": "Legacy single-window start hour. Prefer sendSchedules.",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 23
                  },
                  "sendWindowEndHour": {
                    "description": "Legacy single-window end hour. Prefer sendSchedules.",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 24
                  },
                  "sendWeekdays": {
                    "description": "Legacy single-window weekdays, 0 = Sunday. Prefer sendSchedules.",
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 6
                    }
                  },
                  "dailySendCap": {
                    "description": "Cold emails per day, 1-100.",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  }
                }
              },
              "example": {
                "sequenceId": "<sequenceId>",
                "emailMailboxAccountIds": [
                  "<emailMailboxAccountId>"
                ],
                "linkedinAccountIds": [
                  "<linkedinAccountId>"
                ],
                "dailySendCap": 30,
                "sendSchedules": [
                  {
                    "name": "Mon-Fri 9-18",
                    "timezone": "America/Los_Angeles",
                    "startHour": 9,
                    "endHour": 18,
                    "weekdays": [
                      1,
                      2,
                      3,
                      4,
                      5
                    ]
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/analytics": {
      "get": {
        "operationId": "campaigns_analytics",
        "tags": [
          "campaigns"
        ],
        "summary": "Campaign funnel: enrolled, contacted, invited, accepted, messaged, replied, opens and clicks, and for a workflow how many people took each If / else and Wait for them to accept path (branchStats)",
        "description": "Campaign funnel: enrolled, contacted, invited, accepted, messaged, replied, opens and clicks, and for a workflow how many people took each If / else and Wait for them to accept path (branchStats).",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "audience": {
                      "type": "number"
                    },
                    "contacted": {
                      "type": "number"
                    },
                    "linkedinInvited": {
                      "type": "number"
                    },
                    "linkedinConnected": {
                      "type": "number"
                    },
                    "linkedinMessaged": {
                      "type": "number"
                    },
                    "linkedinReplied": {
                      "type": "number"
                    },
                    "active": {
                      "type": "number"
                    },
                    "paused": {
                      "type": "number"
                    },
                    "finished": {
                      "type": "number"
                    },
                    "replied": {
                      "type": "number"
                    },
                    "failed": {
                      "type": "number"
                    },
                    "stopped": {
                      "type": "number"
                    },
                    "emailSent": {
                      "type": "number"
                    },
                    "opened": {
                      "type": "number"
                    },
                    "clicked": {
                      "type": "number"
                    },
                    "linkedinSent": {
                      "type": "number"
                    },
                    "replyRate": {
                      "type": "number"
                    },
                    "openRate": {
                      "type": "number"
                    },
                    "clickRate": {
                      "type": "number"
                    },
                    "branchStats": {
                      "description": "Workflows only: each condition and wait_for_connection step, in step order, with how many people took each path.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "stepId": {
                            "type": "string"
                          },
                          "yes": {
                            "type": "number",
                            "description": "People who took the Yes (Accepted) path."
                          },
                          "no": {
                            "type": "number",
                            "description": "People who took the No (Not accepted) path."
                          }
                        },
                        "required": [
                          "stepId",
                          "yes",
                          "no"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "truncated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "audience",
                    "contacted",
                    "linkedinInvited",
                    "linkedinConnected",
                    "linkedinMessaged",
                    "linkedinReplied",
                    "active",
                    "paused",
                    "finished",
                    "replied",
                    "failed",
                    "stopped",
                    "emailSent",
                    "opened",
                    "clicked",
                    "linkedinSent",
                    "replyRate",
                    "openRate",
                    "clickRate",
                    "truncated"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/live": {
      "get": {
        "operationId": "campaigns_live",
        "tags": [
          "campaigns"
        ],
        "summary": "What the campaign is doing now, what comes next and when, and why it is holding",
        "description": "What the campaign is doing now, what comes next and when, and why it is holding.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "active",
                        "paused",
                        "completed",
                        "archived"
                      ],
                      "description": "Campaign lifecycle status."
                    },
                    "usesEmail": {
                      "type": "boolean"
                    },
                    "usesLinkedin": {
                      "type": "boolean"
                    },
                    "emailsToday": {
                      "type": "number"
                    },
                    "dailySendCap": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "nextEmailAt": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "now": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "next": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "description": "profile, visit, invite, message, like, inmail, withdraw, email, wait or check (an If / else)."
                            },
                            "acceptanceDeadline": {
                              "description": "Waiting for them to accept: when the wait ends either way.",
                              "type": "number"
                            },
                            "label": {
                              "description": "kind check: what the If / else checks, e.g. \"Has an email address\".",
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "paused": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "senders": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "status",
                    "usesEmail",
                    "usesLinkedin",
                    "emailsToday",
                    "dailySendCap",
                    "nextEmailAt",
                    "now",
                    "next",
                    "paused",
                    "senders"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/pipeline": {
      "get": {
        "operationId": "campaigns_pipeline",
        "tags": [
          "campaigns"
        ],
        "summary": "Where a campaign's people sit in the workspace's lead pipeline right now: each lead Status in order with how many enrolled leads are at it, and how many have no lead or a status outside the pipeline",
        "description": "Where a campaign's people sit in the workspace's lead pipeline right now: each lead Status in order with how many enrolled leads are at it, and how many have no lead or a status outside the pipeline.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "number",
                          "description": "People in the campaign."
                        },
                        "statuses": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "description": "A lead Status, as named in the CRM."
                              },
                              "color": {
                                "type": "string"
                              },
                              "count": {
                                "type": "number",
                                "description": "Enrolled leads at this Status."
                              }
                            },
                            "required": [
                              "name",
                              "color",
                              "count"
                            ],
                            "additionalProperties": false
                          },
                          "description": "The workspace's lead Statuses, in pipeline order."
                        },
                        "other": {
                          "type": "number",
                          "description": "People with no lead, or a Status outside the pipeline."
                        }
                      },
                      "required": [
                        "total",
                        "statuses",
                        "other"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "example": {
                  "total": 12,
                  "statuses": [
                    {
                      "name": "New",
                      "color": "#94a3b8",
                      "count": 3
                    },
                    {
                      "name": "Contacted",
                      "color": "#3b82f6",
                      "count": 5
                    },
                    {
                      "name": "Replied",
                      "color": "#22c55e",
                      "count": 2
                    }
                  ],
                  "other": 2
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/steps": {
      "put": {
        "operationId": "campaigns_steps_replace",
        "tags": [
          "campaigns"
        ],
        "summary": "Replace every step of a draft campaign (email, wait, LinkedIn visit, connection request, message, post reaction, InMail, If / else, Wait for them to accept). A workflow (stepModel workflow, or steps with key, next, yesNext or noNext) branches: condition and wait_for_connection steps continue on yesNext or noNext, other steps on next; each points at another step's key or end. Steps are checked first: a field the step type would drop, missing text, {TOKEN} single braces or paths that don't hold together are rejected, not saved. Configure sender pools on the campaign; step sender ids are legacy-only",
        "description": "Replace every step of a draft campaign (email, wait, LinkedIn visit, connection request, message, post reaction, InMail, If / else, Wait for them to accept). A workflow (stepModel workflow, or steps with key, next, yesNext or noNext) branches: condition and wait_for_connection steps continue on yesNext or noNext, other steps on next; each points at another step's key or end. Steps are checked first: a field the step type would drop, missing text, {TOKEN} single braces or paths that don't hold together are rejected, not saved. Configure sender pools on the campaign; step sender ids are legacy-only.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "steps": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "wait",
                            "email",
                            "linkedin_connection",
                            "linkedin_message",
                            "linkedin_visit",
                            "linkedin_like_post",
                            "linkedin_inmail",
                            "condition",
                            "wait_for_connection"
                          ],
                          "description": "Step type. condition (If / else) and wait_for_connection (Wait for them to accept) send nothing; they continue on yesNext or noNext and make the campaign a workflow."
                        },
                        "waitHours": {
                          "description": "wait steps: hours to wait before the next step.",
                          "type": "number"
                        },
                        "emailMailboxAccountId": {
                          "description": "Legacy email step sender. Pool campaigns choose senders in emailMailboxAccountIds on the campaign, not on individual steps.",
                          "type": "string"
                        },
                        "emailSubject": {
                          "description": "email steps: subject; {{Column}} merge tokens allowed.",
                          "type": "string"
                        },
                        "emailHtmlBody": {
                          "description": "email steps: HTML body. Sent instead of emailTextBody when both are set, so when you edit the text, update or drop this too.",
                          "type": "string"
                        },
                        "emailTextBody": {
                          "description": "email steps: plain-text body; used as the email when there is no emailHtmlBody.",
                          "type": "string"
                        },
                        "emailReplyToPrevious": {
                          "description": "email steps: thread under the previous email step instead of a new subject.",
                          "type": "boolean"
                        },
                        "onlyIf": {
                          "description": "email and linkedin_like_post only: always (default), connected or not_connected. InMail automatically skips connected people; do not set a condition on it.",
                          "type": "string",
                          "enum": [
                            "always",
                            "connected",
                            "not_connected"
                          ]
                        },
                        "linkedinAccountId": {
                          "description": "Legacy LinkedIn step sender (also on wait_for_connection, and on a condition that checks linkedin_connected). Pool campaigns use the campaign's linkedinAccountIds instead.",
                          "type": "string"
                        },
                        "linkedinMessageBody": {
                          "description": "linkedin_connection: the invite note (optional, up to 300 chars; sent without it if LinkedIn refuses the note); linkedin_message: the required message (up to 3000 chars); linkedin_inmail: the required message (up to 1900 chars).",
                          "type": "string"
                        },
                        "linkedinMessageMode": {
                          "description": "linkedin_message: what to do when the invite is still pending.",
                          "type": "string",
                          "enum": [
                            "skip_if_not_connected",
                            "wait_until_connected"
                          ]
                        },
                        "connectionTimeoutHours": {
                          "description": "linkedin_message with linkedinMessageMode=wait_until_connected: wait 1-2160 hours for acceptance (default 720); after a connection step this mode is the default in a linear campaign. wait_for_connection: wait 24-2160 hours (1-90 days, default 720) before taking the Not accepted path.",
                          "type": "number",
                          "minimum": 1,
                          "maximum": 2160
                        },
                        "likeReaction": {
                          "description": "linkedin_like_post only: the reaction to leave (default like).",
                          "type": "string",
                          "enum": [
                            "like",
                            "celebrate",
                            "support",
                            "love",
                            "insightful",
                            "funny"
                          ]
                        },
                        "likeMaxPostAgeDays": {
                          "description": "linkedin_like_post only: select the newest eligible original post from the last 1-365 days (default 30).",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 365
                        },
                        "likeSkipPreviousWait": {
                          "description": "linkedin_like_post only: before the immediately preceding wait starts, check for eligible posts. If none exist, skip that wait and the like step, keeping following waits. Defaults to false when omitted.",
                          "type": "boolean"
                        },
                        "likeSkipNextWait": {
                          "description": "linkedin_like_post only: skip consecutive following wait steps whenever the reaction step is skipped (default true). False keeps those waits.",
                          "type": "boolean"
                        },
                        "likeCount": {
                          "description": "linkedin_like_post only: how many recent posts to react to, 1-3 (default 1).",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 3
                        },
                        "inmailSubject": {
                          "description": "linkedin_inmail only: optional subject, up to 200 characters; merge tokens allowed. Clear with an empty string.",
                          "type": "string"
                        },
                        "withdrawAfterHours": {
                          "description": "linkedin_connection only: withdraw a still-pending invitation sent by this campaign after 168-2160 hours (7-90 days). Omitted means off on creation; null turns it off on edit.",
                          "anyOf": [
                            {
                              "type": "number",
                              "minimum": 168,
                              "maximum": 2160
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "key": {
                          "description": "Workflow steps: this step's id, unique in the campaign, which next, yesNext and noNext point at (not \"end\"). Left out, one is made.",
                          "type": "string",
                          "minLength": 1
                        },
                        "next": {
                          "description": "Workflow steps: where a step that isn't a condition or wait_for_connection goes; left out, the following step: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                          "type": "string",
                          "minLength": 1
                        },
                        "yesNext": {
                          "description": "Workflow steps: condition and wait_for_connection only, required: where the Yes (Accepted) path goes: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                          "type": "string",
                          "minLength": 1
                        },
                        "noNext": {
                          "description": "Workflow steps: condition and wait_for_connection only, required: where the No (Not accepted) path goes: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                          "type": "string",
                          "minLength": 1
                        },
                        "check": {
                          "description": "condition only, required: linkedin_connected, has_email, opened_last_email (needs an email before it on every path) or field_value. Fixed once the campaign launches.",
                          "type": "string",
                          "enum": [
                            "linkedin_connected",
                            "has_email",
                            "opened_last_email",
                            "field_value"
                          ]
                        },
                        "conditionField": {
                          "description": "condition with check=field_value: the lead field to check, like \"Job Title\" or \"Source\" (the campaign itself changes Status, Last touch and LinkedIn connection). Fixed once the campaign launches.",
                          "type": "string"
                        },
                        "conditionOperator": {
                          "description": "condition with check=field_value: is, is_not, contains, is_empty or is_not_empty (all case-insensitive). Fixed once the campaign launches.",
                          "type": "string",
                          "enum": [
                            "is",
                            "is_not",
                            "is_empty",
                            "is_not_empty",
                            "contains"
                          ]
                        },
                        "conditionValue": {
                          "description": "condition with check=field_value and is, is_not or contains: the text to compare with. Editable after launch.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": "One campaign step, in order."
                    },
                    "description": "Every step, in send order (a workflow may list them in any order; they are stored in path order). Rejected, not trimmed: a field the step type would drop (onlyIf off email/post-like steps, a body on a visit, reply-in-thread on the first email, condition fields its check ignores), a missing subject or required body, an overlength note/message/InMail subject, out-of-range wait/withdrawal/post-age/acceptance values, {TOKEN} single braces, which would be sent as typed, and workflow paths that don't hold together (duplicate keys, a target that isn't a key or end, a condition or wait_for_connection without both yesNext and noNext, or any other step with them)."
                  },
                  "stepModel": {
                    "description": "linear: steps run in order. workflow: steps have keys and paths (next, yesNext, noNext) and may include condition and wait_for_connection. Left out, a workflow stays one and steps with keys, paths or those types make one; nothing turns a workflow back into a list. When replacing a workflow's steps, send workflow, so steps without keys or paths are checked here the way they will be saved.",
                    "type": "string",
                    "enum": [
                      "linear",
                      "workflow"
                    ]
                  },
                  "allowSingleBraces": {
                    "description": "Send {single braces} exactly as typed instead of rejecting them. Merge tokens always use {{double braces}}.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "steps"
                ]
              },
              "example": {
                "sequenceId": "<sequenceId>",
                "stepModel": "workflow",
                "steps": [
                  {
                    "key": "connected",
                    "type": "condition",
                    "check": "linkedin_connected",
                    "yesNext": "message",
                    "noNext": "invite"
                  },
                  {
                    "key": "invite",
                    "type": "linkedin_connection",
                    "linkedinMessageBody": "Hi {{First name}}, enjoyed your post on {{Topic}}.",
                    "next": "accept"
                  },
                  {
                    "key": "accept",
                    "type": "wait_for_connection",
                    "connectionTimeoutHours": 240,
                    "yesNext": "message",
                    "noNext": "email"
                  },
                  {
                    "key": "email",
                    "type": "email",
                    "emailSubject": "Quick question, {{First name}}",
                    "emailTextBody": "Hi {{First name}}, ...",
                    "next": "end"
                  },
                  {
                    "key": "message",
                    "type": "linkedin_message",
                    "linkedinMessageBody": "Thanks for connecting, {{First name}}. ...",
                    "next": "end"
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "stepCount": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "ok",
                    "stepCount"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "campaigns_steps_update",
        "tags": [
          "campaigns"
        ],
        "summary": "Edit the text, waits and conditions of a launched (or paused) campaign's steps in place. Each step keeps its id, type and place; pass the stepId and the updatedAt you read, and only the fields you change. A workflow keeps its paths and what each If / else checks (key, next, yesNext, noNext, check, conditionField, conditionOperator); conditionValue and acceptance waits stay editable. Messages already sent or being prepared keep their text; drafts use campaigns.steps.replace",
        "description": "Edit the text, waits and conditions of a launched (or paused) campaign's steps in place. Each step keeps its id, type and place; pass the stepId and the updatedAt you read, and only the fields you change. A workflow keeps its paths and what each If / else checks (key, next, yesNext, noNext, check, conditionField, conditionOperator); conditionValue and acceptance waits stay editable. Messages already sent or being prepared keep their text; drafts use campaigns.steps.replace.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "steps": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "wait",
                            "email",
                            "linkedin_connection",
                            "linkedin_message",
                            "linkedin_visit",
                            "linkedin_like_post",
                            "linkedin_inmail",
                            "condition",
                            "wait_for_connection"
                          ],
                          "description": "The step's current type. A launched step's type can't change."
                        },
                        "waitHours": {
                          "description": "wait steps: hours to wait before the next step.",
                          "type": "number"
                        },
                        "emailMailboxAccountId": {
                          "description": "Legacy email step sender. Pool campaigns choose senders in emailMailboxAccountIds on the campaign, not on individual steps.",
                          "type": "string"
                        },
                        "emailSubject": {
                          "description": "email steps: subject; {{Column}} merge tokens allowed.",
                          "type": "string"
                        },
                        "emailHtmlBody": {
                          "description": "email steps: HTML body. Sent instead of emailTextBody when both are set, so when you edit the text, update or drop this too.",
                          "type": "string"
                        },
                        "emailTextBody": {
                          "description": "email steps: plain-text body; used as the email when there is no emailHtmlBody.",
                          "type": "string"
                        },
                        "emailReplyToPrevious": {
                          "description": "email steps: thread under the previous email step instead of a new subject.",
                          "type": "boolean"
                        },
                        "onlyIf": {
                          "description": "email and linkedin_like_post only: always (default), connected or not_connected. InMail automatically skips connected people; do not set a condition on it.",
                          "type": "string",
                          "enum": [
                            "always",
                            "connected",
                            "not_connected"
                          ]
                        },
                        "linkedinAccountId": {
                          "description": "Legacy LinkedIn step sender (also on wait_for_connection, and on a condition that checks linkedin_connected). Pool campaigns use the campaign's linkedinAccountIds instead.",
                          "type": "string"
                        },
                        "linkedinMessageBody": {
                          "description": "linkedin_connection: the invite note (optional, up to 300 chars; sent without it if LinkedIn refuses the note); linkedin_message: the required message (up to 3000 chars); linkedin_inmail: the required message (up to 1900 chars).",
                          "type": "string"
                        },
                        "linkedinMessageMode": {
                          "description": "linkedin_message: what to do when the invite is still pending.",
                          "type": "string",
                          "enum": [
                            "skip_if_not_connected",
                            "wait_until_connected"
                          ]
                        },
                        "connectionTimeoutHours": {
                          "description": "linkedin_message with linkedinMessageMode=wait_until_connected: wait 1-2160 hours for acceptance (default 720); after a connection step this mode is the default in a linear campaign. wait_for_connection: wait 24-2160 hours (1-90 days, default 720) before taking the Not accepted path.",
                          "type": "number",
                          "minimum": 1,
                          "maximum": 2160
                        },
                        "likeReaction": {
                          "description": "linkedin_like_post only: the reaction to leave (default like).",
                          "type": "string",
                          "enum": [
                            "like",
                            "celebrate",
                            "support",
                            "love",
                            "insightful",
                            "funny"
                          ]
                        },
                        "likeMaxPostAgeDays": {
                          "description": "linkedin_like_post only: select the newest eligible original post from the last 1-365 days (default 30).",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 365
                        },
                        "likeSkipPreviousWait": {
                          "description": "linkedin_like_post only: before the immediately preceding wait starts, check for eligible posts. If none exist, skip that wait and the like step, keeping following waits. Defaults to false when omitted.",
                          "type": "boolean"
                        },
                        "likeSkipNextWait": {
                          "description": "linkedin_like_post only: skip consecutive following wait steps whenever the reaction step is skipped (default true). False keeps those waits.",
                          "type": "boolean"
                        },
                        "likeCount": {
                          "description": "linkedin_like_post only: how many recent posts to react to, 1-3 (default 1).",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 3
                        },
                        "inmailSubject": {
                          "description": "linkedin_inmail only: optional subject, up to 200 characters; merge tokens allowed. Clear with an empty string.",
                          "type": "string"
                        },
                        "withdrawAfterHours": {
                          "description": "linkedin_connection only: withdraw a still-pending invitation sent by this campaign after 168-2160 hours (7-90 days). Omitted means off on creation; null turns it off on edit.",
                          "anyOf": [
                            {
                              "type": "number",
                              "minimum": 168,
                              "maximum": 2160
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "key": {
                          "description": "Workflow steps: this step's id, unique in the campaign, which next, yesNext and noNext point at (not \"end\"). Left out, one is made.",
                          "type": "string",
                          "minLength": 1
                        },
                        "next": {
                          "description": "Workflow steps: where a step that isn't a condition or wait_for_connection goes; left out, the following step: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                          "type": "string",
                          "minLength": 1
                        },
                        "yesNext": {
                          "description": "Workflow steps: condition and wait_for_connection only, required: where the Yes (Accepted) path goes: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                          "type": "string",
                          "minLength": 1
                        },
                        "noNext": {
                          "description": "Workflow steps: condition and wait_for_connection only, required: where the No (Not accepted) path goes: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                          "type": "string",
                          "minLength": 1
                        },
                        "check": {
                          "description": "condition only, required: linkedin_connected, has_email, opened_last_email (needs an email before it on every path) or field_value. Fixed once the campaign launches.",
                          "type": "string",
                          "enum": [
                            "linkedin_connected",
                            "has_email",
                            "opened_last_email",
                            "field_value"
                          ]
                        },
                        "conditionField": {
                          "description": "condition with check=field_value: the lead field to check, like \"Job Title\" or \"Source\" (the campaign itself changes Status, Last touch and LinkedIn connection). Fixed once the campaign launches.",
                          "type": "string"
                        },
                        "conditionOperator": {
                          "description": "condition with check=field_value: is, is_not, contains, is_empty or is_not_empty (all case-insensitive). Fixed once the campaign launches.",
                          "type": "string",
                          "enum": [
                            "is",
                            "is_not",
                            "is_empty",
                            "is_not_empty",
                            "contains"
                          ]
                        },
                        "conditionValue": {
                          "description": "condition with check=field_value and is, is_not or contains: the text to compare with. Editable after launch.",
                          "type": "string"
                        },
                        "stepId": {
                          "type": "string",
                          "description": "The step's _id from campaigns.get steps[]."
                        },
                        "expectedUpdatedAt": {
                          "type": "number",
                          "description": "The step's updatedAt when you read it. If someone saved it since, the edit is refused instead of overwriting theirs."
                        }
                      },
                      "required": [
                        "type",
                        "stepId",
                        "expectedUpdatedAt"
                      ],
                      "additionalProperties": false,
                      "description": "One step edit: only the fields given change. Clear text with an empty string, onlyIf with always, emailReplyToPrevious with false and withdrawAfterHours with null. Like settings are optional; omitted values stay unchanged. A workflow step's key, next, yesNext, noNext, check, conditionField and conditionOperator can't change after launch (send them unchanged or leave them out); conditionValue and a wait_for_connection's connectionTimeoutHours can."
                    },
                    "description": "The steps to change. Rejected, not trimmed: a field the step type would drop, an overlength note/message/InMail subject, out-of-range wait/withdrawal/post-age/acceptance values, {TOKEN} single braces, and a changed path or If / else check."
                  },
                  "allowSingleBraces": {
                    "description": "Send {single braces} exactly as typed instead of rejecting them. Merge tokens always use {{double braces}}.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "steps"
                ]
              },
              "example": {
                "sequenceId": "<sequenceId>",
                "steps": [
                  {
                    "stepId": "<stepId>",
                    "expectedUpdatedAt": 1765526400000,
                    "type": "email",
                    "emailSubject": "A quicker question, {{First name}}"
                  },
                  {
                    "stepId": "<waitStepId>",
                    "expectedUpdatedAt": 1765526400000,
                    "type": "wait",
                    "waitHours": 96
                  },
                  {
                    "stepId": "<waitForConnectionStepId>",
                    "expectedUpdatedAt": 1765526400000,
                    "type": "wait_for_connection",
                    "connectionTimeoutHours": 336
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "stepCount": {
                      "type": "number",
                      "description": "How many steps were edited."
                    }
                  },
                  "required": [
                    "ok",
                    "stepCount"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/personalization": {
      "get": {
        "operationId": "campaigns_personalization_get",
        "tags": [
          "campaigns"
        ],
        "summary": "Read a campaign's personalized lines (written for each person): their {{keys}} for steps, instructions and fallbacks, how many people have them, and the cost per person",
        "description": "Read a campaign's personalized lines (written for each person): their {{keys}} for steps, instructions and fallbacks, how many people have them, and the cost per person.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "template": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "variables": {
                              "minItems": 1,
                              "maxItems": 5,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "description": "The {{key}} used in steps: a letter, then letters, digits or _ (up to 40). Not a built-in field like firstName or company."
                                  },
                                  "label": {
                                    "type": "string",
                                    "description": "The line's name, up to 60 characters."
                                  },
                                  "prompt": {
                                    "type": "string",
                                    "description": "What the writer should say, up to 600 characters."
                                  },
                                  "fallback": {
                                    "type": "string",
                                    "description": "Sent when there is nothing specific to say; up to 300 characters, no {{variables}}."
                                  },
                                  "fallbackFrom": {
                                    "description": "A field to use before the fallback, e.g. Company.",
                                    "type": "string"
                                  },
                                  "maxChars": {
                                    "description": "The longest line, default 200 characters.",
                                    "type": "integer",
                                    "minimum": 20,
                                    "maximum": 300
                                  }
                                },
                                "required": [
                                  "key",
                                  "label",
                                  "prompt",
                                  "fallback"
                                ],
                                "additionalProperties": false,
                                "description": "One personalized line."
                              }
                            },
                            "context": {
                              "type": "object",
                              "properties": {
                                "sells": {
                                  "type": "string",
                                  "description": "What you sell, up to 1000 characters."
                                },
                                "offer": {
                                  "description": "The offer or call to action, up to 300 characters.",
                                  "type": "string"
                                }
                              },
                              "required": [
                                "sells"
                              ],
                              "additionalProperties": false
                            },
                            "version": {
                              "type": "number"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "variables",
                            "context",
                            "version",
                            "updatedAt"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "done": {
                          "type": "number"
                        },
                        "pending": {
                          "type": "number"
                        },
                        "failed": {
                          "type": "number"
                        },
                        "total": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "done",
                        "pending",
                        "failed",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "paused": {
                      "type": "boolean"
                    },
                    "notice": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "const": "insufficient_credits"
                            },
                            "at": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "code",
                            "at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "suggestedContext": {
                      "type": "object",
                      "properties": {
                        "sells": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    },
                    "estimatedCentsPerPerson": {
                      "type": "number"
                    },
                    "eligible": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "template",
                    "counts",
                    "paused",
                    "notice",
                    "suggestedContext",
                    "estimatedCentsPerPerson",
                    "eligible"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "campaigns_personalization_set",
        "tags": [
          "campaigns"
        ],
        "summary": "Define up to 5 personalized lines (each used as {{key}} in steps) and what you sell. Saving starts writing missing lines for up to 100 people, about 3 cents a person; for more it returns needsConfirm and writes nothing until campaigns.personalization.write is confirmed",
        "description": "Define up to 5 personalized lines (each used as {{key}} in steps) and what you sell. Saving starts writing missing lines for up to 100 people, about 3 cents a person; for more it returns needsConfirm and writes nothing until campaigns.personalization.write is confirmed.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "variables": {
                            "minItems": 1,
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string",
                                  "description": "The {{key}} used in steps: a letter, then letters, digits or _ (up to 40). Not a built-in field like firstName or company."
                                },
                                "label": {
                                  "type": "string",
                                  "description": "The line's name, up to 60 characters."
                                },
                                "prompt": {
                                  "type": "string",
                                  "description": "What the writer should say, up to 600 characters."
                                },
                                "fallback": {
                                  "type": "string",
                                  "description": "Sent when there is nothing specific to say; up to 300 characters, no {{variables}}."
                                },
                                "fallbackFrom": {
                                  "description": "A field to use before the fallback, e.g. Company.",
                                  "type": "string"
                                },
                                "maxChars": {
                                  "description": "The longest line, default 200 characters.",
                                  "type": "integer",
                                  "minimum": 20,
                                  "maximum": 300
                                }
                              },
                              "required": [
                                "key",
                                "label",
                                "prompt",
                                "fallback"
                              ],
                              "additionalProperties": false,
                              "description": "One personalized line."
                            }
                          },
                          "context": {
                            "type": "object",
                            "properties": {
                              "sells": {
                                "type": "string",
                                "description": "What you sell, up to 1000 characters."
                              },
                              "offer": {
                                "description": "The offer or call to action, up to 300 characters.",
                                "type": "string"
                              }
                            },
                            "required": [
                              "sells"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "variables",
                          "context"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The lines and context; null turns personalized lines off."
                  }
                },
                "required": [
                  "template"
                ]
              },
              "example": {
                "sequenceId": "<sequenceId>",
                "template": {
                  "variables": [
                    {
                      "key": "companyHook",
                      "label": "Company hook",
                      "prompt": "One sentence about something specific their company does or recently did. 8 to 18 words.",
                      "fallback": "Your team caught my eye.",
                      "maxChars": 160
                    }
                  ],
                  "context": {
                    "sells": "Senior engineers who join your team in your time zone."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "number"
                    },
                    "eligible": {
                      "type": "number",
                      "description": "People who would get a line."
                    },
                    "estimatedCents": {
                      "type": "number",
                      "description": "About 3 cents a person."
                    },
                    "needsConfirm": {
                      "type": "boolean",
                      "description": "True when nothing was written: confirm with campaigns.personalization.write and confirmed: true."
                    },
                    "queued": {
                      "type": "number",
                      "description": "People whose lines are being written now."
                    }
                  },
                  "required": [
                    "version",
                    "eligible",
                    "estimatedCents",
                    "needsConfirm",
                    "queued"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "campaigns_personalization_clear",
        "tags": [
          "campaigns"
        ],
        "summary": "Turn off a campaign's personalized lines and cancel the ones not yet written. Refused while a step still uses one of the {{keys}}",
        "description": "Turn off a campaign's personalized lines and cancel the ones not yet written. Refused while a step still uses one of the {{keys}}.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "number"
                    },
                    "eligible": {
                      "type": "number",
                      "description": "People who would get a line."
                    },
                    "estimatedCents": {
                      "type": "number",
                      "description": "About 3 cents a person."
                    },
                    "needsConfirm": {
                      "type": "boolean",
                      "description": "True when nothing was written: confirm with campaigns.personalization.write and confirmed: true."
                    },
                    "queued": {
                      "type": "number",
                      "description": "People whose lines are being written now."
                    }
                  },
                  "required": [
                    "version",
                    "eligible",
                    "estimatedCents",
                    "needsConfirm",
                    "queued"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/personalization/write": {
      "post": {
        "operationId": "campaigns_personalization_write",
        "tags": [
          "campaigns"
        ],
        "summary": "Write personalized lines for the people missing them (mode missing) or rewrite everyone's (mode all). Rewriting everyone or more than 100 people returns needsConfirm and the estimate until called with confirmed: true",
        "description": "Write personalized lines for the people missing them (mode missing) or rewrite everyone's (mode all). Rewriting everyone or more than 100 people returns needsConfirm and the estimate until called with confirmed: true.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "description": "missing (default): only people without lines. all: rewrite everyone's.",
                    "type": "string",
                    "enum": [
                      "missing",
                      "all"
                    ]
                  },
                  "confirmed": {
                    "description": "true after the user accepts the estimate from needsConfirm.",
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "number"
                    },
                    "eligible": {
                      "type": "number",
                      "description": "People who would get a line."
                    },
                    "estimatedCents": {
                      "type": "number",
                      "description": "About 3 cents a person."
                    },
                    "needsConfirm": {
                      "type": "boolean",
                      "description": "True when nothing was written: confirm with campaigns.personalization.write and confirmed: true."
                    },
                    "queued": {
                      "type": "number",
                      "description": "People whose lines are being written now."
                    }
                  },
                  "required": [
                    "version",
                    "eligible",
                    "estimatedCents",
                    "needsConfirm",
                    "queued"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/people/{enrollmentId}/personalization": {
      "put": {
        "operationId": "campaigns_personalization_edit",
        "tags": [
          "campaigns"
        ],
        "summary": "Set one person's personalized line by hand; an empty value undoes the edit. Braces are removed and text past the line's length is cut",
        "description": "Set one person's personalized line by hand; an empty value undoes the edit. Braces are removed and text past the line's length is cut.",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "From dench campaign people."
            },
            "description": "From dench campaign people."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "description": "The line's key, as in {{key}}."
                  },
                  "value": {
                    "type": "string",
                    "description": "The line to send; an empty string undoes the edit."
                  }
                },
                "required": [
                  "key",
                  "value"
                ]
              },
              "example": {
                "key": "string",
                "value": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/people/{enrollmentId}/personalization/rewrite": {
      "post": {
        "operationId": "campaigns_personalization_rewrite",
        "tags": [
          "campaigns"
        ],
        "summary": "Write a fresh personalized line for one person: one key, or all of their lines when key is left out. About 3 cents",
        "description": "Write a fresh personalized line for one person: one key, or all of their lines when key is left out. About 3 cents.",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "From dench campaign people."
            },
            "description": "From dench campaign people."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "description": "One line's key; leave out to rewrite all of their lines.",
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "queued": {
                      "type": "boolean",
                      "description": "False when new lines are already being written."
                    }
                  },
                  "required": [
                    "queued"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/people": {
      "post": {
        "operationId": "campaigns_people_addFromCrm",
        "tags": [
          "campaigns"
        ],
        "summary": "Add CRM records (up to 100 ids per call) to a campaign; returns how many were added and why others were skipped",
        "description": "Add CRM records (up to 100 ids per call) to a campaign; returns how many were added and why others were skipped.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objectName": {
                    "type": "string",
                    "description": "CRM object the ids belong to, e.g. lead or people."
                  },
                  "entryIds": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "emailFieldName": {
                    "description": "Column holding the email when it is not \"Email\".",
                    "type": "string"
                  },
                  "linkedinUrlFieldName": {
                    "description": "Column holding the LinkedIn profile URL.",
                    "type": "string"
                  },
                  "nameFieldName": {
                    "type": "string"
                  },
                  "relationFieldName": {
                    "description": "Follow this relation to the person record first.",
                    "type": "string"
                  },
                  "relationDirection": {
                    "type": "string",
                    "const": "reverse"
                  },
                  "checkDuplicatesAcrossWorkspace": {
                    "description": "Default true: skip people active in another campaign.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "objectName",
                  "entryIds"
                ]
              },
              "example": {
                "sequenceId": "<sequenceId>",
                "objectName": "lead",
                "entryIds": [
                  "<entryId1>",
                  "<entryId2>"
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "added": {
                      "type": "number"
                    },
                    "requested": {
                      "type": "number"
                    },
                    "cappedAtLimit": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The campaign's people cap when it cut the batch short (300), else null."
                    },
                    "duplicates": {
                      "type": "number",
                      "description": "Already in this campaign."
                    },
                    "merged": {
                      "type": "number",
                      "description": "Duplicates that gained a missing email or LinkedIn URL."
                    },
                    "duplicatesElsewhere": {
                      "type": "number",
                      "description": "Active in another campaign; skipped unless checkDuplicatesAcrossWorkspace is false."
                    },
                    "suppressed": {
                      "type": "number"
                    },
                    "invalid": {
                      "type": "number"
                    },
                    "skippedNoIdentity": {
                      "type": "number",
                      "description": "No usable email or LinkedIn URL on the record."
                    },
                    "skippedSample": {
                      "type": "number"
                    },
                    "skippedMissingInfo": {
                      "type": "number",
                      "description": "Launched campaigns only: a merge token the steps use is empty for them."
                    },
                    "missingInfoSample": {
                      "type": "object",
                      "properties": {
                        "displayName": {
                          "type": "string"
                        },
                        "missingKeys": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "missingKeys"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "added",
                    "requested",
                    "cappedAtLimit",
                    "duplicates",
                    "merged",
                    "duplicatesElsewhere",
                    "suppressed",
                    "invalid",
                    "skippedNoIdentity",
                    "skippedSample",
                    "skippedMissingInfo"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/person": {
      "post": {
        "operationId": "campaigns_people_add",
        "tags": [
          "campaigns"
        ],
        "summary": "Add one person by email and/or LinkedIn profile URL",
        "description": "Add one person by email and/or LinkedIn profile URL.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "displayName": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "linkedinProfileUrl": {
                    "type": "string"
                  },
                  "entryId": {
                    "description": "Existing CRM people entry to link.",
                    "type": "string"
                  },
                  "sourceEntryId": {
                    "type": "string"
                  },
                  "sourceObjectName": {
                    "type": "string"
                  },
                  "emailIdentityId": {
                    "type": "string"
                  },
                  "linkedinIdentityId": {
                    "type": "string"
                  },
                  "linkedinProviderUserId": {
                    "type": "string"
                  },
                  "newRecordsObject": {
                    "description": "CRM object a new record is created in when none matches.",
                    "type": "string",
                    "enum": [
                      "lead",
                      "people"
                    ]
                  },
                  "personalization": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "checkDuplicatesAcrossWorkspace": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "sequenceId": "<sequenceId>",
                "displayName": "Ada Lovelace",
                "email": "ada@example.com",
                "linkedinProfileUrl": "https://linkedin.com/in/ada"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "enrollmentId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "enrollmentId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/preview": {
      "get": {
        "operationId": "campaigns_preview",
        "tags": [
          "campaigns"
        ],
        "summary": "Show the message one person gets at one email or LinkedIn step, with their fields and personalized lines filled in: subject, body, sender, recipient, merge fields still missing, warnings, and why the step would be skipped. Nothing is sent, prepared or charged",
        "description": "Show the message one person gets at one email or LinkedIn step, with their fields and personalized lines filled in: subject, body, sender, recipient, merge fields still missing, warnings, and why the step would be skipped. Nothing is sent, prepared or charged.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "enrollmentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The person to preview, from dench campaign people."
            },
            "description": "The person to preview, from dench campaign people."
          },
          {
            "name": "stepId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "An email or LinkedIn step, its _id from campaigns.get steps[]. A wait step sends nothing."
            },
            "description": "An email or LinkedIn step, its _id from campaigns.get steps[]. A wait step sends nothing."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "enum": [
                        "email",
                        "linkedin"
                      ]
                    },
                    "subject": {
                      "description": "Email steps.",
                      "type": "string"
                    },
                    "textBody": {
                      "description": "Email steps: plain text.",
                      "type": "string"
                    },
                    "htmlBody": {
                      "description": "Email steps: HTML.",
                      "type": "string"
                    },
                    "messageBody": {
                      "description": "LinkedIn steps: the note or message, or a line saying no note or message is sent.",
                      "type": "string"
                    },
                    "fromName": {
                      "description": "The sending account.",
                      "type": "string"
                    },
                    "fromEmail": {
                      "type": "string"
                    },
                    "toName": {
                      "type": "string"
                    },
                    "toEmail": {
                      "type": "string"
                    },
                    "missingFields": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "{{merge fields}} this person has no value for; fill them with campaigns.people.setField."
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "skippedReason": {
                      "description": "Set when the person would skip this step, e.g. no email address.",
                      "type": "string"
                    },
                    "highlights": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "personalized": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "description": "The line's {{key}}."
                          },
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string",
                            "description": "What this person gets: the written line, or the fallback."
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "written",
                              "edited",
                              "writing",
                              "paused",
                              "fallback",
                              "not_written"
                            ],
                            "description": "written or edited: the line is final. fallback: nothing specific was found, so the fallback is used. writing, paused and not_written: the fallback shows until the line is written."
                          },
                          "source": {
                            "description": "What the line was written from.",
                            "type": "string",
                            "enum": [
                              "company",
                              "news",
                              "signal",
                              "profile",
                              "fallback"
                            ]
                          },
                          "maxChars": {
                            "type": "number"
                          },
                          "rewriting": {
                            "description": "A new line is being written over the current one.",
                            "type": "string",
                            "enum": [
                              "writing",
                              "paused"
                            ]
                          }
                        },
                        "required": [
                          "key",
                          "label",
                          "value",
                          "state",
                          "maxChars"
                        ],
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "channel",
                    "toName",
                    "missingFields",
                    "warnings"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "channel": "email",
                  "subject": "A quicker question, Grace",
                  "textBody": "Hi Grace,\n\nYour team at Acme is hiring senior engineers. We place them in your time zone within two weeks.\n\nWorth a chat?",
                  "htmlBody": "<p>Hi Grace,</p><p>Your team at Acme is hiring senior engineers. We place them in your time zone within two weeks.</p><p>Worth a chat?</p>",
                  "fromName": "Ada Lovelace",
                  "fromEmail": "ada@example.com",
                  "toName": "Grace Hopper",
                  "toEmail": "grace@acme.com",
                  "missingFields": [],
                  "warnings": [],
                  "personalized": [
                    {
                      "key": "companyHook",
                      "label": "Company hook",
                      "value": "Acme is hiring senior engineers.",
                      "state": "written",
                      "source": "company",
                      "maxChars": 160
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/launch": {
      "get": {
        "operationId": "campaigns_launch_preview",
        "tags": [
          "campaigns"
        ],
        "summary": "Launch readiness without launching: blockers grouped by problem, warnings, and the fingerprint `launch` requires",
        "description": "Launch readiness without launching: blockers grouped by problem, warnings, and the fingerprint `launch` requires.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ready": {
                      "type": "boolean"
                    },
                    "fingerprint": {
                      "type": "string",
                      "description": "Pass this to `launch`; it changes whenever the campaign changes."
                    },
                    "blockingReasons": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "blockers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "sequence",
                              "step",
                              "person"
                            ]
                          },
                          "target": {
                            "type": "string",
                            "enum": [
                              "sequence",
                              "people",
                              "schedule"
                            ]
                          },
                          "title": {
                            "type": "string"
                          },
                          "hint": {
                            "type": "string"
                          },
                          "stepIndex": {
                            "type": "number"
                          },
                          "people": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "enrollmentId": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "name"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "count": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "code",
                          "scope",
                          "target",
                          "title",
                          "people",
                          "count"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "stepCount": {
                      "type": "number"
                    },
                    "audienceCount": {
                      "type": "number"
                    },
                    "usesEmail": {
                      "type": "boolean"
                    },
                    "usesLinkedin": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ready",
                    "fingerprint",
                    "blockingReasons",
                    "blockers",
                    "warnings",
                    "stepCount",
                    "audienceCount",
                    "usesEmail",
                    "usesLinkedin"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "campaigns_launch",
        "tags": [
          "campaigns"
        ],
        "summary": "Launch a ready draft. Pass the fingerprint from the preview and acknowledge the LinkedIn notice when LinkedIn steps exist",
        "description": "Launch a ready draft. Pass the fingerprint from the preview and acknowledge the LinkedIn notice when LinkedIn steps exist.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fingerprint": {
                    "type": "string",
                    "description": "From the launch preview."
                  },
                  "linkedinRiskAcknowledged": {
                    "description": "Required when the campaign has LinkedIn steps.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "fingerprint"
                ]
              },
              "example": {
                "sequenceId": "<sequenceId>",
                "fingerprint": "<fingerprint from the launch preview>",
                "linkedinRiskAcknowledged": true
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "const": "active"
                    }
                  },
                  "required": [
                    "ok",
                    "status"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/pause": {
      "post": {
        "operationId": "campaigns_pause",
        "tags": [
          "campaigns"
        ],
        "summary": "Pause an active campaign",
        "description": "Pause an active campaign.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/resume": {
      "post": {
        "operationId": "campaigns_resume",
        "tags": [
          "campaigns"
        ],
        "summary": "Resume a paused campaign",
        "description": "Resume a paused campaign.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/archive": {
      "post": {
        "operationId": "campaigns_archive",
        "tags": [
          "campaigns"
        ],
        "summary": "Archive a campaign and stop everyone still in flight. This is the app's Delete: campaigns are never erased, and their people, leads and activity stay",
        "description": "Archive a campaign and stop everyone still in flight. This is the app's Delete: campaigns are never erased, and their people, leads and activity stay.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/events": {
      "get": {
        "operationId": "campaigns_events",
        "tags": [
          "campaigns"
        ],
        "summary": "The campaign's activity log, newest first (sent, accepted, replied, skipped, failed, paused, stopped)",
        "description": "The campaign's activity log, newest first (sent, accepted, replied, skipped, failed, paused, stopped).",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "numItems",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Page size, default 50.",
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "description": "Page size, default 50."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "description": "continueCursor from the previous page.",
              "type": "string"
            },
            "description": "continueCursor from the previous page."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    "isDone": {
                      "type": "boolean"
                    },
                    "continueCursor": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "page",
                    "isDone",
                    "continueCursor"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/people/{enrollmentId}/stop": {
      "post": {
        "operationId": "campaigns_people_stop",
        "tags": [
          "campaigns"
        ],
        "summary": "Stop one person: nothing more is sent to them from this campaign",
        "description": "Stop one person: nothing more is sent to them from this campaign.",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/people/{enrollmentId}/resume": {
      "post": {
        "operationId": "campaigns_people_resume",
        "tags": [
          "campaigns"
        ],
        "summary": "Resume one paused person in an active campaign",
        "description": "Resume one paused person in an active campaign.",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/people/{enrollmentId}/email": {
      "put": {
        "operationId": "campaigns_people_setEmail",
        "tags": [
          "campaigns"
        ],
        "summary": "Give a person in a draft campaign a new or corrected email address; their linked CRM record gets it too. Only before launch; another person in the campaign can't share it",
        "description": "Give a person in a draft campaign a new or corrected email address; their linked CRM record gets it too. Only before launch; another person in the campaign can't share it.",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "From dench campaign people."
            },
            "description": "From dench campaign people."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "The address email steps should use."
                  }
                },
                "required": [
                  "email"
                ]
              },
              "example": {
                "email": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/people/{enrollmentId}/linkedin": {
      "put": {
        "operationId": "campaigns_people_setLinkedin",
        "tags": [
          "campaigns"
        ],
        "summary": "Give a person in a draft campaign a new or corrected LinkedIn profile URL; their linked CRM record gets it too. Only before launch",
        "description": "Give a person in a draft campaign a new or corrected LinkedIn profile URL; their linked CRM record gets it too. Only before launch.",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "From dench campaign people."
            },
            "description": "From dench campaign people."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "linkedinProfileUrl": {
                    "type": "string",
                    "description": "A LinkedIn member profile URL, e.g. https://linkedin.com/in/ada."
                  }
                },
                "required": [
                  "linkedinProfileUrl"
                ]
              },
              "example": {
                "linkedinProfileUrl": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/people/{enrollmentId}/fields": {
      "put": {
        "operationId": "campaigns_people_setField",
        "tags": [
          "campaigns"
        ],
        "summary": "Fill or fix one {{merge field}} for a person in a draft campaign, e.g. a missing Company that blocks launch; a matching column on their CRM record is updated too. Only before launch; written personalized lines are not merge fields and can't be set here",
        "description": "Fill or fix one {{merge field}} for a person in a draft campaign, e.g. a missing Company that blocks launch; a matching column on their CRM record is updated too. Only before launch; written personalized lines are not merge fields and can't be set here.",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "From dench campaign people."
            },
            "description": "From dench campaign people."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "description": "The merge token name without braces, e.g. Company for {{Company}} or fund for {{fund}}."
                  },
                  "value": {
                    "type": "string",
                    "description": "Up to 2000 characters."
                  }
                },
                "required": [
                  "key",
                  "value"
                ]
              },
              "example": {
                "key": "string",
                "value": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/people/resume": {
      "post": {
        "operationId": "campaigns_people_resumeAll",
        "tags": [
          "campaigns"
        ],
        "summary": "Resume every paused person in an active campaign at once, e.g. after a sending account is reconnected. Returns how many were resumed",
        "description": "Resume every paused person in an active campaign at once, e.g. after a sending account is reconnected. Returns how many were resumed.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "An active campaign."
            },
            "description": "An active campaign."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "resumed": {
                      "type": "number",
                      "description": "How many paused people were resumed."
                    }
                  },
                  "required": [
                    "resumed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/{sequenceId}/people/sync": {
      "post": {
        "operationId": "campaigns_people_sync",
        "tags": [
          "campaigns"
        ],
        "summary": "Fill each unfinished person's empty email, LinkedIn URL, name and merge fields from their linked CRM record, e.g. after enriching the records. Never overwrites a value the campaign already has; returns how many people changed",
        "description": "Fill each unfinished person's empty email, LinkedIn URL, name and merge fields from their linked CRM record, e.g. after enriching the records. Never overwrites a value the campaign already has; returns how many people changed.",
        "parameters": [
          {
            "name": "sequenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "updated": {
                      "type": "number",
                      "description": "How many people gained a detail from their CRM record."
                    }
                  },
                  "required": [
                    "updated"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/by-record/{entryId}": {
      "get": {
        "operationId": "campaigns_people_forRecord",
        "tags": [
          "campaigns"
        ],
        "summary": "The campaigns a CRM record (a person or a lead) is in, newest first, with the person's status in each and the accounts that send to them",
        "description": "The campaigns a CRM record (a person or a lead) is in, newest first, with the person's status in each and the accounts that send to them.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "A CRM record's _id: a person, or a lead created from one."
            },
            "description": "A CRM record's _id: a person, or a lead created from one."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "enrollment": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {},
                        "description": "The person in that campaign: _id, sequenceId, status, currentStepIndex, repliedAt."
                      },
                      "sequenceName": {
                        "type": "string"
                      },
                      "isOwner": {
                        "type": "boolean"
                      },
                      "canManage": {
                        "type": "boolean"
                      },
                      "senders": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "accountId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string",
                                    "description": "The mailbox address or LinkedIn name."
                                  },
                                  "status": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "accountId",
                                  "label",
                                  "status"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "linkedin": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "accountId": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string",
                                    "description": "The mailbox address or LinkedIn name."
                                  },
                                  "status": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "accountId",
                                  "label",
                                  "status"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "email",
                          "linkedin"
                        ],
                        "additionalProperties": false,
                        "description": "The accounts that send to this person."
                      }
                    },
                    "required": [
                      "enrollment",
                      "sequenceName",
                      "isOwner",
                      "canManage",
                      "senders"
                    ],
                    "additionalProperties": {}
                  }
                },
                "example": [
                  {
                    "enrollment": {
                      "_id": "<enrollmentId>",
                      "sequenceId": "<sequenceId>",
                      "displayName": "Grace Hopper",
                      "status": "active",
                      "currentStepIndex": 1
                    },
                    "sequenceName": "Founder outreach",
                    "isOwner": true,
                    "canManage": true,
                    "senders": {
                      "email": {
                        "accountId": "<emailMailboxAccountId>",
                        "label": "ada@example.com",
                        "status": "running"
                      },
                      "linkedin": null
                    }
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/people/{enrollmentId}/timeline": {
      "get": {
        "operationId": "campaigns_people_timeline",
        "tags": [
          "campaigns"
        ],
        "summary": "Everything a campaign did for one person, step by step: what was sent (subject and text), whether it was opened or clicked, what was skipped and why, waits, failures and retries",
        "description": "Everything a campaign did for one person, step by step: what was sent (subject and text), whether it was opened or clicked, what was skipped and why, waits, failures and retries.",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "From dench campaign people."
            },
            "description": "From dench campaign people."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "enrollment": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {},
                      "description": "The person in this campaign: status, lastError, repliedAt."
                    },
                    "sequence": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "steps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "wait",
                              "email",
                              "linkedin_connection",
                              "linkedin_message",
                              "linkedin_visit",
                              "linkedin_like_post",
                              "linkedin_inmail",
                              "condition",
                              "wait_for_connection"
                            ],
                            "description": "Step type. condition (If / else) and wait_for_connection (Wait for them to accept) send nothing; they continue on yesNext or noNext and make the campaign a workflow."
                          },
                          "waitHours": {
                            "description": "wait steps: hours to wait before the next step.",
                            "type": "number"
                          },
                          "emailMailboxAccountId": {
                            "description": "Legacy email step sender. Pool campaigns choose senders in emailMailboxAccountIds on the campaign, not on individual steps.",
                            "type": "string"
                          },
                          "emailSubject": {
                            "description": "email steps: subject; {{Column}} merge tokens allowed.",
                            "type": "string"
                          },
                          "emailHtmlBody": {
                            "description": "email steps: HTML body. Sent instead of emailTextBody when both are set, so when you edit the text, update or drop this too.",
                            "type": "string"
                          },
                          "emailTextBody": {
                            "description": "email steps: plain-text body; used as the email when there is no emailHtmlBody.",
                            "type": "string"
                          },
                          "emailReplyToPrevious": {
                            "description": "email steps: thread under the previous email step instead of a new subject.",
                            "type": "boolean"
                          },
                          "onlyIf": {
                            "description": "email and linkedin_like_post only: always (default), connected or not_connected. InMail automatically skips connected people; do not set a condition on it.",
                            "type": "string",
                            "enum": [
                              "always",
                              "connected",
                              "not_connected"
                            ]
                          },
                          "linkedinAccountId": {
                            "description": "Legacy LinkedIn step sender (also on wait_for_connection, and on a condition that checks linkedin_connected). Pool campaigns use the campaign's linkedinAccountIds instead.",
                            "type": "string"
                          },
                          "linkedinMessageBody": {
                            "description": "linkedin_connection: the invite note (optional, up to 300 chars; sent without it if LinkedIn refuses the note); linkedin_message: the required message (up to 3000 chars); linkedin_inmail: the required message (up to 1900 chars).",
                            "type": "string"
                          },
                          "linkedinMessageMode": {
                            "description": "linkedin_message: what to do when the invite is still pending.",
                            "type": "string",
                            "enum": [
                              "skip_if_not_connected",
                              "wait_until_connected"
                            ]
                          },
                          "connectionTimeoutHours": {
                            "description": "linkedin_message with linkedinMessageMode=wait_until_connected: wait 1-2160 hours for acceptance (default 720); after a connection step this mode is the default in a linear campaign. wait_for_connection: wait 24-2160 hours (1-90 days, default 720) before taking the Not accepted path.",
                            "type": "number",
                            "minimum": 1,
                            "maximum": 2160
                          },
                          "likeReaction": {
                            "description": "linkedin_like_post only: the reaction to leave (default like).",
                            "type": "string",
                            "enum": [
                              "like",
                              "celebrate",
                              "support",
                              "love",
                              "insightful",
                              "funny"
                            ]
                          },
                          "likeMaxPostAgeDays": {
                            "description": "linkedin_like_post only: select the newest eligible original post from the last 1-365 days (default 30).",
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 365
                          },
                          "likeSkipPreviousWait": {
                            "description": "linkedin_like_post only: before the immediately preceding wait starts, check for eligible posts. If none exist, skip that wait and the like step, keeping following waits. Defaults to false when omitted.",
                            "type": "boolean"
                          },
                          "likeSkipNextWait": {
                            "description": "linkedin_like_post only: skip consecutive following wait steps whenever the reaction step is skipped (default true). False keeps those waits.",
                            "type": "boolean"
                          },
                          "likeCount": {
                            "description": "linkedin_like_post only: how many recent posts to react to, 1-3 (default 1).",
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3
                          },
                          "inmailSubject": {
                            "description": "linkedin_inmail only: optional subject, up to 200 characters; merge tokens allowed. Clear with an empty string.",
                            "type": "string"
                          },
                          "withdrawAfterHours": {
                            "description": "linkedin_connection only: withdraw a still-pending invitation sent by this campaign after 168-2160 hours (7-90 days). Omitted means off on creation; null turns it off on edit.",
                            "anyOf": [
                              {
                                "type": "number",
                                "minimum": 168,
                                "maximum": 2160
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "key": {
                            "description": "Workflow steps: this step's id, unique in the campaign, which next, yesNext and noNext point at (not \"end\"). Left out, one is made.",
                            "type": "string",
                            "minLength": 1
                          },
                          "next": {
                            "description": "Workflow steps: where a step that isn't a condition or wait_for_connection goes; left out, the following step: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                            "type": "string",
                            "minLength": 1
                          },
                          "yesNext": {
                            "description": "Workflow steps: condition and wait_for_connection only, required: where the Yes (Accepted) path goes: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                            "type": "string",
                            "minLength": 1
                          },
                          "noNext": {
                            "description": "Workflow steps: condition and wait_for_connection only, required: where the No (Not accepted) path goes: another step's key, or \"end\" to stop there. Fixed once the campaign launches.",
                            "type": "string",
                            "minLength": 1
                          },
                          "check": {
                            "description": "condition only, required: linkedin_connected, has_email, opened_last_email (needs an email before it on every path) or field_value. Fixed once the campaign launches.",
                            "type": "string",
                            "enum": [
                              "linkedin_connected",
                              "has_email",
                              "opened_last_email",
                              "field_value"
                            ]
                          },
                          "conditionField": {
                            "description": "condition with check=field_value: the lead field to check, like \"Job Title\" or \"Source\" (the campaign itself changes Status, Last touch and LinkedIn connection). Fixed once the campaign launches.",
                            "type": "string"
                          },
                          "conditionOperator": {
                            "description": "condition with check=field_value: is, is_not, contains, is_empty or is_not_empty (all case-insensitive). Fixed once the campaign launches.",
                            "type": "string",
                            "enum": [
                              "is",
                              "is_not",
                              "is_empty",
                              "is_not_empty",
                              "contains"
                            ]
                          },
                          "conditionValue": {
                            "description": "condition with check=field_value and is, is_not or contains: the text to compare with. Editable after launch.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": {}
                      },
                      "description": "The campaign's steps in order, each with its _id."
                    },
                    "runs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "stepId": {
                            "type": "string",
                            "description": "The step's _id, as in steps[]."
                          },
                          "stepIndex": {
                            "type": "number",
                            "description": "The step's place, from 0."
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "wait",
                              "email",
                              "linkedin_connection",
                              "linkedin_message",
                              "linkedin_visit",
                              "linkedin_like_post",
                              "linkedin_inmail",
                              "condition",
                              "wait_for_connection"
                            ],
                            "description": "Step type. condition (If / else) and wait_for_connection (Wait for them to accept) send nothing; they continue on yesNext or noNext and make the campaign a workflow."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "queued",
                              "running",
                              "waiting",
                              "retry",
                              "sent",
                              "skipped",
                              "failed",
                              "unknown"
                            ],
                            "description": "sent: done (a wait that finished is sent too). skipped: see result.reason. retry: will be tried again at retryAt. unknown: needs a look."
                          },
                          "scheduledAt": {
                            "type": "number"
                          },
                          "startedAt": {
                            "type": "number"
                          },
                          "waitUntil": {
                            "type": "number"
                          },
                          "retryAt": {
                            "type": "number"
                          },
                          "completedAt": {
                            "type": "number"
                          },
                          "emailMessageId": {
                            "description": "The email this run sent, in emailMessages[].",
                            "type": "string"
                          },
                          "lastError": {
                            "type": "string"
                          },
                          "timeoutAt": {
                            "description": "wait_for_connection: when it stops waiting for the accept.",
                            "type": "number"
                          },
                          "result": {
                            "description": "For a skipped step, { reason } says why. A finished condition or wait_for_connection has { branch: \"yes\" | \"no\" } (Yes / Accepted or No / Not accepted), and { reason } for some No paths."
                          }
                        },
                        "required": [
                          "_id",
                          "stepId",
                          "stepIndex",
                          "type",
                          "status"
                        ],
                        "additionalProperties": {}
                      },
                      "description": "One run for each step the person has reached, in order."
                    },
                    "emailMessages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "description": "The emails those runs sent: subject, textBody, status, sentAt, firstOpenedAt, firstClickedAt."
                    },
                    "linkedinMessages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "description": "The LinkedIn messages those runs sent: text, sentAt, deliveredAt, readAt, outreachStepRunId."
                    }
                  },
                  "required": [
                    "enrollment",
                    "sequence",
                    "steps",
                    "runs",
                    "emailMessages",
                    "linkedinMessages"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "enrollment": {
                    "_id": "<enrollmentId>",
                    "displayName": "Grace Hopper",
                    "status": "active"
                  },
                  "sequence": {
                    "_id": "<sequenceId>",
                    "name": "Founder outreach"
                  },
                  "steps": [
                    {
                      "_id": "<stepId1>",
                      "order": 0,
                      "type": "email",
                      "emailSubject": "Hello"
                    },
                    {
                      "_id": "<stepId2>",
                      "order": 1,
                      "type": "wait",
                      "waitHours": 72
                    }
                  ],
                  "runs": [
                    {
                      "_id": "<runId1>",
                      "stepId": "<stepId1>",
                      "stepIndex": 0,
                      "type": "email",
                      "status": "sent",
                      "completedAt": 1765526400000,
                      "emailMessageId": "<emailId1>"
                    },
                    {
                      "_id": "<runId2>",
                      "stepId": "<stepId2>",
                      "stepIndex": 1,
                      "type": "wait",
                      "status": "waiting",
                      "waitUntil": 1765785600000
                    }
                  ],
                  "emailMessages": [
                    {
                      "_id": "<emailId1>",
                      "subject": "Hello",
                      "textBody": "Hi Grace, ...",
                      "status": "opened",
                      "sentAt": 1765526400000,
                      "firstOpenedAt": 1765530000000
                    }
                  ],
                  "linkedinMessages": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/campaigns/people/{enrollmentId}": {
      "delete": {
        "operationId": "campaigns_people_remove",
        "tags": [
          "campaigns"
        ],
        "summary": "Remove a person who was never contacted from a draft campaign. Frees their place in the 300-person cap and keeps the draft launchable; stop anyone already contacted instead",
        "description": "Remove a person who was never contacted from a draft campaign. Frees their place in the 300-person cap and keeps the draft launchable; stop anyone already contacted instead.",
        "parameters": [
          {
            "name": "enrollmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "From dench campaign people; the person must never have been contacted."
            },
            "description": "From dench campaign people; the person must never have been contacted."
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/routines": {
      "get": {
        "operationId": "cron_list",
        "tags": [
          "routines"
        ],
        "summary": "List routines",
        "description": "List routines.",
        "parameters": [
          {
            "name": "enabledOnly",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "deleteAfterRun": {
                            "type": "boolean"
                          },
                          "createdAtMs": {
                            "type": "number"
                          },
                          "updatedAtMs": {
                            "type": "number"
                          },
                          "schedule": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "every"
                                  },
                                  "everyMs": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991,
                                    "description": "Interval in milliseconds (1s to 365d)."
                                  },
                                  "anchorMs": {
                                    "description": "Optional anchor timestamp for the recurring fire.",
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "everyMs"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "cron"
                                  },
                                  "expr": {
                                    "type": "string",
                                    "description": "5-field POSIX cron expression."
                                  },
                                  "tz": {
                                    "description": "IANA timezone, e.g. America/New_York.",
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "expr"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "at"
                                  },
                                  "at": {
                                    "type": "string",
                                    "description": "ISO 8601 timestamp for a one-shot run."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "at"
                                ],
                                "additionalProperties": false
                              }
                            ],
                            "description": "Schedule: recurring (`every`), cron expression, or one-shot (`at`)."
                          },
                          "sessionTarget": {
                            "type": "string"
                          },
                          "wakeMode": {
                            "type": "string"
                          },
                          "payload": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "agentTurn"
                                  },
                                  "message": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "message"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "systemEvent"
                                  },
                                  "text": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "text"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          },
                          "state": {
                            "type": "object",
                            "properties": {
                              "nextRunAtMs": {
                                "type": "number"
                              },
                              "runningAtMs": {
                                "type": "number"
                              },
                              "lastRunAtMs": {
                                "type": "number"
                              },
                              "lastStatus": {
                                "type": "string",
                                "enum": [
                                  "ok",
                                  "error",
                                  "skipped"
                                ]
                              },
                              "lastError": {
                                "type": "string"
                              },
                              "lastDurationMs": {
                                "type": "number"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "enabled",
                          "deleteAfterRun",
                          "createdAtMs",
                          "updatedAtMs",
                          "sessionTarget",
                          "wakeMode",
                          "payload",
                          "state"
                        ],
                        "additionalProperties": {},
                        "description": "A routine (cron trigger)."
                      }
                    },
                    "cronStatus": {
                      "type": "object",
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "nextWakeAtMs": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "enabled",
                        "nextWakeAtMs"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "jobs",
                    "cronStatus"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "jobs": [
                    {
                      "id": "trg_cron001",
                      "name": "Daily digest",
                      "enabled": true,
                      "deleteAfterRun": false,
                      "createdAtMs": 1765526400000,
                      "updatedAtMs": 1765526400000,
                      "schedule": {
                        "kind": "cron",
                        "expr": "0 9 * * *",
                        "tz": "America/New_York"
                      },
                      "sessionTarget": "isolated",
                      "wakeMode": "now",
                      "payload": {
                        "kind": "agentTurn",
                        "message": "Summarize open CRM tasks."
                      },
                      "state": {
                        "nextRunAtMs": 1765612800000,
                        "lastStatus": "ok"
                      }
                    }
                  ],
                  "cronStatus": {
                    "enabled": true,
                    "nextWakeAtMs": 1765612800000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "cron_create",
        "tags": [
          "routines"
        ],
        "summary": "Create routine",
        "description": "Create a routine.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "Agent goal/message for each run."
                  },
                  "schedule": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "every"
                          },
                          "everyMs": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991,
                            "description": "Interval in milliseconds (1s to 365d)."
                          },
                          "anchorMs": {
                            "description": "Optional anchor timestamp for the recurring fire.",
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "everyMs"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "cron"
                          },
                          "expr": {
                            "type": "string",
                            "description": "5-field POSIX cron expression."
                          },
                          "tz": {
                            "description": "IANA timezone, e.g. America/New_York.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "expr"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "at"
                          },
                          "at": {
                            "type": "string",
                            "description": "ISO 8601 timestamp for a one-shot run."
                          }
                        },
                        "required": [
                          "kind",
                          "at"
                        ],
                        "additionalProperties": false
                      }
                    ],
                    "description": "Schedule: recurring (`every`), cron expression, or one-shot (`at`)."
                  },
                  "description": {
                    "type": "string"
                  },
                  "overlapPolicy": {
                    "type": "string",
                    "enum": [
                      "skip",
                      "queue",
                      "kill_old"
                    ],
                    "description": "What to do when a previous run is still active. Defaults to `skip`."
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "deleteAfterRun": {
                    "type": "boolean"
                  },
                  "target": {
                    "type": "string",
                    "const": "chat_turn",
                    "description": "Routine run target."
                  }
                },
                "required": [
                  "name",
                  "prompt",
                  "schedule"
                ]
              },
              "example": {
                "name": "Daily digest",
                "prompt": "Summarize open CRM tasks.",
                "schedule": {
                  "kind": "every",
                  "everyMs": 86400000
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "nextFireAt": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "jobId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "jobId": "trg_cron001",
                  "nextFireAt": 1765612800000
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/routines/history": {
      "get": {
        "operationId": "cron_history",
        "tags": [
          "routines"
        ],
        "summary": "Run history",
        "description": "List routine run history.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ts": {
                            "type": "number"
                          },
                          "jobId": {
                            "type": "string"
                          },
                          "action": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "ok",
                              "error",
                              "skipped",
                              "running"
                            ]
                          },
                          "error": {
                            "type": "string"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "sessionId": {
                            "type": "string"
                          },
                          "runAtMs": {
                            "type": "number"
                          },
                          "durationMs": {
                            "type": "number"
                          },
                          "nextRunAtMs": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "ts",
                          "jobId",
                          "action"
                        ],
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "entries"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "entries": [
                    {
                      "ts": 1765526400000,
                      "jobId": "trg_cron001",
                      "action": "finished",
                      "status": "ok",
                      "summary": "Summarized 3 open tasks.",
                      "sessionId": "th_abc123",
                      "runAtMs": 1765526350000,
                      "durationMs": 45000,
                      "nextRunAtMs": 1765612800000
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/routines/{jobId}": {
      "get": {
        "operationId": "cron_get",
        "tags": [
          "routines"
        ],
        "summary": "Get routine",
        "description": "Get a routine.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "deleteAfterRun": {
                      "type": "boolean"
                    },
                    "createdAtMs": {
                      "type": "number"
                    },
                    "updatedAtMs": {
                      "type": "number"
                    },
                    "schedule": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "every"
                            },
                            "everyMs": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991,
                              "description": "Interval in milliseconds (1s to 365d)."
                            },
                            "anchorMs": {
                              "description": "Optional anchor timestamp for the recurring fire.",
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "kind",
                            "everyMs"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "cron"
                            },
                            "expr": {
                              "type": "string",
                              "description": "5-field POSIX cron expression."
                            },
                            "tz": {
                              "description": "IANA timezone, e.g. America/New_York.",
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind",
                            "expr"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "at"
                            },
                            "at": {
                              "type": "string",
                              "description": "ISO 8601 timestamp for a one-shot run."
                            }
                          },
                          "required": [
                            "kind",
                            "at"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "description": "Schedule: recurring (`every`), cron expression, or one-shot (`at`)."
                    },
                    "sessionTarget": {
                      "type": "string"
                    },
                    "wakeMode": {
                      "type": "string"
                    },
                    "payload": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "agentTurn"
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind",
                            "message"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "systemEvent"
                            },
                            "text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind",
                            "text"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "state": {
                      "type": "object",
                      "properties": {
                        "nextRunAtMs": {
                          "type": "number"
                        },
                        "runningAtMs": {
                          "type": "number"
                        },
                        "lastRunAtMs": {
                          "type": "number"
                        },
                        "lastStatus": {
                          "type": "string",
                          "enum": [
                            "ok",
                            "error",
                            "skipped"
                          ]
                        },
                        "lastError": {
                          "type": "string"
                        },
                        "lastDurationMs": {
                          "type": "number"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "enabled",
                    "deleteAfterRun",
                    "createdAtMs",
                    "updatedAtMs",
                    "sessionTarget",
                    "wakeMode",
                    "payload",
                    "state"
                  ],
                  "additionalProperties": {},
                  "description": "A routine (cron trigger)."
                },
                "example": {
                  "id": "trg_cron001",
                  "name": "Daily digest",
                  "enabled": true,
                  "deleteAfterRun": false,
                  "createdAtMs": 1765526400000,
                  "updatedAtMs": 1765526400000,
                  "schedule": {
                    "kind": "every",
                    "everyMs": 86400000
                  },
                  "sessionTarget": "isolated",
                  "wakeMode": "now",
                  "payload": {
                    "kind": "agentTurn",
                    "message": "Summarize open CRM tasks."
                  },
                  "state": {
                    "nextRunAtMs": 1765612800000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "cron_update",
        "tags": [
          "routines"
        ],
        "summary": "Update routine",
        "description": "Update a routine.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "schedule": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "every"
                          },
                          "everyMs": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991,
                            "description": "Interval in milliseconds (1s to 365d)."
                          },
                          "anchorMs": {
                            "description": "Optional anchor timestamp for the recurring fire.",
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "everyMs"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "cron"
                          },
                          "expr": {
                            "type": "string",
                            "description": "5-field POSIX cron expression."
                          },
                          "tz": {
                            "description": "IANA timezone, e.g. America/New_York.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "expr"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "at"
                          },
                          "at": {
                            "type": "string",
                            "description": "ISO 8601 timestamp for a one-shot run."
                          }
                        },
                        "required": [
                          "kind",
                          "at"
                        ],
                        "additionalProperties": false
                      }
                    ],
                    "description": "Schedule: recurring (`every`), cron expression, or one-shot (`at`)."
                  },
                  "description": {
                    "type": "string"
                  },
                  "overlapPolicy": {
                    "type": "string",
                    "enum": [
                      "skip",
                      "queue",
                      "kill_old"
                    ],
                    "description": "What to do when a previous run is still active. Defaults to `skip`."
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "deleteAfterRun": {
                    "type": "boolean"
                  },
                  "target": {
                    "type": "string",
                    "const": "chat_turn",
                    "description": "Routine run target."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "nextFireAt": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "jobId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "jobId": "trg_cron001",
                  "nextFireAt": 1765612800000
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "cron_delete",
        "tags": [
          "routines"
        ],
        "summary": "Delete routine",
        "description": "Delete a routine.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/routines/{jobId}/enable": {
      "post": {
        "operationId": "cron_enable",
        "tags": [
          "routines"
        ],
        "summary": "Enable routine",
        "description": "Enable a routine.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "nextFireAt": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "jobId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "jobId": "trg_cron001",
                  "nextFireAt": 1765612800000
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/routines/{jobId}/disable": {
      "post": {
        "operationId": "cron_disable",
        "tags": [
          "routines"
        ],
        "summary": "Disable routine",
        "description": "Disable a routine.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "nextFireAt": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "jobId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "jobId": "trg_cron001"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/routines/{jobId}/run": {
      "post": {
        "operationId": "cron_run",
        "tags": [
          "routines"
        ],
        "summary": "Run routine",
        "description": "Run a routine now.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runId": {
                      "type": "string"
                    },
                    "threadId": {
                      "type": "string"
                    },
                    "target": {
                      "type": "string",
                      "const": "chat_turn"
                    }
                  },
                  "required": [
                    "runId",
                    "threadId",
                    "target"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "runId": "rn_def456",
                  "threadId": "th_abc123",
                  "target": "chat_turn"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/routines/{jobId}/runs": {
      "get": {
        "operationId": "cron_runs",
        "tags": [
          "routines"
        ],
        "summary": "List runs",
        "description": "List runs for a routine.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ts": {
                            "type": "number"
                          },
                          "jobId": {
                            "type": "string"
                          },
                          "action": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "ok",
                              "error",
                              "skipped",
                              "running"
                            ]
                          },
                          "error": {
                            "type": "string"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "sessionId": {
                            "type": "string"
                          },
                          "runAtMs": {
                            "type": "number"
                          },
                          "durationMs": {
                            "type": "number"
                          },
                          "nextRunAtMs": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "ts",
                          "jobId",
                          "action"
                        ],
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "entries"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "entries": [
                    {
                      "ts": 1765526400000,
                      "jobId": "trg_cron001",
                      "action": "finished",
                      "status": "ok",
                      "runAtMs": 1765526350000,
                      "durationMs": 45000
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/files": {
      "get": {
        "operationId": "files_list",
        "tags": [
          "files"
        ],
        "summary": "List files",
        "description": "List workspace files.",
        "parameters": [
          {
            "name": "prefix",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Directory path, defaults to /.",
              "type": "string"
            },
            "description": "Directory path, defaults to /."
          },
          {
            "name": "slug",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "_creationTime": {
                        "type": "number"
                      },
                      "path": {
                        "type": "string"
                      },
                      "parentPath": {
                        "type": "string"
                      },
                      "isDir": {
                        "type": "boolean"
                      },
                      "size": {
                        "type": "number"
                      },
                      "mtime": {
                        "type": "number"
                      },
                      "contentHash": {
                        "type": "string"
                      },
                      "storageId": {
                        "type": "string"
                      },
                      "lastModifiedBy": {
                        "type": "string"
                      },
                      "virtual": {
                        "description": "True for synthesized magic files (IDENTITY.md etc.).",
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "_id",
                      "_creationTime",
                      "path",
                      "parentPath",
                      "isDir"
                    ],
                    "additionalProperties": {},
                    "description": "A workspace file-tree row."
                  }
                },
                "example": [
                  {
                    "_id": "ft_abc123",
                    "_creationTime": 1765526400000,
                    "path": "/prospects",
                    "parentPath": "/",
                    "isDir": true,
                    "mtime": 1765526400000,
                    "lastModifiedBy": "user:us_xyz789"
                  },
                  {
                    "_id": "ft_def456",
                    "_creationTime": 1765526400000,
                    "path": "/README.md",
                    "parentPath": "/",
                    "isDir": false,
                    "size": 2048,
                    "mtime": 1765526400000,
                    "contentHash": "9f86d081884c7d65",
                    "lastModifiedBy": "api-v1"
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "files_delete",
        "tags": [
          "files"
        ],
        "summary": "Delete file",
        "description": "Remove a workspace file or directory.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string"
                  }
                },
                "required": [
                  "path"
                ]
              },
              "example": {
                "path": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "path"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Deleted path, or null when nothing existed at the path."
                },
                "example": {
                  "path": "/README.md"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/files/content": {
      "get": {
        "operationId": "files_content",
        "tags": [
          "files"
        ],
        "summary": "Read a workspace file's text",
        "description": "Read a workspace file's text.",
        "parameters": [
          {
            "name": "path",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Workspace file path, e.g. /reports/q2.md. A leading /workspace/ mount prefix is stripped."
            },
            "description": "Workspace file path, e.g. /reports/q2.md. A leading /workspace/ mount prefix is stripped."
          },
          {
            "name": "slug",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string"
                        },
                        "isDir": {
                          "type": "boolean"
                        },
                        "virtual": {
                          "type": "boolean"
                        },
                        "size": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "mtime": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "content": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Inline text, or null for binary / uncached files."
                        },
                        "encoding": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "contentHash": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "downloadable": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "path",
                        "isDir",
                        "virtual",
                        "size",
                        "content",
                        "encoding",
                        "downloadable"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The file, or null when nothing exists at the path."
                },
                "example": {
                  "path": "/README.md",
                  "isDir": false,
                  "virtual": false,
                  "size": 2048,
                  "content": "# Acme workspace\n",
                  "encoding": "utf-8",
                  "contentHash": "9f86d081884c7d65",
                  "downloadable": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "files_write",
        "tags": [
          "files"
        ],
        "summary": "Write a workspace file's text",
        "description": "Write a workspace file's text.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "description": "Workspace file path, e.g. /reports/q2.md. A leading /workspace/ mount prefix is stripped."
                  },
                  "content": {
                    "type": "string",
                    "description": "Full replacement text (UTF-8, <= 400 KB)."
                  },
                  "expectedPreviousHash": {
                    "description": "contentHash from the last read; the write is rejected with version_mismatch if the file changed since.",
                    "type": "string"
                  }
                },
                "required": [
                  "path",
                  "content"
                ]
              },
              "example": {
                "path": "string",
                "content": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string",
                      "description": "Normalized workspace path that was written."
                    },
                    "contentHash": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "path",
                    "contentHash"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "path": "/reports/q2.md",
                  "contentHash": "9f86d081884c7d65"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/files/download-url": {
      "get": {
        "operationId": "files_downloadUrl",
        "tags": [
          "files"
        ],
        "summary": "Download URL",
        "description": "Get a signed file download URL.",
        "parameters": [
          {
            "name": "path",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Signed download URL, or null when the file has no blob."
                },
                "example": "https://files.example.com/abc123?download=README.md"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/files/move": {
      "post": {
        "operationId": "files_move",
        "tags": [
          "files"
        ],
        "summary": "Move file",
        "description": "Move a workspace file or directory.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "description": "Source workspace path."
                  },
                  "to": {
                    "type": "string",
                    "description": "Destination workspace path."
                  }
                },
                "required": [
                  "from",
                  "to"
                ]
              },
              "example": {
                "from": "string",
                "to": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "from": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    },
                    "moved": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string"
                          },
                          "to": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "ok",
                    "from",
                    "to",
                    "moved"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "from": "/drafts/report.md",
                  "to": "/reports/q2.md",
                  "moved": [
                    {
                      "from": "/drafts/report.md",
                      "to": "/reports/q2.md"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/files/mkdir": {
      "post": {
        "operationId": "files_mkdir",
        "tags": [
          "files"
        ],
        "summary": "Create a workspace directory (and any missing parents). Idempotent",
        "description": "Create a workspace directory (and any missing parents). Idempotent.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string"
                  }
                },
                "required": [
                  "path"
                ]
              },
              "example": {
                "path": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/files/stage": {
      "post": {
        "operationId": "files_stage",
        "tags": [
          "files"
        ],
        "summary": "Stage files",
        "description": "Stage uploaded content into the workspace.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "files": {
                    "description": "Files to write. Each needs text or base64.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string"
                        },
                        "text": {
                          "type": "string"
                        },
                        "base64": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "path"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "path": {
                    "description": "Single-file shortcut.",
                    "type": "string"
                  },
                  "text": {
                    "type": "string"
                  },
                  "base64": {
                    "type": "string"
                  },
                  "lastModifiedBy": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "staged": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string"
                          },
                          "size": {
                            "type": "number"
                          },
                          "result": {
                            "type": "object",
                            "properties": {
                              "path": {
                                "type": "string"
                              },
                              "contentHash": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "path",
                              "contentHash"
                            ],
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "path",
                          "size",
                          "result"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "ok",
                    "staged"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "staged": [
                    {
                      "path": "/prospects/leads.csv",
                      "size": 1024,
                      "result": {
                        "path": "/prospects/leads.csv",
                        "contentHash": "9f86d081884c7d65"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/local/fs": {
      "post": {
        "operationId": "fs_daemon",
        "tags": [
          "local"
        ],
        "summary": "File sync daemon",
        "description": "Run the local file sync daemon.",
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local-only CLI operation. The fs daemon watches the caller's local /workspace mount.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "The fs daemon watches the caller's local /workspace mount.",
                    "type": "invalid_request_error",
                    "code": "local_only"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/search": {
      "post": {
        "operationId": "search_web",
        "tags": [
          "gateway"
        ],
        "summary": "Web search",
        "description": "Search the web through the Dench gateway.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "description": "Search query."
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "neural",
                      "fast",
                      "deep",
                      "deep-reasoning",
                      "instant"
                    ]
                  },
                  "numResults": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "category": {
                    "description": "Entity categories return structured entities. Domain filters are unsupported for people; published-date filters are unsupported for people and company.",
                    "type": "string",
                    "enum": [
                      "company",
                      "research paper",
                      "news",
                      "personal site",
                      "financial report",
                      "people"
                    ]
                  },
                  "includeDomains": {
                    "description": "Unsupported for category=people.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "excludeDomains": {
                    "description": "Unsupported for category=people.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "startPublishedDate": {
                    "description": "Unsupported for category=people and category=company.",
                    "type": "string"
                  },
                  "endPublishedDate": {
                    "description": "Unsupported for category=people and category=company.",
                    "type": "string"
                  },
                  "includeText": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "excludeText": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "userLocation": {
                    "type": "string"
                  },
                  "moderation": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "query"
                ]
              },
              "example": {
                "query": "latest AI CRM workflows",
                "numResults": 5
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "publishedDate": {
                            "type": "string"
                          },
                          "author": {
                            "type": "string"
                          },
                          "score": {
                            "type": "number"
                          },
                          "text": {
                            "type": "string"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "highlights": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "image": {
                            "type": "string"
                          },
                          "favicon": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "entities": {
                            "description": "Structured entity metadata returned by category=people or category=company.",
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "url"
                        ],
                        "additionalProperties": {},
                        "description": "A web search result."
                      }
                    },
                    "resolvedSearchType": {
                      "type": "string"
                    },
                    "autopromptString": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "costDollars": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "results"
                  ],
                  "additionalProperties": {},
                  "description": "A web search response."
                },
                "example": {
                  "results": [
                    {
                      "url": "https://example.com/ai-crm",
                      "title": "AI CRM workflows in 2026",
                      "publishedDate": "2026-05-01T00:00:00.000Z",
                      "author": "Jane Doe",
                      "id": "https://example.com/ai-crm"
                    }
                  ],
                  "resolvedSearchType": "neural",
                  "requestId": "req_abc123",
                  "costDollars": {
                    "total": 0.005
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/search/contents": {
      "post": {
        "operationId": "search_contents",
        "tags": [
          "gateway"
        ],
        "summary": "Page contents",
        "description": "Fetch page contents through the Dench gateway.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "urls": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "URLs to fetch (max 10)."
                  },
                  "text": {
                    "type": "boolean"
                  },
                  "summary": {
                    "description": "Optional per-URL summary.",
                    "type": "object",
                    "properties": {
                      "query": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "urls"
                ]
              },
              "example": {
                "urls": []
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "publishedDate": {
                            "type": "string"
                          },
                          "author": {
                            "type": "string"
                          },
                          "score": {
                            "type": "number"
                          },
                          "text": {
                            "type": "string"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "highlights": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "image": {
                            "type": "string"
                          },
                          "favicon": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "entities": {
                            "description": "Structured entity metadata returned by category=people or category=company.",
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "url"
                        ],
                        "additionalProperties": {},
                        "description": "A web search result."
                      }
                    },
                    "resolvedSearchType": {
                      "type": "string"
                    },
                    "autopromptString": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "costDollars": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "results"
                  ],
                  "additionalProperties": {},
                  "description": "A web search response."
                },
                "example": {
                  "results": [
                    {
                      "url": "https://example.com/ai-crm",
                      "title": "AI CRM workflows in 2026",
                      "text": "The article content...",
                      "summary": "AI CRMs automate lead routing."
                    }
                  ],
                  "costDollars": {
                    "total": 0.002
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/search/answer": {
      "post": {
        "operationId": "search_answer",
        "tags": [
          "gateway"
        ],
        "summary": "Answer question",
        "description": "Answer a question with web search.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "description": "Question to answer with web search."
                  },
                  "text": {
                    "type": "boolean"
                  },
                  "stream": {
                    "type": "boolean"
                  },
                  "outputSchema": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "query"
                ]
              },
              "example": {
                "query": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "answer": {
                      "type": "string"
                    },
                    "citations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "publishedDate": {
                            "type": "string"
                          },
                          "author": {
                            "type": "string"
                          },
                          "score": {
                            "type": "number"
                          },
                          "text": {
                            "type": "string"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "highlights": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "image": {
                            "type": "string"
                          },
                          "favicon": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "entities": {
                            "description": "Structured entity metadata returned by category=people or category=company.",
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "url"
                        ],
                        "additionalProperties": {},
                        "description": "A web search result."
                      }
                    },
                    "costDollars": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "answer"
                  ],
                  "additionalProperties": {},
                  "description": "An answer with citations. With stream: true the response is text/event-stream instead."
                },
                "example": {
                  "answer": "Dench is an AI agent workspace with a built-in CRM.",
                  "citations": [
                    {
                      "url": "https://www.dench.com",
                      "title": "Dench",
                      "id": "https://www.dench.com"
                    }
                  ],
                  "costDollars": {
                    "total": 0.005
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/web-scrape-markdown": {
      "post": {
        "operationId": "web_scrape",
        "tags": [
          "gateway"
        ],
        "summary": "Read page",
        "description": "Read a page as clean Markdown through Dench web.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/brand-retrieve": {
      "post": {
        "operationId": "web_brand",
        "tags": [
          "gateway"
        ],
        "summary": "Look up brand",
        "description": "Look up a brand kit from a domain or email.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/web-sitemap": {
      "post": {
        "operationId": "web_sitemap",
        "tags": [
          "gateway"
        ],
        "summary": "List site pages",
        "description": "List sitemap URLs for a domain.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/web-crawl": {
      "post": {
        "operationId": "web_crawl",
        "tags": [
          "gateway"
        ],
        "summary": "Crawl site",
        "description": "Crawl a site to Markdown (capped).",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/web-screenshot": {
      "post": {
        "operationId": "web_screenshot",
        "tags": [
          "gateway"
        ],
        "summary": "Screenshot page",
        "description": "Capture a rendered page screenshot.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/web-extract": {
      "post": {
        "operationId": "web_extract",
        "tags": [
          "gateway"
        ],
        "summary": "Extract page",
        "description": "Extract typed fields from a page using a JSON Schema.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/web-product": {
      "post": {
        "operationId": "web_product",
        "tags": [
          "gateway"
        ],
        "summary": "Extract product",
        "description": "Extract a product listing from a URL.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/web-competitors": {
      "post": {
        "operationId": "web_competitors",
        "tags": [
          "gateway"
        ],
        "summary": "Find competitors",
        "description": "Find competitors of a domain.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/brand-styleguide": {
      "post": {
        "operationId": "web_styleguide",
        "tags": [
          "gateway"
        ],
        "summary": "Read styleguide",
        "description": "Read a brand styleguide from a domain.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/brand-fonts": {
      "post": {
        "operationId": "web_fonts",
        "tags": [
          "gateway"
        ],
        "summary": "Read fonts",
        "description": "Read site fonts from a domain.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/classify-naics": {
      "post": {
        "operationId": "web_classify",
        "tags": [
          "gateway"
        ],
        "summary": "Classify brand",
        "description": "Classify a domain with NAICS or SIC.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/brand-search": {
      "post": {
        "operationId": "web_brandSearch",
        "tags": [
          "gateway"
        ],
        "summary": "Search brands",
        "description": "Autocomplete brand names.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/images/generations": {
      "post": {
        "operationId": "image_generate",
        "tags": [
          "gateway"
        ],
        "summary": "Generate image",
        "description": "Generate an image through the Dench gateway.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32000,
                    "description": "Image prompt."
                  },
                  "size": {
                    "description": "e.g. 1024x1024, 1536x1024, auto.",
                    "type": "string"
                  },
                  "quality": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "low",
                      "medium",
                      "high"
                    ]
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "png",
                      "jpeg",
                      "webp"
                    ]
                  },
                  "output_compression": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "background": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "opaque",
                      "transparent"
                    ]
                  },
                  "savePath": {
                    "description": "Workspace path to write the image.",
                    "type": "string"
                  }
                },
                "required": [
                  "prompt"
                ]
              },
              "example": {
                "prompt": "A minimal flat-vector app icon",
                "size": "1024x1024"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "model": {
                      "type": "string"
                    },
                    "endpoint": {
                      "type": "string",
                      "enum": [
                        "generations",
                        "edits"
                      ]
                    },
                    "prompt": {
                      "type": "string"
                    },
                    "revisedPrompt": {
                      "type": "string"
                    },
                    "quality": {
                      "type": "string"
                    },
                    "requestedSize": {
                      "type": "string"
                    },
                    "format": {
                      "type": "string"
                    },
                    "mimeType": {
                      "type": "string"
                    },
                    "estimatedCostUsd": {
                      "type": "number"
                    },
                    "b64_json": {
                      "type": "string",
                      "description": "Base64-encoded image bytes."
                    },
                    "storageId": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string",
                      "description": "Workspace path where the image was saved."
                    },
                    "signedUrl": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "contentHash": {
                      "type": "string"
                    },
                    "sizeBytes": {
                      "type": "number"
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "inputTokens": {
                          "type": "number"
                        },
                        "outputTokens": {
                          "type": "number"
                        },
                        "totalTokens": {
                          "type": "number"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "ok",
                    "model",
                    "endpoint",
                    "prompt",
                    "b64_json",
                    "path",
                    "signedUrl"
                  ],
                  "additionalProperties": {},
                  "description": "Gateway image envelope wrapping the OpenAI image result."
                },
                "example": {
                  "ok": true,
                  "model": "image-model",
                  "endpoint": "generations",
                  "prompt": "A minimal flat-vector app icon",
                  "quality": "auto",
                  "requestedSize": "1024x1024",
                  "format": "png",
                  "mimeType": "image/png",
                  "estimatedCostUsd": 0.053,
                  "b64_json": "iVBORw0KGgoAAAANS...",
                  "path": "/image-generations/20260612-app-icon.png",
                  "signedUrl": "https://files.example.com/img123",
                  "sizeBytes": 245760,
                  "usage": {
                    "inputTokens": 12,
                    "outputTokens": 1056,
                    "totalTokens": 1068
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/images/edits": {
      "post": {
        "operationId": "image_edit",
        "tags": [
          "gateway"
        ],
        "summary": "Edit image",
        "description": "Edit an image through the Dench gateway.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32000,
                    "description": "Image prompt."
                  },
                  "size": {
                    "description": "e.g. 1024x1024, 1536x1024, auto.",
                    "type": "string"
                  },
                  "quality": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "low",
                      "medium",
                      "high"
                    ]
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "png",
                      "jpeg",
                      "webp"
                    ]
                  },
                  "output_compression": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "background": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "opaque",
                      "transparent"
                    ]
                  },
                  "savePath": {
                    "description": "Workspace path to write the image.",
                    "type": "string"
                  },
                  "input_images_base64": {
                    "minItems": 1,
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Base64-encoded source images (1-8)."
                  },
                  "mask_base64": {
                    "description": "Optional base64 mask image.",
                    "type": "string"
                  }
                },
                "required": [
                  "prompt",
                  "input_images_base64"
                ]
              },
              "example": {
                "prompt": "Make the background transparent",
                "input_images_base64": [
                  "iVBORw0KGgoAAAANSUhEUg..."
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "model": {
                      "type": "string"
                    },
                    "endpoint": {
                      "type": "string",
                      "enum": [
                        "generations",
                        "edits"
                      ]
                    },
                    "prompt": {
                      "type": "string"
                    },
                    "revisedPrompt": {
                      "type": "string"
                    },
                    "quality": {
                      "type": "string"
                    },
                    "requestedSize": {
                      "type": "string"
                    },
                    "format": {
                      "type": "string"
                    },
                    "mimeType": {
                      "type": "string"
                    },
                    "estimatedCostUsd": {
                      "type": "number"
                    },
                    "b64_json": {
                      "type": "string",
                      "description": "Base64-encoded image bytes."
                    },
                    "storageId": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string",
                      "description": "Workspace path where the image was saved."
                    },
                    "signedUrl": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "contentHash": {
                      "type": "string"
                    },
                    "sizeBytes": {
                      "type": "number"
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "inputTokens": {
                          "type": "number"
                        },
                        "outputTokens": {
                          "type": "number"
                        },
                        "totalTokens": {
                          "type": "number"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "ok",
                    "model",
                    "endpoint",
                    "prompt",
                    "b64_json",
                    "path",
                    "signedUrl"
                  ],
                  "additionalProperties": {},
                  "description": "Gateway image envelope wrapping the OpenAI image result."
                },
                "example": {
                  "ok": true,
                  "model": "image-model",
                  "endpoint": "edits",
                  "prompt": "Make the background transparent",
                  "quality": "auto",
                  "requestedSize": "1024x1024",
                  "format": "png",
                  "mimeType": "image/png",
                  "estimatedCostUsd": 0.066,
                  "b64_json": "iVBORw0KGgoAAAANS...",
                  "path": "/image-generations/20260612-app-icon-edit.png",
                  "signedUrl": "https://files.example.com/img124",
                  "sizeBytes": 198432
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/integrations": {
      "get": {
        "operationId": "integrations_list",
        "tags": [
          "gateway"
        ],
        "summary": "List every connected integration — connected apps plus the Gmail, Outlook, Calendar, LinkedIn and Slack connections Dench provides itself (Slack rows report source: dench)",
        "description": "List every connected integration — connected apps plus the Gmail, Outlook, Calendar, LinkedIn and Slack connections Dench provides itself (Slack rows report source: dench).",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "connectionId": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "toolkit": {
                            "type": "object",
                            "properties": {
                              "slug": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "name": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "slug",
                              "name"
                            ],
                            "additionalProperties": {}
                          },
                          "status": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "e.g. \"ACTIVE\"."
                          },
                          "createdAt": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "updatedAt": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "account": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {},
                            "description": "Normalized account identity (stableId, label, email, ...)."
                          },
                          "reconnect": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "id",
                          "connectionId",
                          "toolkit",
                          "status",
                          "createdAt",
                          "updatedAt",
                          "account"
                        ],
                        "additionalProperties": {},
                        "description": "A connected app."
                      }
                    },
                    "connections": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "connectionId": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "toolkit": {
                            "type": "object",
                            "properties": {
                              "slug": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "name": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "slug",
                              "name"
                            ],
                            "additionalProperties": {}
                          },
                          "status": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "e.g. \"ACTIVE\"."
                          },
                          "createdAt": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "updatedAt": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "account": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {},
                            "description": "Normalized account identity (stableId, label, email, ...)."
                          },
                          "reconnect": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "id",
                          "connectionId",
                          "toolkit",
                          "status",
                          "createdAt",
                          "updatedAt",
                          "account"
                        ],
                        "additionalProperties": {},
                        "description": "A connected app."
                      },
                      "description": "Alias of items for older clients."
                    },
                    "raw": {
                      "description": "Deprecated: the unprocessed provider response. Do not depend on it."
                    }
                  },
                  "required": [
                    "items",
                    "connections",
                    "raw"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "items": [
                    {
                      "id": "ca_github01",
                      "connectionId": "ca_github01",
                      "toolkit": {
                        "slug": "github",
                        "name": "GitHub"
                      },
                      "status": "ACTIVE",
                      "createdAt": "2026-06-01T12:00:00.000Z",
                      "updatedAt": "2026-06-01T12:00:00.000Z",
                      "account": {
                        "stableId": "octocat",
                        "label": "octocat",
                        "email": "octo@github.com"
                      }
                    }
                  ],
                  "connections": [
                    {
                      "id": "ca_github01",
                      "connectionId": "ca_github01",
                      "toolkit": {
                        "slug": "github",
                        "name": "GitHub"
                      },
                      "status": "ACTIVE",
                      "createdAt": "2026-06-01T12:00:00.000Z",
                      "updatedAt": "2026-06-01T12:00:00.000Z",
                      "account": {
                        "stableId": "octocat",
                        "label": "octocat",
                        "email": "octo@github.com"
                      }
                    }
                  ],
                  "raw": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/apps": {
      "get": {
        "operationId": "apps_list",
        "tags": [
          "apps"
        ],
        "summary": "List apps",
        "description": "List installed App Store apps in the workspace.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "apps_create",
        "tags": [
          "apps"
        ],
        "summary": "Scaffold and register a new App Store app",
        "description": "Scaffold and register a new App Store app.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "description": "Folder slug; becomes /apps/<slug>.dench.app."
                  },
                  "name": {
                    "type": "string"
                  },
                  "icon": {
                    "description": "Lucide icon name.",
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  }
                },
                "required": [
                  "slug",
                  "name"
                ]
              },
              "example": {
                "slug": "string",
                "name": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/apps/gallery": {
      "get": {
        "operationId": "apps_gallery",
        "tags": [
          "apps"
        ],
        "summary": "List Discover listings — Official (Dench) + Community shelves",
        "description": "List Discover listings — Official (Dench) + Community shelves.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/apps/install": {
      "post": {
        "operationId": "apps_install",
        "tags": [
          "apps"
        ],
        "summary": "Install an App Store listing into the workspace",
        "description": "Install an App Store listing into the workspace.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "listingId": {
                    "type": "string"
                  }
                },
                "required": [
                  "listingId"
                ]
              },
              "example": {
                "listingId": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/apps/publish": {
      "post": {
        "operationId": "apps_publish",
        "tags": [
          "apps"
        ],
        "summary": "Publish an app's files as a versioned App Store listing",
        "description": "Publish an app's files as a versioned App Store listing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "appPath": {
                    "type": "string",
                    "description": "Workspace path of the .dench.app folder."
                  },
                  "slug": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "icon": {
                    "type": "string"
                  },
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "org",
                      "public",
                      "official",
                      "unlisted"
                    ]
                  },
                  "version": {
                    "type": "string"
                  },
                  "permissions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "appPath",
                  "slug",
                  "name"
                ]
              },
              "example": {
                "appPath": "string",
                "slug": "string",
                "name": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/apps/{slug}": {
      "delete": {
        "operationId": "apps_uninstall",
        "tags": [
          "apps"
        ],
        "summary": "Uninstall an app from the workspace",
        "description": "Uninstall an app from the workspace.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "apps_setEnabled",
        "tags": [
          "apps"
        ],
        "summary": "Enable or disable an installed app",
        "description": "Enable or disable an installed app.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ]
              },
              "example": {
                "enabled": true
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/apps/{slug}/pin": {
      "post": {
        "operationId": "apps_setPinned",
        "tags": [
          "apps"
        ],
        "summary": "Pin or unpin an installed app in the rail",
        "description": "Pin or unpin an installed app in the rail.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pinned": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "pinned"
                ]
              },
              "example": {
                "pinned": true
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/local/apps/validate": {
      "post": {
        "operationId": "apps_validate",
        "tags": [
          "apps"
        ],
        "summary": "Validate a .dench.app folder: manifest, permissions, and every window.dench call it makes",
        "description": "Validate a .dench.app folder: manifest, permissions, and every window.dench call it makes.",
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local-only CLI operation. Validation reads the app folder on the caller's disk. In the browser, the same catalog is window.dench.api.operations().",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "Validation reads the app folder on the caller's disk. In the browser, the same catalog is window.dench.api.operations().",
                    "type": "invalid_request_error",
                    "code": "local_only"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/apps/{slug}/webhooks": {
      "post": {
        "operationId": "apps_webhooks_register",
        "tags": [
          "apps"
        ],
        "summary": "Register an inbound webhook for an app. Returns the URL and signing secret ONCE",
        "description": "Register an inbound webhook for an app. Returns the URL and signing secret ONCE.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Installed app slug."
            },
            "description": "Installed app slug."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "hookName": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$",
                    "description": "Hook name, e.g. `stripe` or `github-push`."
                  }
                },
                "required": [
                  "hookName"
                ]
              },
              "example": {
                "hookName": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "get": {
        "operationId": "apps_webhooks_list",
        "tags": [
          "apps"
        ],
        "summary": "List an app's registered webhooks (URLs, never secrets)",
        "description": "List an app's registered webhooks (URLs, never secrets).",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/apps/{slug}/webhooks/{hookName}/events": {
      "get": {
        "operationId": "apps_webhooks_poll",
        "tags": [
          "apps"
        ],
        "summary": "Read events an app webhook received since a timestamp",
        "description": "Read events an app webhook received since a timestamp.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hookName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Only events received after this epoch ms.",
              "type": "number"
            },
            "description": "Only events received after this epoch ms."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/apps/{slug}/webhooks/{hookName}": {
      "delete": {
        "operationId": "apps_webhooks_delete",
        "tags": [
          "apps"
        ],
        "summary": "Remove an app webhook and every event it stored",
        "description": "Remove an app webhook and every event it stored.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hookName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/tools/status": {
      "get": {
        "operationId": "tool_status",
        "tags": [
          "gateway"
        ],
        "summary": "Tool status",
        "description": "List connected tool accounts.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "connectionId": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "toolkit": {
                            "type": "object",
                            "properties": {
                              "slug": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "name": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "slug",
                              "name"
                            ],
                            "additionalProperties": {}
                          },
                          "status": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "e.g. \"ACTIVE\"."
                          },
                          "createdAt": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "updatedAt": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "account": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {},
                            "description": "Normalized account identity (stableId, label, email, ...)."
                          },
                          "reconnect": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "id",
                          "connectionId",
                          "toolkit",
                          "status",
                          "createdAt",
                          "updatedAt",
                          "account"
                        ],
                        "additionalProperties": {},
                        "description": "A connected app."
                      }
                    },
                    "connections": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "connectionId": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "toolkit": {
                            "type": "object",
                            "properties": {
                              "slug": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "name": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "slug",
                              "name"
                            ],
                            "additionalProperties": {}
                          },
                          "status": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "e.g. \"ACTIVE\"."
                          },
                          "createdAt": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "updatedAt": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "account": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {},
                            "description": "Normalized account identity (stableId, label, email, ...)."
                          },
                          "reconnect": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "id",
                          "connectionId",
                          "toolkit",
                          "status",
                          "createdAt",
                          "updatedAt",
                          "account"
                        ],
                        "additionalProperties": {},
                        "description": "A connected app."
                      },
                      "description": "Alias of items for older clients."
                    },
                    "raw": {
                      "description": "Deprecated: the unprocessed provider response. Do not depend on it."
                    }
                  },
                  "required": [
                    "items",
                    "connections",
                    "raw"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "items": [
                    {
                      "id": "ca_gmail01",
                      "connectionId": "ca_gmail01",
                      "toolkit": {
                        "slug": "gmail",
                        "name": "Gmail"
                      },
                      "status": "ACTIVE",
                      "createdAt": "2026-06-01T12:00:00.000Z",
                      "updatedAt": "2026-06-01T12:00:00.000Z",
                      "account": {
                        "stableId": "ada@example.com",
                        "label": "ada@example.com"
                      }
                    }
                  ],
                  "connections": [
                    {
                      "id": "ca_gmail01",
                      "connectionId": "ca_gmail01",
                      "toolkit": {
                        "slug": "gmail",
                        "name": "Gmail"
                      },
                      "status": "ACTIVE",
                      "createdAt": "2026-06-01T12:00:00.000Z",
                      "updatedAt": "2026-06-01T12:00:00.000Z",
                      "account": {
                        "stableId": "ada@example.com",
                        "label": "ada@example.com"
                      }
                    }
                  ],
                  "raw": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/tools/connections": {
      "post": {
        "operationId": "tool_connect",
        "tags": [
          "gateway"
        ],
        "summary": "Connect tool",
        "description": "Create a tool OAuth connection link. Slack is in-house, never a third-party connection: for toolkit slack the CLI prints the first-party install URL (/api/slack/install?slug=<workspace>, org admin) instead of calling this endpoint.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "toolkit": {
                    "description": "Toolkit slug, e.g. github, gmail, stripe.",
                    "type": "string",
                    "minLength": 1
                  },
                  "toolkit_slug": {
                    "type": "string",
                    "minLength": 1
                  },
                  "callback_url": {
                    "description": "Optional OAuth callback URL.",
                    "type": "string"
                  },
                  "returnTo": {
                    "description": "Native OAuth return path within the workspace.",
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "redirect_url": {
                      "description": "OAuth URL the user opens to finish connecting.",
                      "type": "string"
                    },
                    "connection_id": {
                      "type": "string"
                    },
                    "redirectUrl": {
                      "type": "string"
                    },
                    "link": {
                      "type": "string"
                    },
                    "artifact": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "connect"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "toolkit": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "toolkit"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "kind",
                        "data"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": {},
                  "description": "Connect-link response."
                },
                "example": {
                  "redirect_url": "https://connect.dench.com/s/abc123",
                  "connection_id": "ca_github01"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/tools/search": {
      "post": {
        "operationId": "tool_search",
        "tags": [
          "gateway"
        ],
        "summary": "Search tools",
        "description": "Search for external tool actions.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "queries": {
                    "minItems": 1,
                    "maxItems": 7,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "use_case": {
                          "type": "string",
                          "minLength": 1,
                          "description": "Natural-language use case."
                        },
                        "known_fields": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "use_case"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "query": {
                    "type": "string",
                    "minLength": 1
                  },
                  "toolkit": {
                    "type": "string",
                    "minLength": 1
                  },
                  "toolkit_slug": {
                    "type": "string",
                    "minLength": 1
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "important": {
                    "type": "boolean"
                  },
                  "session": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "generate_id": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  },
                  "account": {
                    "type": "string"
                  },
                  "model": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "queries": [
                  {
                    "use_case": "list Slack channels"
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "use_case": {
                            "type": "string"
                          },
                          "primary_tool_slugs": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "related_tool_slugs": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "toolkits": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "execution_guidance": {
                            "type": "string"
                          },
                          "recommended_plan_steps": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "known_pitfalls": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "use_case"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "toolkit_connection_statuses": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "toolkit": {
                            "type": "string"
                          },
                          "has_active_connection": {
                            "type": "boolean"
                          },
                          "status_message": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "accounts": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "toolkit",
                          "has_active_connection"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "tool_schemas": {
                      "description": "Tool slug -> schema with gateway-added execution_ref for tool.run.",
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    "session": {
                      "description": "Tool-router session; reuse session.id for follow-up calls.",
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id"
                      ],
                      "additionalProperties": {}
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    "nativeAvailable": {
                      "type": "boolean"
                    },
                    "available": {
                      "type": "boolean"
                    },
                    "execution_ref_version": {
                      "type": "number"
                    }
                  },
                  "additionalProperties": {},
                  "description": "Tool search response with gateway enrichments."
                },
                "example": {
                  "success": true,
                  "error": null,
                  "results": [
                    {
                      "use_case": "list Slack channels",
                      "primary_tool_slugs": [
                        "SLACK_LIST_CHANNELS"
                      ],
                      "toolkits": [
                        "slack"
                      ]
                    }
                  ],
                  "toolkit_connection_statuses": [
                    {
                      "toolkit": "slack",
                      "has_active_connection": true
                    }
                  ],
                  "tool_schemas": {
                    "SLACK_LIST_CHANNELS": {
                      "toolkit": "slack",
                      "tool_slug": "SLACK_LIST_CHANNELS",
                      "execution_ref": "eyJzZXNzaW9uIjoi...",
                      "execution_ref_version": 1
                    }
                  },
                  "session": {
                    "id": "trs_abc123",
                    "generate_id": true
                  },
                  "execution_ref_version": 1
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/tools/run": {
      "post": {
        "operationId": "tool_run",
        "tags": [
          "gateway"
        ],
        "summary": "Run tool",
        "description": "Run an external tool action. SLACK_* slugs (SLACK_SEND_MESSAGE with Block Kit blocks/buttons, SLACK_FETCH_HISTORY, SLACK_LIST_CHANNELS, …) run through Dench's in-house Slack app install — any channel in the connected workspace — and are always preferred over any third-party Slack connection.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "execution_ref": {
                    "description": "Execution ref from a prior search, OR pass session_id+tool_slug.",
                    "type": "string"
                  },
                  "session_id": {
                    "type": "string"
                  },
                  "tool_slug": {
                    "description": "Tool slug, e.g. SLACK_LIST_CHANNELS.",
                    "type": "string"
                  },
                  "arguments": {
                    "description": "Tool arguments object.",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "account": {
                    "type": "string"
                  },
                  "connected_account_id": {
                    "type": "string"
                  },
                  "approvalId": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "tool_slug": "SLACK_LIST_CHANNELS",
                "arguments": {
                  "limit": 10
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "description": "Tool output (provider passthrough)."
                    },
                    "error": {
                      "anyOf": [
                        {},
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "log_id": {
                      "type": "string"
                    },
                    "execution_mode": {
                      "type": "string"
                    },
                    "tool_slug": {
                      "type": "string"
                    },
                    "tool_router_session_id": {
                      "type": "string"
                    },
                    "toolkit": {
                      "type": "string"
                    },
                    "account": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": {},
                  "description": "Tool execution result with gateway metadata."
                },
                "example": {
                  "data": {
                    "channels": [
                      {
                        "id": "C_EXAMPLE",
                        "name": "general"
                      }
                    ]
                  },
                  "error": null,
                  "log_id": "log_exec_01",
                  "execution_mode": "gateway_tool_router",
                  "tool_slug": "SLACK_LIST_CHANNELS",
                  "tool_router_session_id": "trs_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/tools/connections/{connectionId}": {
      "delete": {
        "operationId": "tool_disconnect",
        "tags": [
          "gateway"
        ],
        "summary": "Disconnect tool",
        "description": "Disconnect an external tool account.",
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": {},
                  "description": "Delete response."
                },
                "example": {
                  "id": "ca_github01",
                  "deleted": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/tools/labels": {
      "get": {
        "operationId": "tool_labels_list",
        "tags": [
          "gateway"
        ],
        "summary": "List human names given to connected accounts",
        "description": "List human names given to connected accounts.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "labels": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "composioConnectionId": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "composioConnectionId",
                          "displayName"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "labels"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/tools/connections/{connectionId}/label": {
      "put": {
        "operationId": "tool_label_set",
        "tags": [
          "gateway"
        ],
        "summary": "Name a connected account, or clear its name with an empty string",
        "description": "Name a connected account, or clear its name with an empty string.",
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "displayName": {
                    "type": "string",
                    "description": "Human name for the account. Empty clears it."
                  }
                },
                "required": [
                  "displayName"
                ]
              },
              "example": {
                "displayName": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "displayName": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "ok",
                    "displayName"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/browser/cli": {
      "post": {
        "operationId": "browser_action",
        "tags": [
          "browser"
        ],
        "summary": "Drive Dench Browser with a single interactive action (open, inspect, click, fill, type, screenshot, stop). Pass the step in `action` plus its arguments",
        "description": "Drive Dench Browser with a single interactive action (open, inspect, click, fill, type, screenshot, stop). Pass the step in `action` plus its arguments.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/browser/sessions": {
      "post": {
        "operationId": "browser_session_create",
        "tags": [
          "browser"
        ],
        "summary": "Create a Dench Browser session and return a CDP connect URL for Playwright (chromium.connectOverCDP) plus a live-view URL. Use for durable scripts run from the sandbox",
        "description": "Create a Dench Browser session and return a CDP connect URL for Playwright (chromium.connectOverCDP) plus a live-view URL. Use for durable scripts run from the sandbox.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "provider": "dench_browser",
                  "sessionId": "bb_sess_123",
                  "connectUrl": "wss://gateway.merseoriginals.com/v1/browser/sessions/bb_sess_123/cdp?relay_token=...",
                  "liveViewUrl": "https://www.dench.com/dench?...",
                  "status": "live"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/browser/sessions/{sessionId}": {
      "get": {
        "operationId": "browser_session_status",
        "tags": [
          "browser"
        ],
        "summary": "Get the status, connect URL, and live-view URL for a Dench Browser session",
        "description": "Get the status, connect URL, and live-view URL for a Dench Browser session.",
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "browser_session_stop",
        "tags": [
          "browser"
        ],
        "summary": "Stop a Dench Browser session and release the remote browser",
        "description": "Stop a Dench Browser session and release the remote browser.",
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/identity": {
      "get": {
        "operationId": "agentConfig_identity_show",
        "tags": [
          "agent-config"
        ],
        "summary": "Identity",
        "description": "Read IDENTITY.md.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agentConfig": {
                      "type": "object",
                      "properties": {
                        "identity": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "organisation": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "memoryAggregate": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "toolsNotes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "bootstrap": {
                          "type": "object",
                          "properties": {
                            "completed": {
                              "type": "boolean"
                            },
                            "completedAt": {
                              "type": "number"
                            },
                            "template": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "completed"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "identity",
                        "organisation",
                        "memoryAggregate",
                        "toolsNotes",
                        "bootstrap"
                      ],
                      "additionalProperties": false
                    },
                    "userProfile": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "userTimezone": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "manual",
                                "agent"
                              ]
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "value",
                            "source",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organizationId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "agentConfig",
                    "userProfile",
                    "userTimezone",
                    "organizationId"
                  ],
                  "additionalProperties": {},
                  "description": "Agent harness config payload shared by every /agent-config GET endpoint."
                },
                "example": {
                  "agentConfig": {
                    "identity": {
                      "content": "# IDENTITY\nYou are Atlas...",
                      "updatedAt": 1765526400000
                    },
                    "organisation": null,
                    "memoryAggregate": null,
                    "toolsNotes": null,
                    "bootstrap": {
                      "completed": true,
                      "completedAt": 1765526400000
                    }
                  },
                  "userProfile": {
                    "content": "Name: Alex",
                    "updatedAt": 1765526400000
                  },
                  "userTimezone": {
                    "value": "America/New_York",
                    "source": "manual",
                    "updatedAt": 1765526400000
                  },
                  "organizationId": "org_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "agentConfig_identity_edit",
        "tags": [
          "agent-config"
        ],
        "summary": "Update identity",
        "description": "Update IDENTITY.md.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string"
                  }
                },
                "required": [
                  "content"
                ]
              },
              "example": {
                "content": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "identity": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organisation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "memoryAggregate": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "toolsNotes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "bootstrap": {
                      "type": "object",
                      "properties": {
                        "completed": {
                          "type": "boolean"
                        },
                        "completedAt": {
                          "type": "number"
                        },
                        "template": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "completed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "identity",
                    "organisation",
                    "memoryAggregate",
                    "toolsNotes",
                    "bootstrap"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "identity": {
                    "content": "# IDENTITY\nYou are Atlas...",
                    "updatedAt": 1765526400000
                  },
                  "organisation": null,
                  "memoryAggregate": null,
                  "toolsNotes": null,
                  "bootstrap": {
                    "completed": true,
                    "completedAt": 1765526400000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/organisation": {
      "get": {
        "operationId": "agentConfig_organisation_show",
        "tags": [
          "agent-config"
        ],
        "summary": "Organisation",
        "description": "Read ORGANISATION.md.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agentConfig": {
                      "type": "object",
                      "properties": {
                        "identity": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "organisation": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "memoryAggregate": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "toolsNotes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "bootstrap": {
                          "type": "object",
                          "properties": {
                            "completed": {
                              "type": "boolean"
                            },
                            "completedAt": {
                              "type": "number"
                            },
                            "template": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "completed"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "identity",
                        "organisation",
                        "memoryAggregate",
                        "toolsNotes",
                        "bootstrap"
                      ],
                      "additionalProperties": false
                    },
                    "userProfile": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "userTimezone": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "manual",
                                "agent"
                              ]
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "value",
                            "source",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organizationId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "agentConfig",
                    "userProfile",
                    "userTimezone",
                    "organizationId"
                  ],
                  "additionalProperties": {},
                  "description": "Agent harness config payload shared by every /agent-config GET endpoint."
                },
                "example": {
                  "agentConfig": {
                    "identity": null,
                    "organisation": {
                      "content": "Acme builds widgets.",
                      "updatedAt": 1765526400000
                    },
                    "memoryAggregate": null,
                    "toolsNotes": null,
                    "bootstrap": {
                      "completed": true,
                      "completedAt": 1765526400000
                    }
                  },
                  "userProfile": null,
                  "userTimezone": null,
                  "organizationId": "org_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "agentConfig_organisation_edit",
        "tags": [
          "agent-config"
        ],
        "summary": "Update organisation",
        "description": "Update ORGANISATION.md.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string"
                  }
                },
                "required": [
                  "content"
                ]
              },
              "example": {
                "content": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "identity": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organisation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "memoryAggregate": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "toolsNotes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "bootstrap": {
                      "type": "object",
                      "properties": {
                        "completed": {
                          "type": "boolean"
                        },
                        "completedAt": {
                          "type": "number"
                        },
                        "template": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "completed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "identity",
                    "organisation",
                    "memoryAggregate",
                    "toolsNotes",
                    "bootstrap"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "identity": null,
                  "organisation": {
                    "content": "Acme builds widgets.",
                    "updatedAt": 1765526400000
                  },
                  "memoryAggregate": null,
                  "toolsNotes": null,
                  "bootstrap": {
                    "completed": true,
                    "completedAt": 1765526400000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/user": {
      "get": {
        "operationId": "agentConfig_user_show",
        "tags": [
          "agent-config"
        ],
        "summary": "User profile",
        "description": "Read USER.md.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agentConfig": {
                      "type": "object",
                      "properties": {
                        "identity": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "organisation": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "memoryAggregate": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "toolsNotes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "bootstrap": {
                          "type": "object",
                          "properties": {
                            "completed": {
                              "type": "boolean"
                            },
                            "completedAt": {
                              "type": "number"
                            },
                            "template": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "completed"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "identity",
                        "organisation",
                        "memoryAggregate",
                        "toolsNotes",
                        "bootstrap"
                      ],
                      "additionalProperties": false
                    },
                    "userProfile": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "userTimezone": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "manual",
                                "agent"
                              ]
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "value",
                            "source",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organizationId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "agentConfig",
                    "userProfile",
                    "userTimezone",
                    "organizationId"
                  ],
                  "additionalProperties": {},
                  "description": "Agent harness config payload shared by every /agent-config GET endpoint."
                },
                "example": {
                  "agentConfig": {
                    "identity": null,
                    "organisation": null,
                    "memoryAggregate": null,
                    "toolsNotes": null,
                    "bootstrap": {
                      "completed": true,
                      "completedAt": 1765526400000
                    }
                  },
                  "userProfile": {
                    "content": "Name: Alex\nRole: Engineer",
                    "updatedAt": 1765526400000
                  },
                  "userTimezone": null,
                  "organizationId": "org_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "agentConfig_user_edit",
        "tags": [
          "agent-config"
        ],
        "summary": "Update user",
        "description": "Update USER.md.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string"
                  }
                },
                "required": [
                  "content"
                ]
              },
              "example": {
                "content": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "content": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "content",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "content": "Name: Alex\nRole: Engineer",
                  "updatedAt": 1765526400000
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/tools": {
      "get": {
        "operationId": "agentConfig_tools_show",
        "tags": [
          "agent-config"
        ],
        "summary": "Tool notes",
        "description": "Read tool notes.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agentConfig": {
                      "type": "object",
                      "properties": {
                        "identity": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "organisation": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "memoryAggregate": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "toolsNotes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "bootstrap": {
                          "type": "object",
                          "properties": {
                            "completed": {
                              "type": "boolean"
                            },
                            "completedAt": {
                              "type": "number"
                            },
                            "template": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "completed"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "identity",
                        "organisation",
                        "memoryAggregate",
                        "toolsNotes",
                        "bootstrap"
                      ],
                      "additionalProperties": false
                    },
                    "userProfile": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "userTimezone": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "manual",
                                "agent"
                              ]
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "value",
                            "source",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organizationId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "agentConfig",
                    "userProfile",
                    "userTimezone",
                    "organizationId"
                  ],
                  "additionalProperties": {},
                  "description": "Agent harness config payload shared by every /agent-config GET endpoint."
                },
                "example": {
                  "agentConfig": {
                    "identity": null,
                    "organisation": null,
                    "memoryAggregate": null,
                    "toolsNotes": {
                      "content": "Prefer dench tool run for Stripe.",
                      "updatedAt": 1765526400000
                    },
                    "bootstrap": {
                      "completed": true,
                      "completedAt": 1765526400000
                    }
                  },
                  "userProfile": null,
                  "userTimezone": null,
                  "organizationId": "org_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "agentConfig_tools_edit",
        "tags": [
          "agent-config"
        ],
        "summary": "Update tool notes",
        "description": "Update tool notes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string"
                  }
                },
                "required": [
                  "content"
                ]
              },
              "example": {
                "content": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "identity": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organisation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "memoryAggregate": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "toolsNotes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "bootstrap": {
                      "type": "object",
                      "properties": {
                        "completed": {
                          "type": "boolean"
                        },
                        "completedAt": {
                          "type": "number"
                        },
                        "template": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "completed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "identity",
                    "organisation",
                    "memoryAggregate",
                    "toolsNotes",
                    "bootstrap"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "identity": null,
                  "organisation": null,
                  "memoryAggregate": null,
                  "toolsNotes": {
                    "content": "Prefer dench tool run for Stripe.",
                    "updatedAt": 1765526400000
                  },
                  "bootstrap": {
                    "completed": true,
                    "completedAt": 1765526400000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/context/rules": {
      "put": {
        "operationId": "workspace_context_rules_set",
        "tags": [
          "workspace"
        ],
        "summary": "Update standing workspace rules; credentials belong in secrets and runnable setup in environments",
        "description": "Update standing workspace rules; credentials belong in secrets and runnable setup in environments.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32000
                  }
                },
                "required": [
                  "content"
                ]
              },
              "example": {
                "content": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/mem": {
      "get": {
        "operationId": "agentConfig_mem_show",
        "tags": [
          "agent-config"
        ],
        "summary": "Aggregate memory",
        "description": "Read aggregate memory.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agentConfig": {
                      "type": "object",
                      "properties": {
                        "identity": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "organisation": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "memoryAggregate": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "toolsNotes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "bootstrap": {
                          "type": "object",
                          "properties": {
                            "completed": {
                              "type": "boolean"
                            },
                            "completedAt": {
                              "type": "number"
                            },
                            "template": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "completed"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "identity",
                        "organisation",
                        "memoryAggregate",
                        "toolsNotes",
                        "bootstrap"
                      ],
                      "additionalProperties": false
                    },
                    "userProfile": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "userTimezone": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "manual",
                                "agent"
                              ]
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "value",
                            "source",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organizationId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "agentConfig",
                    "userProfile",
                    "userTimezone",
                    "organizationId"
                  ],
                  "additionalProperties": {},
                  "description": "Agent harness config payload shared by every /agent-config GET endpoint."
                },
                "example": {
                  "agentConfig": {
                    "identity": null,
                    "organisation": null,
                    "memoryAggregate": {
                      "content": "Deploys go through Vercel.",
                      "updatedAt": 1765526400000
                    },
                    "toolsNotes": null,
                    "bootstrap": {
                      "completed": true,
                      "completedAt": 1765526400000
                    }
                  },
                  "userProfile": null,
                  "userTimezone": null,
                  "organizationId": "org_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "agentConfig_mem_edit",
        "tags": [
          "agent-config"
        ],
        "summary": "Update memory",
        "description": "Update aggregate memory.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string"
                  },
                  "append": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "content"
                ]
              },
              "example": {
                "content": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "identity": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organisation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "memoryAggregate": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "toolsNotes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "bootstrap": {
                      "type": "object",
                      "properties": {
                        "completed": {
                          "type": "boolean"
                        },
                        "completedAt": {
                          "type": "number"
                        },
                        "template": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "completed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "identity",
                    "organisation",
                    "memoryAggregate",
                    "toolsNotes",
                    "bootstrap"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "identity": null,
                  "organisation": null,
                  "memoryAggregate": {
                    "content": "Deploys go through Vercel.",
                    "updatedAt": 1765526400000
                  },
                  "toolsNotes": null,
                  "bootstrap": {
                    "completed": true,
                    "completedAt": 1765526400000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/bootstrap": {
      "get": {
        "operationId": "agentConfig_bootstrap_show",
        "tags": [
          "agent-config"
        ],
        "summary": "Bootstrap",
        "description": "Read bootstrap state.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agentConfig": {
                      "type": "object",
                      "properties": {
                        "identity": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "organisation": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "memoryAggregate": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "toolsNotes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "bootstrap": {
                          "type": "object",
                          "properties": {
                            "completed": {
                              "type": "boolean"
                            },
                            "completedAt": {
                              "type": "number"
                            },
                            "template": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "completed"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "identity",
                        "organisation",
                        "memoryAggregate",
                        "toolsNotes",
                        "bootstrap"
                      ],
                      "additionalProperties": false
                    },
                    "userProfile": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "userTimezone": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "manual",
                                "agent"
                              ]
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "value",
                            "source",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organizationId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "agentConfig",
                    "userProfile",
                    "userTimezone",
                    "organizationId"
                  ],
                  "additionalProperties": {},
                  "description": "Agent harness config payload shared by every /agent-config GET endpoint."
                },
                "example": {
                  "agentConfig": {
                    "identity": null,
                    "organisation": null,
                    "memoryAggregate": null,
                    "toolsNotes": null,
                    "bootstrap": {
                      "completed": false,
                      "template": "Welcome! Let's set up."
                    }
                  },
                  "userProfile": null,
                  "userTimezone": null,
                  "organizationId": "org_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/bootstrap/complete": {
      "post": {
        "operationId": "agentConfig_bootstrap_complete",
        "tags": [
          "agent-config"
        ],
        "summary": "Complete bootstrap",
        "description": "Complete bootstrap.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "completed": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "identity": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organisation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "memoryAggregate": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "toolsNotes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "bootstrap": {
                      "type": "object",
                      "properties": {
                        "completed": {
                          "type": "boolean"
                        },
                        "completedAt": {
                          "type": "number"
                        },
                        "template": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "completed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "identity",
                    "organisation",
                    "memoryAggregate",
                    "toolsNotes",
                    "bootstrap"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "identity": null,
                  "organisation": null,
                  "memoryAggregate": null,
                  "toolsNotes": null,
                  "bootstrap": {
                    "completed": true,
                    "completedAt": 1765526400000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/bootstrap/template": {
      "put": {
        "operationId": "agentConfig_bootstrap_template",
        "tags": [
          "agent-config"
        ],
        "summary": "Bootstrap template",
        "description": "Update bootstrap template.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string"
                  }
                },
                "required": [
                  "content"
                ]
              },
              "example": {
                "content": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "identity": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organisation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "memoryAggregate": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "toolsNotes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "bootstrap": {
                      "type": "object",
                      "properties": {
                        "completed": {
                          "type": "boolean"
                        },
                        "completedAt": {
                          "type": "number"
                        },
                        "template": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "completed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "identity",
                    "organisation",
                    "memoryAggregate",
                    "toolsNotes",
                    "bootstrap"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "identity": null,
                  "organisation": null,
                  "memoryAggregate": null,
                  "toolsNotes": null,
                  "bootstrap": {
                    "completed": false,
                    "template": "Welcome! Let's set up."
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/model/default": {
      "put": {
        "operationId": "agentConfig_model_default",
        "tags": [
          "agent-config"
        ],
        "summary": "Default model",
        "description": "Set the default chat model.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "modelId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Model id, or null to clear."
                  }
                },
                "required": [
                  "modelId"
                ]
              },
              "example": {
                "modelId": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "defaultChatModelId": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "defaultChatModelId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "defaultChatModelId": "anthropic/claude-sonnet-4"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/model/threads/{threadId}": {
      "put": {
        "operationId": "agentConfig_model_thread",
        "tags": [
          "agent-config"
        ],
        "summary": "Thread model",
        "description": "Set a thread model override.",
        "parameters": [
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "modelId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "modelId"
                ]
              },
              "example": {
                "modelId": "string"
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "threadId": {
                      "type": "string"
                    },
                    "modelOverride": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "threadId",
                    "modelOverride"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "threadId": "th_abc123",
                  "modelOverride": "anthropic/claude-opus-4"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/daily/today": {
      "get": {
        "operationId": "agentConfig_daily_today",
        "tags": [
          "agent-config"
        ],
        "summary": "Today's log",
        "description": "Read today's daily activity path.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agentConfig": {
                      "type": "object",
                      "properties": {
                        "identity": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "organisation": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "memoryAggregate": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "toolsNotes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "bootstrap": {
                          "type": "object",
                          "properties": {
                            "completed": {
                              "type": "boolean"
                            },
                            "completedAt": {
                              "type": "number"
                            },
                            "template": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "completed"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "identity",
                        "organisation",
                        "memoryAggregate",
                        "toolsNotes",
                        "bootstrap"
                      ],
                      "additionalProperties": false
                    },
                    "userProfile": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "userTimezone": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "manual",
                                "agent"
                              ]
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "value",
                            "source",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organizationId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "agentConfig",
                    "userProfile",
                    "userTimezone",
                    "organizationId"
                  ],
                  "additionalProperties": {},
                  "description": "Agent harness config payload shared by every /agent-config GET endpoint."
                },
                "example": {
                  "agentConfig": {
                    "identity": null,
                    "organisation": null,
                    "memoryAggregate": null,
                    "toolsNotes": null,
                    "bootstrap": {
                      "completed": true,
                      "completedAt": 1765526400000
                    }
                  },
                  "userProfile": null,
                  "userTimezone": null,
                  "organizationId": "org_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/agent-config/daily/{date}": {
      "get": {
        "operationId": "agentConfig_daily_show",
        "tags": [
          "agent-config"
        ],
        "summary": "Daily log",
        "description": "Read a daily activity path.",
        "parameters": [
          {
            "name": "date",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agentConfig": {
                      "type": "object",
                      "properties": {
                        "identity": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "organisation": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "memoryAggregate": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "toolsNotes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "content": {
                                  "type": "string"
                                },
                                "updatedAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "content",
                                "updatedAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "bootstrap": {
                          "type": "object",
                          "properties": {
                            "completed": {
                              "type": "boolean"
                            },
                            "completedAt": {
                              "type": "number"
                            },
                            "template": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "completed"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "identity",
                        "organisation",
                        "memoryAggregate",
                        "toolsNotes",
                        "bootstrap"
                      ],
                      "additionalProperties": false
                    },
                    "userProfile": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "content",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "userTimezone": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "manual",
                                "agent"
                              ]
                            },
                            "updatedAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "value",
                            "source",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organizationId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "agentConfig",
                    "userProfile",
                    "userTimezone",
                    "organizationId"
                  ],
                  "additionalProperties": {},
                  "description": "Agent harness config payload shared by every /agent-config GET endpoint."
                },
                "example": {
                  "agentConfig": {
                    "identity": null,
                    "organisation": null,
                    "memoryAggregate": null,
                    "toolsNotes": null,
                    "bootstrap": {
                      "completed": true,
                      "completedAt": 1765526400000
                    }
                  },
                  "userProfile": null,
                  "userTimezone": null,
                  "organizationId": "org_abc123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/notifications": {
      "get": {
        "operationId": "notifications_list",
        "tags": [
          "notifications"
        ],
        "summary": "List your notifications (inbox, unread, archived, or all)",
        "description": "List your notifications (inbox, unread, archived, or all).",
        "parameters": [
          {
            "name": "filter",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "inbox",
                "unread",
                "archived",
                "all"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "kind": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "body": {
                        "type": "string"
                      },
                      "link": {
                        "type": "string"
                      },
                      "readAt": {
                        "type": "number"
                      },
                      "archivedAt": {
                        "type": "number"
                      },
                      "createdAt": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "_id",
                      "kind",
                      "title",
                      "createdAt"
                    ],
                    "additionalProperties": {}
                  }
                },
                "example": [
                  {
                    "_id": "ntf_01",
                    "kind": "mention",
                    "title": "Ada Lovelace mentioned you in Ramp",
                    "body": "Kickoff went well — @Bob can you send the proposal?",
                    "link": "/acme?entry=company%3Aent_lead99&comment=cmt_01",
                    "createdAt": 1765526400000
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/notifications/unread-count": {
      "get": {
        "operationId": "notifications_unreadCount",
        "tags": [
          "notifications"
        ],
        "summary": "How many unread notifications you have",
        "description": "How many unread notifications you have.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "number"
                },
                "example": 3
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/notifications/{notificationId}": {
      "patch": {
        "operationId": "notifications_read",
        "tags": [
          "notifications"
        ],
        "summary": "Mark a notification read (or unread)",
        "description": "Mark a notification read (or unread).",
        "parameters": [
          {
            "name": "notificationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "read": {
                    "description": "Defaults to true; false marks unread.",
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "read": true
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/notifications/read-all": {
      "post": {
        "operationId": "notifications_readAll",
        "tags": [
          "notifications"
        ],
        "summary": "Mark every inbox notification read",
        "description": "Mark every inbox notification read.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "patched": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "ok",
                    "patched"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/notifications/{notificationId}/archive": {
      "post": {
        "operationId": "notifications_archive",
        "tags": [
          "notifications"
        ],
        "summary": "Archive a notification",
        "description": "Archive a notification.",
        "parameters": [
          {
            "name": "notificationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/notifications/preferences": {
      "get": {
        "operationId": "notifications_preferences_get",
        "tags": [
          "notifications"
        ],
        "summary": "Read your notification preferences",
        "description": "Read your notification preferences.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "inAppEnabled": {
                          "type": "boolean"
                        },
                        "emailEnabled": {
                          "type": "boolean"
                        },
                        "perKind": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "inApp": {
                                "type": "boolean"
                              },
                              "email": {
                                "type": "boolean"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "timezone": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "digestWindowMinutes": {
                          "type": "number"
                        },
                        "maxEmailsPerDay": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "inAppEnabled",
                        "emailEnabled",
                        "perKind",
                        "timezone",
                        "digestWindowMinutes",
                        "maxEmailsPerDay"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "notifications_preferences_update",
        "tags": [
          "notifications"
        ],
        "summary": "Update your notification preferences",
        "description": "Update your notification preferences.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "inAppEnabled": {
                    "type": "boolean"
                  },
                  "emailEnabled": {
                    "type": "boolean"
                  },
                  "perKind": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "inApp": {
                          "type": "boolean"
                        },
                        "email": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "timezone": {
                    "type": "string"
                  },
                  "digestWindowMinutes": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "maxEmailsPerDay": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                }
              },
              "example": {
                "emailEnabled": true,
                "perKind": {
                  "entry_activity": {
                    "email": false
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/settings/sync": {
      "get": {
        "operationId": "settings_sync_get",
        "tags": [
          "settings"
        ],
        "summary": "Read the workspace's Sync switches (accounts from email, contacts from LinkedIn, Slack Connect, calendar, dossier, tasks from email, lead auto-qualify, summaries and Brief). All on by default",
        "description": "Read the workspace's Sync switches (accounts from email, contacts from LinkedIn, Slack Connect, calendar, dossier, tasks from email, lead auto-qualify, summaries and Brief). All on by default.",
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detectAccounts": {
                      "type": "boolean"
                    },
                    "linkedinContacts": {
                      "type": "boolean"
                    },
                    "slackConnectAccounts": {
                      "type": "boolean"
                    },
                    "calendarContacts": {
                      "type": "boolean"
                    },
                    "dossier": {
                      "type": "boolean"
                    },
                    "emailTasks": {
                      "type": "boolean"
                    },
                    "leadAutoQualify": {
                      "type": "boolean"
                    },
                    "intelligence": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "detectAccounts",
                    "linkedinContacts",
                    "slackConnectAccounts",
                    "calendarContacts",
                    "dossier",
                    "emailTasks",
                    "leadAutoQualify",
                    "intelligence"
                  ],
                  "additionalProperties": false,
                  "description": "Settings → Sync, resolved: absent switches read as true. Off stops new work; nothing already created is removed."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "settings_sync_update",
        "tags": [
          "settings"
        ],
        "summary": "Flip Sync switches (admin). Partial patch: only the keys sent change. Off stops new work; nothing already created is removed",
        "description": "Flip Sync switches (admin). Partial patch: only the keys sent change. Off stops new work; nothing already created is removed.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "detectAccounts": {
                    "description": "Accounts from email — new prospects and customers who email you become accounts and contacts.",
                    "type": "boolean"
                  },
                  "linkedinContacts": {
                    "description": "Contacts from LinkedIn — everyone you message on LinkedIn becomes a contact, with their company.",
                    "type": "boolean"
                  },
                  "slackConnectAccounts": {
                    "description": "Accounts from Slack Connect — a shared channel binds to the company on the other side.",
                    "type": "boolean"
                  },
                  "calendarContacts": {
                    "description": "Contacts from calendar — external invitees on upcoming meetings become contacts.",
                    "type": "boolean"
                  },
                  "dossier": {
                    "description": "Research dossier — Dench researches each new account into its Notes.",
                    "type": "boolean"
                  },
                  "emailTasks": {
                    "description": "Tasks from email — replies and follow-ups you owe become tasks; support issues become cases.",
                    "type": "boolean"
                  },
                  "leadAutoQualify": {
                    "description": "Qualify leads that book — a lead who books a meeting moves to Qualified and converts.",
                    "type": "boolean"
                  },
                  "intelligence": {
                    "description": "Summaries and Brief — conversations are summarised and each record keeps a Brief.",
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "linkedinContacts": false
              }
            }
          }
        },
        "security": [
          {
            "DenchApiKey": []
          },
          {
            "AgentSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detectAccounts": {
                      "type": "boolean"
                    },
                    "linkedinContacts": {
                      "type": "boolean"
                    },
                    "slackConnectAccounts": {
                      "type": "boolean"
                    },
                    "calendarContacts": {
                      "type": "boolean"
                    },
                    "dossier": {
                      "type": "boolean"
                    },
                    "emailTasks": {
                      "type": "boolean"
                    },
                    "leadAutoQualify": {
                      "type": "boolean"
                    },
                    "intelligence": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "detectAccounts",
                    "linkedinContacts",
                    "slackConnectAccounts",
                    "calendarContacts",
                    "dossier",
                    "emailTasks",
                    "leadAutoQualify",
                    "intelligence"
                  ],
                  "additionalProperties": false,
                  "description": "Settings → Sync, resolved: absent switches read as true. Off stops new work; nothing already created is removed."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "DenchApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "DENCH_API_KEY",
        "description": "Workspace-scoped Dench API key from workspace settings. This is the same key used by DENCH_API_KEY in sandboxes."
      },
      "AgentSession": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "dch_agent_*",
        "description": "Agent session token created by `dench signin`. Gateway-backed routes exchange this token for the workspace gateway key."
      }
    },
    "schemas": {
      "ApiError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "message",
              "type",
              "code"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "details": {}
            }
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid authentication",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "NotFound": {
        "description": "Operation or resource not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "InternalError": {
        "description": "Server error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      }
    }
  }
}
