{
  "openapi": "3.0.3",
  "info": {
    "title": "CAM API",
    "version": "1.0.0",
    "description": "The CAM REST API for connections, accounts, lead lists, workflows, and competitive activity analytics.\n\n**Authentication** \u2014 every request needs an API key, created in CAM under Settings \u2192 API Keys, or an OAuth token from the MCP connector sign-in. Send it as `Authorization: Bearer cam_...` or `X-API-Key: cam_...`. API & MCP access is enabled per account \u2014 if you don't see Settings \u2192 API Keys or requests return `API_ACCESS_DISABLED`, ask your CSM to enable it.\n\n**Scopes** \u2014 keys carry scopes: `read` (all GETs) and `write` (POST/PATCH/PUT/DELETE). A request outside the key's scopes returns 403 `INSUFFICIENT_SCOPE`.\n\n**Rate limits** \u2014 per account, per minute: 100 read, 20 write. 429 responses carry `X-RateLimit-*` headers.\n\n**Errors** \u2014 4xx/5xx responses are `{ \"error\": string, \"code\"?: string }`; validation failures are 400 with `code: VALIDATION_ERROR` and a `details` array of `{ path, message }`.\n\n**Webhooks** \u2014 register HTTPS endpoints via `/webhooks`; deliveries are signed `X-CAM-Signature: sha256=<HMAC-SHA256 of the raw body>` with the secret returned once at creation.\n\n**MCP** \u2014 the same surface is exposed as a hosted MCP server at `https://mcp.getcam.io`. Claude connects with one-click OAuth sign-in (Settings \u2192 Connectors \u2192 Add custom connector \u2192 paste the URL); API-key auth works too for Claude Code, Cursor, and scripts. Self-host via `npm run mcp`.\n\n**Pagination** \u2014 list endpoints accept page/limit; the stream endpoints (/activity, /lead-lists/{id}/items) additionally return `pagination.nextCursor` for stable cursor paging \u2014 pass it back as `?cursor=`."
  },
  "servers": [
    {
      "url": "https://api.getcam.io/api/v1",
      "description": "Production"
    },
    {
      "url": "/api/v1",
      "description": "This host"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Connection": {
        "type": "object",
        "description": "A LinkedIn person a tracked rep connected with. `connectionOf` is the rep's name; `competitor` is the rep's employer (not this person's). This is the complete field set \u2014 internal identifiers are never returned.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "fullName": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "mobileNumber": {
            "type": "string",
            "nullable": true
          },
          "profileUrl": {
            "type": "string"
          },
          "competitor": {
            "type": "string",
            "nullable": true
          },
          "connectionOf": {
            "type": "string"
          },
          "icpScore": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 100
          },
          "icpTier": {
            "type": "string",
            "nullable": true,
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "icpReasoning": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "connected",
              "not_connected"
            ]
          },
          "connectedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "accountId": {
            "type": "integer",
            "nullable": true
          },
          "headline": {
            "type": "string",
            "nullable": true
          },
          "seniority": {
            "type": "string",
            "nullable": true
          },
          "companyDomain": {
            "type": "string",
            "nullable": true
          },
          "companyIndustry": {
            "type": "string",
            "nullable": true
          },
          "companyEmployeeCount": {
            "type": "integer",
            "nullable": true
          },
          "location": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "state": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "profilePhotoUrl": {
            "type": "string",
            "nullable": true
          },
          "tenureDays": {
            "type": "integer",
            "nullable": true,
            "description": "Days at current employer, from enrichment"
          },
          "jobChange": {
            "type": "object",
            "nullable": true,
            "properties": {
              "currentCompanyStartedAt": {
                "type": "string",
                "format": "date"
              },
              "currentCompanyName": {
                "type": "string",
                "nullable": true
              },
              "currentRoleStartedAt": {
                "type": "string",
                "format": "date",
                "nullable": true
              },
              "currentRoleTitle": {
                "type": "string",
                "nullable": true
              },
              "previousCompanyName": {
                "type": "string",
                "nullable": true
              },
              "previousRoleTitle": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "leadLists": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ActivityEvent": {
        "type": "object",
        "description": "A competitor connection framed as a scored event.",
        "properties": {
          "eventId": {
            "type": "string",
            "example": "conn_18234"
          },
          "type": {
            "type": "string",
            "example": "competitor_connection"
          },
          "connectedAt": {
            "type": "string",
            "format": "date-time"
          },
          "priorityScore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Recency decay (40%) + title seniority (25%) + multi-competitor account (20%) + ICP fit (15%)"
          },
          "multiCompetitor": {
            "type": "boolean"
          },
          "competitor": {
            "type": "string"
          },
          "rep": {
            "type": "string"
          },
          "buyer": {
            "type": "object",
            "properties": {
              "connectionId": {
                "type": "integer"
              },
              "fullName": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "seniority": {
                "type": "string",
                "nullable": true
              },
              "profileUrl": {
                "type": "string"
              },
              "icpScore": {
                "type": "integer",
                "nullable": true
              },
              "icpTier": {
                "type": "string",
                "nullable": true
              },
              "status": {
                "type": "string"
              },
              "jobChange": {
                "type": "object",
                "nullable": true,
                "properties": {
                  "currentCompanyStartedAt": {
                    "type": "string",
                    "format": "date"
                  },
                  "currentRoleStartedAt": {
                    "type": "string",
                    "format": "date",
                    "nullable": true
                  },
                  "previousCompanyName": {
                    "type": "string",
                    "nullable": true
                  },
                  "previousRoleTitle": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          },
          "account": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "accountId": {
                "type": "integer",
                "nullable": true
              },
              "competitorCount": {
                "type": "integer"
              }
            }
          }
        }
      },
      "AccountRollup": {
        "type": "object",
        "properties": {
          "account": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "accountId": {
                "type": "integer",
                "nullable": true
              }
            }
          },
          "touchCount": {
            "type": "integer"
          },
          "competitorCount": {
            "type": "integer"
          },
          "competitors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "buyerCount": {
            "type": "integer"
          },
          "lastTouchAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "LeadList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "agent",
              "filter",
              "boost"
            ]
          },
          "autoRefresh": {
            "type": "boolean"
          },
          "minScore": {
            "type": "integer",
            "nullable": true
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Configured workflow actions"
          },
          "webhookUrl": {
            "type": "string",
            "nullable": true
          },
          "webhookAutoSync": {
            "type": "boolean"
          },
          "itemCount": {
            "type": "integer"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "lead_list.created",
                "lead_list.refreshed",
                "lead_list.items_added"
              ]
            }
          },
          "isActive": {
            "type": "boolean"
          },
          "failureCount": {
            "type": "integer",
            "description": "Consecutive failures; auto-disabled at 10"
          },
          "lastTriggeredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastError": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "secret": {
            "type": "string",
            "description": "Returned only at creation \u2014 HMAC-SHA256 signing secret"
          }
        }
      },
      "Account": {
        "type": "object",
        "description": "A company account: firmographics and ICP fit only.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "companyName": {
            "type": "string"
          },
          "companyDomain": {
            "type": "string",
            "nullable": true
          },
          "companyLinkedinUrl": {
            "type": "string",
            "nullable": true
          },
          "companyWebsite": {
            "type": "string",
            "nullable": true
          },
          "companyDescription": {
            "type": "string",
            "nullable": true
          },
          "companyIndustry": {
            "type": "string",
            "nullable": true
          },
          "companyLocation": {
            "type": "string",
            "nullable": true
          },
          "companyEmployeeCount": {
            "type": "integer",
            "nullable": true
          },
          "companySize": {
            "type": "string",
            "nullable": true
          },
          "revenue": {
            "type": "string",
            "nullable": true
          },
          "fundingStage": {
            "type": "string",
            "nullable": true
          },
          "fundingAmount": {
            "type": "string",
            "nullable": true
          },
          "accountIcpScore": {
            "type": "integer",
            "nullable": true
          },
          "accountIcpTier": {
            "type": "string",
            "nullable": true,
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "contactCount": {
            "type": "integer"
          }
        }
      }
    }
  },
  "paths": {
    "/me": {
      "get": {
        "summary": "Account profile",
        "tags": [
          "Meta"
        ],
        "description": "The authenticated account. Use it to verify a key or token works and see which account it is bound to.",
        "responses": {
          "200": {
            "description": "Account profile",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "companyName": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/stats": {
      "get": {
        "summary": "Dashboard stats",
        "tags": [
          "Stats"
        ],
        "description": "Dashboard rollup: connection counts, ICP tiers, accounts, lead lists, reps, distinct competitors.",
        "responses": {
          "200": {
            "description": "Aggregate counts",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "connections": {
                      "total": 58512,
                      "withEmail": 21044,
                      "icpHigh": 3120,
                      "competitors": 23
                    },
                    "accounts": {
                      "total": 19613
                    },
                    "leadLists": {
                      "total": 14
                    },
                    "reps": {
                      "total": 12,
                      "monitoring": 9
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/connections": {
      "get": {
        "summary": "List connections with filters",
        "tags": [
          "Connections"
        ],
        "description": "Raw connection records with the full filter set the app UI uses.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free-text search across name, title, company",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "icpTier",
            "in": "query",
            "description": "Comma-separated: high,medium,low",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "competitor",
            "in": "query",
            "description": "Filter by competitor company",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "connectionOf",
            "in": "query",
            "description": "Filter by rep name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "connected or not_connected",
            "schema": {
              "type": "string",
              "enum": [
                "connected",
                "not_connected"
              ]
            }
          },
          {
            "name": "idsOnly",
            "in": "query",
            "description": "Return only IDs (for bulk operations)",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page; default 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows per page; default 50, max 500",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated connections",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Connection"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer"
                        },
                        "limit": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "totalPages": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/connections/filter-options": {
      "get": {
        "summary": "Filter dropdown options",
        "tags": [
          "Connections"
        ],
        "description": "Valid filter values for /connections: competitors, reps, tiers present in your account's data."
      }
    },
    "/connections/{id}": {
      "get": {
        "summary": "Get connection",
        "tags": [
          "Connections"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Connection ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The connection",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Connection"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/accounts": {
      "get": {
        "summary": "List accounts",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "name": "industry",
            "in": "query",
            "description": "Filter by industry",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Name search",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page; default 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Rows per page",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "description": "Company accounts with contact counts. Paginated: page (default 1), pageSize (default 25, max 100)."
      }
    },
    "/accounts/count": {
      "get": {
        "summary": "Account count",
        "tags": [
          "Accounts"
        ]
      }
    },
    "/accounts/{id}": {
      "get": {
        "summary": "Get account with contacts",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Account ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "description": "Account with its contacts."
      }
    },
    "/reps": {
      "get": {
        "summary": "List reps",
        "tags": [
          "Reps"
        ],
        "description": "Sales reps tracked on this account."
      }
    },
    "/integrations": {
      "get": {
        "summary": "Integration status",
        "tags": [
          "Integrations"
        ],
        "description": "Connection status of HubSpot and enrichment providers."
      }
    },
    "/lead-lists": {
      "get": {
        "summary": "List lead lists",
        "tags": [
          "Lead Lists"
        ],
        "responses": {
          "200": {
            "description": "All lead lists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LeadList"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create lead list",
        "tags": [
          "Lead Lists"
        ],
        "description": "Create a lead list, optionally seeded with connection IDs.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string"
                  },
                  "connectionIds": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created list"
          }
        }
      }
    },
    "/lead-lists/{listId}": {
      "get": {
        "summary": "Get lead list",
        "tags": [
          "Lead Lists"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          }
        ]
      },
      "patch": {
        "summary": "Update lead list",
        "tags": [
          "Lead Lists"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "autoRefresh": {
                    "type": "boolean"
                  },
                  "webhookUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "webhookAutoSync": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete lead list",
        "tags": [
          "Lead Lists"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "description": "Deletes the list; its connections are not deleted."
      }
    },
    "/lead-lists/{listId}/items": {
      "get": {
        "summary": "List items",
        "tags": [
          "Lead Lists"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page; default 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows per page; default 100, max 500",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque cursor from a previous response's pagination.nextCursor. When present, page is ignored.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "post": {
        "summary": "Add connections",
        "tags": [
          "Lead Lists"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "connectionIds"
                ],
                "properties": {
                  "connectionIds": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "minItems": 1
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Remove connections",
        "tags": [
          "Lead Lists"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "connectionIds": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "removeAll": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "description": "Remove specific connections, or everything with removeAll: true."
      }
    },
    "/lead-lists/{listId}/refresh": {
      "post": {
        "summary": "Refresh agent/filter list",
        "tags": [
          "Lead Lists"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "description": "Re-run a filter/agent list's criteria to pull in new matching connections. Emits lead_list.refreshed."
      }
    },
    "/lead-lists/{listId}/export": {
      "post": {
        "summary": "Export list to CSV",
        "tags": [
          "Lead Lists"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "connectionIds": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lead-lists/{listId}/push": {
      "post": {
        "summary": "Push leads to webhook or action",
        "tags": [
          "Workflows"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "description": "Push leads to a webhook URL or a configured workflow action.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "connectionIds": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "webhookUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "actionId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lead-lists/{listId}/actions": {
      "get": {
        "summary": "Get workflow actions",
        "tags": [
          "Workflows"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          }
        ]
      },
      "put": {
        "summary": "Update workflow actions",
        "tags": [
          "Workflows"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "actions"
                ],
                "properties": {
                  "actions": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lead-lists/{listId}/actions/{actionId}/execute": {
      "post": {
        "summary": "Execute action",
        "tags": [
          "Workflows"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "connectionIds"
                ],
                "properties": {
                  "connectionIds": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "minItems": 1
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lead-lists/{listId}/actions/{actionId}/test": {
      "post": {
        "summary": "Test action",
        "tags": [
          "Workflows"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "connectionId"
                ],
                "properties": {
                  "connectionId": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lead-lists/{listId}/activity": {
      "get": {
        "summary": "Action activity log",
        "tags": [
          "Workflows"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "description": "Lead list ID",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page; default 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows per page; default 50, max 500",
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/push/bulk": {
      "post": {
        "summary": "Bulk webhook push",
        "tags": [
          "Workflows"
        ],
        "description": "Start a bulk webhook push of the account's connections. Returns 202 with a job record; delivery is drained by the scheduler.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "webhookUrl"
                ],
                "properties": {
                  "webhookUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "scope": {
                    "type": "string",
                    "enum": [
                      "current",
                      "past",
                      "all"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Queued job"
          }
        }
      }
    },
    "/customers/overview": {
      "get": {
        "summary": "Customer Watch overview (requires Customer Watch enabled)",
        "tags": [
          "Customers"
        ],
        "description": "Customer Watch summary. Requires Customer Watch enabled (403 otherwise)."
      }
    },
    "/customers/matches": {
      "get": {
        "summary": "Connections matching known customer contacts",
        "tags": [
          "Customers"
        ],
        "description": "Connections matching known customer contacts \u2014 competitor touches at existing customers."
      }
    },
    "/customers/contacts": {
      "get": {
        "summary": "List customer contacts (paginated; page, limit, search)",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page; default 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows per page; default 100, max 500",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Name/email search",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/customers/accounts": {
      "get": {
        "summary": "List customer accounts (paginated; page, limit, search)",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page; default 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows per page; default 100, max 500",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Name search",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/webhooks": {
      "get": {
        "summary": "List outbound event webhooks (secrets omitted)",
        "tags": [
          "Webhooks"
        ],
        "responses": {
          "200": {
            "description": "Registered webhooks (secrets omitted)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Register a webhook. Body: {url, events[]}. Events: lead_list.created, lead_list.refreshed, lead_list.items_added. The signing secret is returned once.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url",
                  "events"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "enum": [
                        "lead_list.created",
                        "lead_list.refreshed",
                        "lead_list.items_added"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The webhook, including its signing secret (shown only once)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Webhook"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}": {
      "delete": {
        "summary": "Delete a webhook",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Webhook ID",
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/webhooks/{id}/test": {
      "post": {
        "summary": "Send a signed test delivery to a webhook",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Webhook ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "description": "Sends a signed webhook.test payload so you can verify your endpoint and signature check."
      }
    },
    "/discover": {
      "get": {
        "summary": "Tenant vocabulary (real competitor/rep/tier values), enabled features, enums, endpoint catalog. Call first from agents.",
        "tags": [
          "Activity"
        ],
        "description": "Call this first from agents: tenant vocabulary (real competitor/rep/tier values), enabled features, enums, and the endpoint catalog \u2014 so later calls use real values instead of guesses."
      }
    },
    "/activity": {
      "get": {
        "summary": "Priority-scored competitor connection events. priorityScore 0-100 = recency decay (40%) + title seniority (25%) + multi-competitor account (20%) + ICP fit (15%). Params: timeframe (24h..365d), competitor, connectionOf, icpTier (comma-separated multi-value), minPriorityScore, multiCompetitorOnly, page, limit.",
        "tags": [
          "Activity"
        ],
        "description": "Priority-scored competitor connection events across the book, newest-highest first. priorityScore (0-100) = recency decay (40%) + title seniority (25%) + multi-competitor account (20%) + ICP fit (15%).",
        "parameters": [
          {
            "name": "timeframe",
            "in": "query",
            "description": "Activity window; default 30d",
            "schema": {
              "type": "string",
              "enum": [
                "24h",
                "7d",
                "30d",
                "90d",
                "180d",
                "365d"
              ]
            }
          },
          {
            "name": "competitor",
            "in": "query",
            "description": "Comma-separated competitor names (multi-value, OR)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "connectionOf",
            "in": "query",
            "description": "Comma-separated rep names",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "icpTier",
            "in": "query",
            "description": "Comma-separated: high,medium,low",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "minPriorityScore",
            "in": "query",
            "description": "Only events at or above this score",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100
            }
          },
          {
            "name": "multiCompetitorOnly",
            "in": "query",
            "description": "Only events at accounts with 2+ competitors",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page; default 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows per page; default 50, max 200",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque cursor from a previous response's pagination.nextCursor. When present, page is ignored.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Scored events",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ActivityEvent"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer"
                        },
                        "limit": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/multi-competitor-accounts": {
      "get": {
        "summary": "Accounts touched by 2+ distinct competitors in the window. Params: timeframe, minCompetitors, limit.",
        "tags": [
          "Activity"
        ],
        "description": "Accounts touched by 2+ distinct competitors in the window \u2014 the strongest buying signal in the product.",
        "parameters": [
          {
            "name": "timeframe",
            "in": "query",
            "description": "Activity window; default 30d",
            "schema": {
              "type": "string",
              "enum": [
                "24h",
                "7d",
                "30d",
                "90d",
                "180d",
                "365d"
              ]
            }
          },
          {
            "name": "minCompetitors",
            "in": "query",
            "description": "Minimum distinct competitors; default 2",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows per page; default 25, max 100",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked accounts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AccountRollup"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/competitor-summary": {
      "get": {
        "summary": "One competitor's footprint: touches, accounts, buyers, seniority breakdown, top accounts. Params: competitor (required), timeframe, limit.",
        "tags": [
          "Activity"
        ],
        "description": "One competitor's footprint: touch/account/buyer counts, seniority breakdown, top accounts reached.",
        "parameters": [
          {
            "name": "competitor",
            "in": "query",
            "description": "Competitor company name (required)",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "timeframe",
            "in": "query",
            "description": "Activity window; default 30d",
            "schema": {
              "type": "string",
              "enum": [
                "24h",
                "7d",
                "30d",
                "90d",
                "180d",
                "365d"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows per page; default 25, max 100",
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/top-accounts": {
      "get": {
        "summary": "Accounts ranked by competitive activity. Params: timeframe, by (volume|competitor_breadth|buyer_count|recency), limit.",
        "tags": [
          "Activity"
        ],
        "description": "Accounts ranked by competitive activity.",
        "parameters": [
          {
            "name": "timeframe",
            "in": "query",
            "description": "Activity window; default 30d",
            "schema": {
              "type": "string",
              "enum": [
                "24h",
                "7d",
                "30d",
                "90d",
                "180d",
                "365d"
              ]
            }
          },
          {
            "name": "by",
            "in": "query",
            "description": "Ranking metric; default volume",
            "schema": {
              "type": "string",
              "enum": [
                "volume",
                "competitor_breadth",
                "buyer_count",
                "recency"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows per page; default 25, max 100",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked accounts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "by": {
                          "type": "string"
                        },
                        "windowDays": {
                          "type": "integer"
                        },
                        "accounts": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AccountRollup"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/accounts/{id}/activity": {
      "get": {
        "summary": "Account deep-dive: competitor-touch timeline, buying committee, competitor breadth, job-change flags. Params: timeframe, timelineLimit.",
        "tags": [
          "Activity"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Account ID",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timeframe",
            "in": "query",
            "description": "Activity window; default 30d",
            "schema": {
              "type": "string",
              "enum": [
                "24h",
                "7d",
                "30d",
                "90d",
                "180d",
                "365d"
              ]
            }
          },
          {
            "name": "timelineLimit",
            "in": "query",
            "description": "Max timeline rows; default 50, max 200",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "description": "Account deep-dive: chronological competitor-touch timeline, buying committee (distinct people with titles, ICP tiers, job-change flags), and competitor breadth."
      }
    },
    "/webhooks/deliveries": {
      "get": {
        "summary": "List webhook deliveries. ?status=pending|delivered|dead (dead = dead-letter queue: exhausted after 7 attempts / ~24h of backoff), ?webhookId, ?limit.",
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/webhooks/deliveries/{id}/replay": {
      "post": {
        "summary": "Re-queue a delivery (typically dead-lettered) for immediate retry.",
        "tags": [
          "Webhooks"
        ]
      }
    }
  }
}
