{
  "openapi": "3.1.0",
  "info": {
    "title": "Outreach API",
    "version": "1.0.0",
    "description": "REST API for the outreach platform. Every operation runs the same database function the web app uses, as the member who created the key, limited to the key's role and client scope. Caps, schedules, warm-up, reply-stop and suppression are enforced in the database, so the API cannot send more than the app can. Guide: docs/outreach/API.md."
  },
  "servers": [
    {
      "url": "https://{project}.supabase.co/functions/v1/outreach-api",
      "variables": {
        "project": {
          "default": "ktwqkvjuzsunssudqnrt",
          "description": "Supabase project ref."
        }
      }
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "tags": [
    {
      "name": "Meta"
    },
    {
      "name": "Leads"
    },
    {
      "name": "Enrollments"
    },
    {
      "name": "Sequences"
    },
    {
      "name": "Inbox"
    },
    {
      "name": "Senders"
    },
    {
      "name": "Reports"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "Tasks"
    }
  ],
  "paths": {
    "/v1/me": {
      "get": {
        "operationId": "get_me",
        "tags": [
          "Meta"
        ],
        "summary": "The key, its workspace, and the ids you need elsewhere",
        "description": "Database function: `outreach_api_context`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Me"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/metrics/definitions": {
      "get": {
        "operationId": "get_metrics_definitions",
        "tags": [
          "Meta"
        ],
        "summary": "What every number in the reports means",
        "description": "Database function: `outreach_metric_definitions`.\n\nRate class: read.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "description": "metric key → definition",
                      "properties": {},
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads": {
      "get": {
        "operationId": "get_leads",
        "tags": [
          "Leads"
        ],
        "summary": "Search leads",
        "description": "Database function: `outreach_api_leads`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Matches name, company, headline and work email."
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "list_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "stage_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tag_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "public_identifier",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "updated_since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "replied",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "enriched",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Lead"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "total",
                    "limit",
                    "offset",
                    "has_more"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "post_leads",
        "tags": [
          "Leads"
        ],
        "summary": "Create or update a lead",
        "description": "Matches an existing lead by LinkedIn id, then provider id, then work email, then personal email. On a match only the fields you send change; a field you leave out is never blanked. `unchanged_fields` lists fields that were sent but kept their old value (fill-only fields that already had one).\n\nDatabase function: `outreach_upsert_lead`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LeadDetail"
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "unchanged_fields": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LeadDetail"
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "unchanged_fields": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads/{id}": {
      "get": {
        "operationId": "get_leads_id",
        "tags": [
          "Leads"
        ],
        "summary": "Get a lead with tags, profile, sender state and enrollments",
        "description": "Database function: `outreach_api_lead`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LeadDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "patch_leads_id",
        "tags": [
          "Leads"
        ],
        "summary": "Change some fields of a lead",
        "description": "Only the fields you send change. A field you leave out is never blanked. Emails, the LinkedIn id and the client are filled only when empty.\n\nDatabase function: `outreach_upsert_lead`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LeadDetail"
                    },
                    "unchanged_fields": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads/{id}/tags": {
      "post": {
        "operationId": "post_leads_id_tags",
        "tags": [
          "Leads"
        ],
        "summary": "Add one or more tags",
        "description": "Database function: `outreach_bulk_leads`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Send tag_id or tag_ids (max 20).",
                "properties": {
                  "tag_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "tag_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LeadDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads/{id}/tags/{tag_id}": {
      "delete": {
        "operationId": "delete_leads_id_tags_tag_id",
        "tags": [
          "Leads"
        ],
        "summary": "Remove a tag",
        "description": "Database function: `outreach_bulk_leads`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tag_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LeadDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads/{id}/stage": {
      "put": {
        "operationId": "put_leads_id_stage",
        "tags": [
          "Leads"
        ],
        "summary": "Set or clear the stage",
        "description": "Database function: `outreach_bulk_leads`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "stage_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "null clears it.",
                    "format": "uuid"
                  }
                },
                "required": [
                  "stage_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LeadDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads/{id}/list": {
      "put": {
        "operationId": "put_leads_id_list",
        "tags": [
          "Leads"
        ],
        "summary": "Set or clear the list",
        "description": "Database function: `outreach_bulk_leads`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "list_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "null clears it.",
                    "format": "uuid"
                  }
                },
                "required": [
                  "list_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LeadDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads/{id}/suppress": {
      "post": {
        "operationId": "post_leads_id_suppress",
        "tags": [
          "Leads"
        ],
        "summary": "Mark the lead do-not-contact",
        "description": "Stops future sends. The lead, its timeline and its chats are kept.\n\nDatabase function: `outreach_bulk_leads`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LeadDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "delete_leads_id_suppress",
        "tags": [
          "Leads"
        ],
        "summary": "Clear do-not-contact",
        "description": "Database function: `outreach_bulk_leads`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LeadDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads/{id}/timeline": {
      "get": {
        "operationId": "get_leads_id_timeline",
        "tags": [
          "Leads"
        ],
        "summary": "Everything that happened to a lead, newest first",
        "description": "Database function: `outreach_lead_timeline`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TimelineEvent"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads/enrich": {
      "post": {
        "operationId": "post_leads_enrich",
        "tags": [
          "Leads"
        ],
        "summary": "Queue profile enrichment",
        "description": "Uses profile views left over after the day's sequence actions. Leads enriched in the last 90 days are skipped unless force is true.\n\nDatabase function: `outreach_request_enrichment`.\n\nMinimum key role: member.\n\nRate class: spend.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lead_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "1 to 5000."
                  },
                  "want_posts": {
                    "type": "boolean"
                  },
                  "force": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "lead_ids"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "queued": {
                          "type": "integer"
                        },
                        "skipped_fresh": {
                          "type": "integer"
                        },
                        "skipped_no_linkedin_id": {
                          "type": "integer"
                        },
                        "note": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/suppressions": {
      "post": {
        "operationId": "post_suppressions",
        "tags": [
          "Leads"
        ],
        "summary": "Add emails, domains, LinkedIn profiles or companies to a blacklist",
        "description": "Workspace-wide by default. Send client_id or sequence_id (not both) to limit the scope. kind is inferred from the value when left out.\n\nDatabase function: `outreach_add_suppressions`.\n\nMinimum key role: manager.\n\nRate class: write.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rows": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "email",
                            "domain",
                            "public_identifier",
                            "company"
                          ]
                        },
                        "value": {
                          "type": "string"
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "value"
                      ],
                      "additionalProperties": false
                    },
                    "description": "1 to 20000."
                  },
                  "client_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "sequence_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "source": {
                    "type": "string",
                    "description": "Default: api."
                  }
                },
                "required": [
                  "rows"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "added": {
                          "type": "integer"
                        },
                        "skipped": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/enrollments/preview": {
      "post": {
        "operationId": "post_enrollments_preview",
        "tags": [
          "Enrollments"
        ],
        "summary": "See what enrolling these leads would do",
        "description": "Changes nothing. Returns who is eligible, who is excluded and why, which sender each lead would get, and how long the sequence would take.\n\nDatabase function: `outreach_enroll_preview`.\n\nMinimum key role: member.\n\nRate class: read.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnrollRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EnrollPreview"
                    },
                    "next": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/enrollments": {
      "post": {
        "operationId": "post_enrollments",
        "tags": [
          "Enrollments"
        ],
        "summary": "Enrol leads (commit)",
        "description": "Needs confirm: true. The database runs the same plan as the preview and re-checks every rule at commit time, so the commit can enrol fewer leads than the preview showed, never more, and never a lead outside lead_ids.\n\nDatabase function: `outreach_enroll_leads`.\n\nMinimum key role: member.\n\nRate class: spend.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnrollCommit"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EnrollResult"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "E_CONFIRM_REQUIRED, E_POOL_EMPTY, E_SENDER_NOT_IN_POOL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_enrollments",
        "tags": [
          "Enrollments"
        ],
        "summary": "List enrollments",
        "description": "Database function: `outreach_api_enrollments`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "sequence_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "lead_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sender_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "waiting_connection",
                "waiting_delay",
                "waiting_task",
                "paused",
                "completed",
                "exited_replied",
                "exited_manual",
                "exited_suppressed",
                "exited_sender_disabled",
                "failed",
                "cancelled"
              ]
            }
          },
          {
            "name": "live",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "true = still in the sequence."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Enrollment"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "total",
                    "limit",
                    "offset",
                    "has_more"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/enrollments/{id}/pause": {
      "post": {
        "operationId": "post_enrollments_id_pause",
        "tags": [
          "Enrollments"
        ],
        "summary": "Pause one enrollment",
        "description": "Database function: `outreach_pause_enrollment`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "action": {
                          "type": "string",
                          "const": "paused"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/enrollments/{id}/resume": {
      "post": {
        "operationId": "post_enrollments_id_resume",
        "tags": [
          "Enrollments"
        ],
        "summary": "Resume one enrollment",
        "description": "Database function: `outreach_resume_enrollment`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "action": {
                          "type": "string",
                          "const": "resumed"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/enrollments/{id}/exit": {
      "post": {
        "operationId": "post_enrollments_id_exit",
        "tags": [
          "Enrollments"
        ],
        "summary": "Exit one enrollment",
        "description": "Database function: `outreach_exit_enrollment`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "description": "Stored as the exit reason. Default: api."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "action": {
                          "type": "string",
                          "const": "exited"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/enrollments/recover": {
      "post": {
        "operationId": "post_enrollments_recover",
        "tags": [
          "Enrollments"
        ],
        "summary": "Retry, skip or exit failed leads",
        "description": "retry runs the failed step again, skip moves past it, exit ends the enrollment. There is no restart from the top.\n\nDatabase function: `outreach_enrollment_recover`.\n\nMinimum key role: member.\n\nRate class: spend.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enrollment_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "1 to 500."
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "retry",
                      "skip",
                      "exit"
                    ]
                  }
                },
                "required": [
                  "enrollment_ids",
                  "action"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "done": {
                          "type": "integer"
                        },
                        "action": {
                          "type": "string"
                        },
                        "refused": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "reason": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": true
                          }
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sequences": {
      "get": {
        "operationId": "get_sequences",
        "tags": [
          "Sequences"
        ],
        "summary": "List sequences",
        "description": "Database function: `outreach_api_sequences`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "active",
                "paused",
                "archived"
              ]
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SequenceSummary"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sequences/{id}": {
      "get": {
        "operationId": "get_sequences_id",
        "tags": [
          "Sequences"
        ],
        "summary": "Get a sequence with its steps, per-step stats and auto-enrol rules",
        "description": "Database function: `outreach_api_sequence`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Sequence"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sequences/{id}/stats": {
      "get": {
        "operationId": "get_sequences_id_stats",
        "tags": [
          "Sequences"
        ],
        "summary": "Sequence report",
        "description": "Database function: `outreach_report_sequence`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SequenceReport"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sequences/{id}/activate": {
      "post": {
        "operationId": "post_sequences_id_activate",
        "tags": [
          "Sequences"
        ],
        "summary": "Activate a sequence",
        "description": "Fails with E_POOL_EMPTY, E_SENDER_NOT_OK or E_GRAPH_INVALID when it cannot run.\n\nDatabase function: `outreach_set_sequence_status`.\n\nMinimum key role: manager.\n\nRate class: spend.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {}
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sequences/{id}/pause": {
      "post": {
        "operationId": "post_sequences_id_pause",
        "tags": [
          "Sequences"
        ],
        "summary": "Pause a sequence and every lead in it",
        "description": "Database function: `outreach_set_sequence_status`.\n\nMinimum key role: manager.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {}
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sequences/{id}/failed": {
      "get": {
        "operationId": "get_sequences_id_failed",
        "tags": [
          "Sequences"
        ],
        "summary": "Failed or skipped leads, grouped by reason and listed",
        "description": "Database function: `outreach_failed_summary + failed_leads`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "failed",
                "skipped"
              ],
              "default": "failed"
            }
          },
          {
            "name": "node_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FailedLeads"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sequences/{id}/why-not-sending": {
      "get": {
        "operationId": "get_sequences_id_why_not_sending",
        "tags": [
          "Sequences"
        ],
        "summary": "Why a sequence is not sending right now",
        "description": "Database function: `outreach_why_not_sending`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sender_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "enrollment_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/WhyNotSending"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/threads": {
      "get": {
        "operationId": "get_threads",
        "tags": [
          "Inbox"
        ],
        "summary": "List threads",
        "description": "Database function: `outreach_api_threads`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "intent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "interested",
                "question",
                "not_now",
                "not_interested",
                "ooo",
                "wrong_person",
                "unclear",
                "unclassified"
              ]
            }
          },
          {
            "name": "sender_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "lead_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sequence_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "unread",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "waiting_on_us",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "true = the last message is theirs."
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Thread"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "total",
                    "limit",
                    "offset",
                    "has_more"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/threads/{id}": {
      "get": {
        "operationId": "get_threads_id",
        "tags": [
          "Inbox"
        ],
        "summary": "Get a thread with messages and what produced each message",
        "description": "Database function: `outreach_api_thread`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ThreadDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/threads/{id}/reply": {
      "post": {
        "operationId": "post_threads_id_reply",
        "tags": [
          "Inbox"
        ],
        "summary": "Send a reply (not available with API keys yet)",
        "description": "Answers 501 E_NOT_IMPLEMENTED today. Replies are sent by the outreach-send-reply function, which needs a member session. The request shape is final.\n\nRate class: spend.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 8000
                  },
                  "subject": {
                    "type": "string",
                    "description": "Email threads only."
                  }
                },
                "required": [
                  "text"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Message"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "E_NOT_IMPLEMENTED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/threads/{id}/intent": {
      "put": {
        "operationId": "put_threads_id_intent",
        "tags": [
          "Inbox"
        ],
        "summary": "Set the intent of a thread",
        "description": "Database function: `outreach_set_intent`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "intent": {
                    "type": "string",
                    "enum": [
                      "interested",
                      "question",
                      "not_now",
                      "not_interested",
                      "ooo",
                      "wrong_person",
                      "unclear",
                      "unclassified"
                    ]
                  }
                },
                "required": [
                  "intent"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "intent": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/threads/{id}/assignee": {
      "put": {
        "operationId": "put_threads_id_assignee",
        "tags": [
          "Inbox"
        ],
        "summary": "Assign a thread to a teammate, or to nobody",
        "description": "Database function: `outreach_assign_chat`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "user_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "A workspace member's user id. null unassigns.",
                    "format": "uuid"
                  }
                },
                "required": [
                  "user_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "assigned_to": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/senders": {
      "get": {
        "operationId": "get_senders",
        "tags": [
          "Senders"
        ],
        "summary": "List senders with today's budgets",
        "description": "Database function: `outreach_api_senders`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SenderSummary"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/senders/{id}": {
      "get": {
        "operationId": "get_senders_id",
        "tags": [
          "Senders"
        ],
        "summary": "Get a sender",
        "description": "Database function: `outreach_api_sender`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Sender"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/senders/{id}/health": {
      "get": {
        "operationId": "get_senders_id_health",
        "tags": [
          "Senders"
        ],
        "summary": "Health breakdown, recommendations, warm-up, last 30 days",
        "description": "Database function: `outreach_sender_insights`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SenderHealth"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/senders/{id}/budgets": {
      "get": {
        "operationId": "get_senders_id_budgets",
        "tags": [
          "Senders"
        ],
        "summary": "Today's cap, used and reserved per action type",
        "description": "Database function: `outreach_sender_today`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Budget"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/senders/{id}/capacity": {
      "get": {
        "operationId": "get_senders_id_capacity",
        "tags": [
          "Senders"
        ],
        "summary": "Effective daily caps right now",
        "description": "Database function: `outreach_api_sender`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SenderCapacity"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/overview": {
      "get": {
        "operationId": "get_reports_overview",
        "tags": [
          "Reports"
        ],
        "summary": "Totals, previous period, by channel, daily series",
        "description": "Database function: `outreach_report_overview`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sequence_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sender_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "node_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "variant_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "linkedin",
                "email"
              ]
            }
          },
          {
            "name": "list_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tag_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Overview"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/funnel": {
      "get": {
        "operationId": "get_reports_funnel",
        "tags": [
          "Reports"
        ],
        "summary": "Enrolled → invited → accepted → messaged → replied → interested → meeting → won",
        "description": "Database function: `outreach_report_funnel`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sequence_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sender_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "node_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "variant_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "linkedin",
                "email"
              ]
            }
          },
          {
            "name": "list_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tag_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Funnel"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/intents": {
      "get": {
        "operationId": "get_reports_intents",
        "tags": [
          "Reports"
        ],
        "summary": "Replies by intent, grouped",
        "description": "Database function: `outreach_report_intents`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "group",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "sequence",
                "step",
                "sender",
                "variant",
                "channel"
              ],
              "default": "day"
            }
          },
          {
            "name": "sequence_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sender_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "node_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "variant_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "linkedin",
                "email"
              ]
            }
          },
          {
            "name": "list_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tag_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "replies": {
                          "type": "integer"
                        },
                        "touches": {
                          "type": "integer"
                        },
                        "reply_rate": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "positive_reply_rate": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "negative_reply_rate": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "intents": {
                          "type": "object",
                          "description": "Replies per intent.",
                          "properties": {
                            "interested": {
                              "type": "integer"
                            },
                            "question": {
                              "type": "integer"
                            },
                            "not_now": {
                              "type": "integer"
                            },
                            "not_interested": {
                              "type": "integer"
                            },
                            "ooo": {
                              "type": "integer"
                            },
                            "wrong_person": {
                              "type": "integer"
                            },
                            "unclear": {
                              "type": "integer"
                            },
                            "unclassified": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "interested",
                            "question",
                            "not_now",
                            "not_interested",
                            "ooo",
                            "wrong_person",
                            "unclear",
                            "unclassified"
                          ],
                          "additionalProperties": true
                        },
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "replies": {
                                "type": "integer"
                              },
                              "touches": {
                                "type": "integer"
                              },
                              "reply_rate": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "intents": {
                                "type": "object",
                                "description": "Replies per intent.",
                                "properties": {
                                  "interested": {
                                    "type": "integer"
                                  },
                                  "question": {
                                    "type": "integer"
                                  },
                                  "not_now": {
                                    "type": "integer"
                                  },
                                  "not_interested": {
                                    "type": "integer"
                                  },
                                  "ooo": {
                                    "type": "integer"
                                  },
                                  "wrong_person": {
                                    "type": "integer"
                                  },
                                  "unclear": {
                                    "type": "integer"
                                  },
                                  "unclassified": {
                                    "type": "integer"
                                  }
                                },
                                "required": [
                                  "interested",
                                  "question",
                                  "not_now",
                                  "not_interested",
                                  "ooo",
                                  "wrong_person",
                                  "unclear",
                                  "unclassified"
                                ],
                                "additionalProperties": true
                              }
                            },
                            "additionalProperties": true
                          }
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/reply-threads": {
      "get": {
        "operationId": "get_reports_reply_threads",
        "tags": [
          "Reports"
        ],
        "summary": "The threads behind a reply number",
        "description": "Database function: `outreach_report_reply_threads`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "intent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "interested",
                "question",
                "not_now",
                "not_interested",
                "ooo",
                "wrong_person",
                "unclear",
                "unclassified"
              ]
            }
          },
          {
            "name": "sequence_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sender_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "node_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "variant_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "linkedin",
                "email"
              ]
            }
          },
          {
            "name": "list_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tag_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "chat_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "lead_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "lead_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sender_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "intent": {
                            "type": "string"
                          },
                          "replied_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "sequence_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "node_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "variant_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "preview": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/cost": {
      "get": {
        "operationId": "get_reports_cost",
        "tags": [
          "Reports"
        ],
        "summary": "Cost per reply, per interested lead and per meeting",
        "description": "Database function: `outreach_report_cost`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {},
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/sequences": {
      "get": {
        "operationId": "get_reports_sequences",
        "tags": [
          "Reports"
        ],
        "summary": "One row of totals per sequence",
        "description": "Database function: `outreach_report_sequences`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "totals": {
                            "$ref": "#/components/schemas/Totals"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/senders": {
      "get": {
        "operationId": "get_reports_senders",
        "tags": [
          "Reports"
        ],
        "summary": "One row of totals per sender",
        "description": "Database function: `outreach_report_senders`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "totals": {
                            "$ref": "#/components/schemas/Totals"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/clients": {
      "get": {
        "operationId": "get_reports_clients",
        "tags": [
          "Reports"
        ],
        "summary": "One row of totals per client",
        "description": "Database function: `outreach_report_clients`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "totals": {
                            "$ref": "#/components/schemas/Totals"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/sequences/{id}": {
      "get": {
        "operationId": "get_reports_sequences_id",
        "tags": [
          "Reports"
        ],
        "summary": "Sequence report (same as /v1/sequences/{id}/stats)",
        "description": "Database function: `outreach_report_sequence`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SequenceReport"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/senders/{id}": {
      "get": {
        "operationId": "get_reports_senders_id",
        "tags": [
          "Reports"
        ],
        "summary": "Sender report",
        "description": "Database function: `outreach_report_sender`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "totals": {
                          "$ref": "#/components/schemas/Totals"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/clients/{id}": {
      "get": {
        "operationId": "get_reports_clients_id",
        "tags": [
          "Reports"
        ],
        "summary": "Client report",
        "description": "Database function: `outreach_report_client`.\n\nMinimum key role: client_viewer.\n\nRate class: read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive, YYYY-MM-DD, workspace timezone."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "totals": {
                          "$ref": "#/components/schemas/Totals"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "operationId": "get_webhooks",
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhooks",
        "description": "Database function: `outreach_api_webhooks`.\n\nMinimum key role: manager.\n\nRate class: read.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      }
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Every event name you can subscribe to."
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "post_webhooks",
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook",
        "description": "The secret is returned once. At most 20 webhooks per workspace.\n\nDatabase function: `outreach_create_webhook`.\n\nMinimum key role: manager.\n\nRate class: write.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Must start with https://",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "*",
                        "sender.connected",
                        "sender.disconnected",
                        "sender.reconnected",
                        "sender.paused",
                        "sender.level_changed",
                        "sender.running_dry",
                        "lead.created",
                        "lead.updated",
                        "lead.unsubscribed",
                        "invite.sent",
                        "invite.accepted",
                        "invite.withdrawn",
                        "message.sent",
                        "message.received",
                        "message.classified",
                        "email.sent",
                        "email.opened",
                        "email.clicked",
                        "email.bounced",
                        "enrollment.started",
                        "enrollment.exited",
                        "enrollment.completed",
                        "enrollment.held",
                        "enrollment.resumed",
                        "enrollment.recovered",
                        "task.created",
                        "task.completed",
                        "meeting.booked",
                        "sequence.activated",
                        "sequence.paused",
                        "sequence.throttled",
                        "sequence.webhook",
                        "sequence.stalled",
                        "sequence.recovered",
                        "sequence.published",
                        "workspace.billing_recovered"
                      ]
                    },
                    "description": "Default: [\"*\"] (everything)."
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/WebhookCreated"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "delete": {
        "operationId": "delete_webhooks_id",
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook",
        "description": "Database function: `outreach_delete_webhook`.\n\nMinimum key role: manager.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "deleted": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/deliveries": {
      "get": {
        "operationId": "get_webhooks_deliveries",
        "tags": [
          "Webhooks"
        ],
        "summary": "Recent deliveries, newest first",
        "description": "Database function: `outreach_api_deliveries`.\n\nMinimum key role: manager.\n\nRate class: read.",
        "parameters": [
          {
            "name": "webhook_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Delivery"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/deliveries/{id}/replay": {
      "post": {
        "operationId": "post_webhooks_deliveries_id_replay",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a past delivery again",
        "description": "Queues a new delivery with the same payload plus replayed: true and replay_of. Sent within about 30 seconds.\n\nDatabase function: `outreach_replay_delivery`.\n\nMinimum key role: manager.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Delivery id."
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "delivery_id": {
                          "type": "integer"
                        },
                        "replay_of": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string",
                          "const": "queued"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}/complete": {
      "post": {
        "operationId": "post_tasks_id_complete",
        "tags": [
          "Tasks"
        ],
        "summary": "Complete a task",
        "description": "For a call task send result.outcome (connected, voicemail, no_answer, wrong_number). For a reply_hold task send result.decision (resume or exit). For an approval task, text replaces the draft.\n\nDatabase function: `outreach_complete_task`.\n\nMinimum key role: member.\n\nRate class: write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string"
                  },
                  "result": {
                    "type": "object",
                    "properties": {
                      "outcome": {
                        "type": "string",
                        "enum": [
                          "connected",
                          "voicemail",
                          "no_answer",
                          "wrong_number"
                        ]
                      },
                      "decision": {
                        "type": "string",
                        "enum": [
                          "resume",
                          "exit"
                        ]
                      }
                    },
                    "additionalProperties": true
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "completed": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key (E_UNAUTHORIZED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Workspace suspended (E_PLAN_SUSPENDED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key's role or client scope does not allow this (E_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not visible to this key (E_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "E_IDEMPOTENCY_MISMATCH, E_IN_PROGRESS or E_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (E_PAYLOAD_INVALID, E_TOO_MANY, E_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached (E_RATE_LIMITED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the hourly window resets."
              }
            }
          },
          "500": {
            "description": "Unexpected error (E_INTERNAL). Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "event": {
      "post": {
        "summary": "What we POST to your webhook URL",
        "description": "Headers: x-signature (hex HMAC-SHA256 of the raw body with the webhook secret), x-event, x-delivery-id. Answer 2xx within 10 seconds. Up to 5 attempts with backoff.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ok_live_…",
        "description": "Authorization: Bearer ok_live_…"
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "maxLength": 255
        },
        "description": "Makes a retry safe. Same key and same request replays the first answer; same key and a different request answers 409 E_IDEMPOTENCY_MISMATCH."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable machine code, E_…"
              },
              "message": {
                "type": "string",
                "description": "Plain sentence. Safe to show to a person."
              },
              "request_id": {
                "type": "string",
                "description": "Quote this when you ask for help."
              },
              "details": {
                "type": "object",
                "description": "Present on some errors, for example retry_after on E_RATE_LIMITED.",
                "properties": {},
                "additionalProperties": true
              }
            },
            "required": [
              "code",
              "message",
              "request_id"
            ],
            "additionalProperties": true
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": true
      },
      "Totals": {
        "type": "object",
        "description": "The same keys everywhere a report returns numbers. Rates are percentages with one decimal, null when the denominator is 0.",
        "properties": {
          "enrolled": {
            "type": "integer"
          },
          "invites": {
            "type": "integer"
          },
          "invites_with_note": {
            "type": "integer"
          },
          "accepted": {
            "type": "integer"
          },
          "messages": {
            "type": "integer"
          },
          "inmails": {
            "type": "integer"
          },
          "emails": {
            "type": "integer"
          },
          "touches": {
            "type": "integer"
          },
          "replies": {
            "type": "integer"
          },
          "interested": {
            "type": "integer"
          },
          "meetings": {
            "type": "integer"
          },
          "won": {
            "type": "integer"
          },
          "lost": {
            "type": "integer"
          },
          "inbound_messages": {
            "type": "integer"
          },
          "profile_views": {
            "type": "integer"
          },
          "likes": {
            "type": "integer"
          },
          "comments": {
            "type": "integer"
          },
          "endorsements": {
            "type": "integer"
          },
          "follows": {
            "type": "integer"
          },
          "withdrawn": {
            "type": "integer"
          },
          "post_fetches": {
            "type": "integer"
          },
          "failed": {
            "type": "integer"
          },
          "skipped": {
            "type": "integer"
          },
          "limit_hits": {
            "type": "integer"
          },
          "email_opened": {
            "type": "integer"
          },
          "email_clicked": {
            "type": "integer"
          },
          "email_bounced": {
            "type": "integer"
          },
          "acceptance_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Percentage with one decimal. null when the denominator is 0."
          },
          "reply_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Percentage with one decimal. null when the denominator is 0."
          },
          "interested_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Percentage with one decimal. null when the denominator is 0."
          },
          "positive_reply_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Percentage with one decimal. null when the denominator is 0."
          },
          "negative_reply_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Percentage with one decimal. null when the denominator is 0."
          },
          "open_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Percentage with one decimal. null when the denominator is 0."
          },
          "click_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Percentage with one decimal. null when the denominator is 0."
          },
          "bounce_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Percentage with one decimal. null when the denominator is 0."
          },
          "won_value": {
            "type": [
              "number",
              "null"
            ],
            "description": "Sum of won deal values."
          },
          "intents": {
            "type": "object",
            "description": "Replies per intent.",
            "properties": {
              "interested": {
                "type": "integer"
              },
              "question": {
                "type": "integer"
              },
              "not_now": {
                "type": "integer"
              },
              "not_interested": {
                "type": "integer"
              },
              "ooo": {
                "type": "integer"
              },
              "wrong_person": {
                "type": "integer"
              },
              "unclear": {
                "type": "integer"
              },
              "unclassified": {
                "type": "integer"
              }
            },
            "required": [
              "interested",
              "question",
              "not_now",
              "not_interested",
              "ooo",
              "wrong_person",
              "unclear",
              "unclassified"
            ],
            "additionalProperties": true
          }
        },
        "required": [
          "enrolled",
          "invites",
          "invites_with_note",
          "accepted",
          "messages",
          "inmails",
          "emails",
          "touches",
          "replies",
          "interested",
          "meetings",
          "won",
          "lost",
          "inbound_messages",
          "profile_views",
          "likes",
          "comments",
          "endorsements",
          "follows",
          "withdrawn",
          "post_fetches",
          "failed",
          "skipped",
          "limit_hits",
          "email_opened",
          "email_clicked",
          "email_bounced",
          "acceptance_rate",
          "reply_rate",
          "interested_rate",
          "positive_reply_rate",
          "negative_reply_rate",
          "open_rate",
          "click_rate",
          "bounce_rate",
          "won_value",
          "intents"
        ],
        "additionalProperties": true
      },
      "Overview": {
        "type": "object",
        "properties": {
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "days": {
                "type": "integer"
              },
              "timezone": {
                "type": "string"
              },
              "previous_from": {
                "type": "string",
                "format": "date"
              },
              "previous_to": {
                "type": "string",
                "format": "date"
              }
            },
            "additionalProperties": true
          },
          "totals": {
            "$ref": "#/components/schemas/Totals"
          },
          "previous": {
            "$ref": "#/components/schemas/Totals"
          },
          "by_channel": {
            "type": "object",
            "properties": {
              "linkedin": {
                "$ref": "#/components/schemas/Totals"
              },
              "email": {
                "$ref": "#/components/schemas/Totals"
              }
            },
            "additionalProperties": true
          },
          "series": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "type": "object",
                  "properties": {
                    "day": {
                      "type": "string",
                      "format": "date"
                    }
                  },
                  "additionalProperties": true
                },
                {
                  "$ref": "#/components/schemas/Totals"
                }
              ]
            }
          }
        },
        "required": [
          "period",
          "totals"
        ],
        "additionalProperties": true
      },
      "Funnel": {
        "type": "object",
        "properties": {
          "cohort": {
            "type": "object",
            "description": "The leads the funnel was computed for (date range and filters).",
            "properties": {},
            "additionalProperties": true
          },
          "stages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "stage": {
                  "type": "string",
                  "enum": [
                    "enrolled",
                    "invited",
                    "accepted",
                    "messaged",
                    "replied",
                    "interested",
                    "meeting",
                    "won"
                  ]
                },
                "count": {
                  "type": "integer"
                },
                "pct_of_enrolled": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "pct_of_previous": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "median_hours_from_previous": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              },
              "required": [
                "stage",
                "count"
              ],
              "additionalProperties": true
            }
          }
        },
        "required": [
          "stages"
        ],
        "additionalProperties": true
      },
      "Lead": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "public_identifier": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "profile_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "first_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "full_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "headline": {
            "type": [
              "string",
              "null"
            ]
          },
          "company": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "picture_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_work": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_personal": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "verified | unverified | null"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Read only through the API."
          },
          "is_open_profile": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "custom": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "list_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "stage_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "do_not_contact": {
            "type": "boolean"
          },
          "unsubscribed": {
            "type": "boolean"
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "import_job_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "last_profile_fetch_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_replied_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_replied_channel": {
            "type": [
              "string",
              "null"
            ]
          },
          "enrich_status": {
            "type": "string",
            "enum": [
              "none",
              "waiting",
              "done",
              "failed"
            ]
          },
          "enriched_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": true
      },
      "LeadDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Lead"
          },
          {
            "type": "object",
            "properties": {
              "tags": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              },
              "profile": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "Enriched profile: about, experience, education, skills, languages, posts."
              },
              "senders": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "sender_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "relation": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "invite_sent_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "invite_accepted_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "last_outbound_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "last_inbound_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    }
                  },
                  "additionalProperties": true
                }
              },
              "enrollments": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "sequence_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "sender_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "waiting_connection",
                        "waiting_delay",
                        "waiting_task",
                        "paused",
                        "completed",
                        "exited_replied",
                        "exited_manual",
                        "exited_suppressed",
                        "exited_sender_disabled",
                        "failed",
                        "cancelled"
                      ]
                    },
                    "current_node_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "exit_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": true
                }
              },
              "suppressed": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why the lead cannot be contacted, or null."
              }
            },
            "additionalProperties": true
          }
        ]
      },
      "LeadInput": {
        "type": "object",
        "description": "Send linkedin_url, public_identifier, provider_id or an email so the lead can be matched. Unknown keys are rejected.",
        "properties": {
          "linkedin_url": {
            "type": "string",
            "description": "https://www.linkedin.com/in/<name>. Converted to public_identifier.",
            "format": "uri"
          },
          "public_identifier": {
            "type": "string",
            "description": "The part after linkedin.com/in/. Lower-cased."
          },
          "email": {
            "type": "string",
            "description": "Alias of email_work.",
            "format": "email"
          },
          "email_work": {
            "type": "string",
            "description": "Filled only when the lead has no work email yet. Never overwritten.",
            "format": "email"
          },
          "email_personal": {
            "type": "string",
            "description": "Filled only when empty. Never overwritten.",
            "format": "email"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "full_name": {
            "type": "string"
          },
          "headline": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "LinkedIn company id."
          },
          "title": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "picture_url": {
            "type": "string",
            "format": "uri"
          },
          "profile_url": {
            "type": "string",
            "format": "uri"
          },
          "is_open_profile": {
            "type": "boolean"
          },
          "custom": {
            "type": "object",
            "description": "Custom fields. Merged key by key: keys you leave out keep their value.",
            "properties": {},
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          },
          "list_id": {
            "type": "string",
            "format": "uuid"
          },
          "stage_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "description": "Filled only when the lead has no client yet.",
            "format": "uuid"
          },
          "provider_id": {
            "type": "string",
            "description": "LinkedIn member id, when you have it."
          },
          "source": {
            "type": "string",
            "description": "Free label stored on new leads. Default: api."
          }
        },
        "additionalProperties": false
      },
      "LeadPatch": {
        "type": "object",
        "description": "Only the fields you send change. A field you leave out is never blanked. Empty strings and nulls count as left out. Unknown keys are rejected.",
        "properties": {
          "linkedin_url": {
            "type": "string",
            "description": "https://www.linkedin.com/in/<name>. Converted to public_identifier.",
            "format": "uri"
          },
          "public_identifier": {
            "type": "string",
            "description": "The part after linkedin.com/in/. Lower-cased."
          },
          "email": {
            "type": "string",
            "description": "Alias of email_work.",
            "format": "email"
          },
          "email_work": {
            "type": "string",
            "description": "Filled only when the lead has no work email yet. Never overwritten.",
            "format": "email"
          },
          "email_personal": {
            "type": "string",
            "description": "Filled only when empty. Never overwritten.",
            "format": "email"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "full_name": {
            "type": "string"
          },
          "headline": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "LinkedIn company id."
          },
          "title": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "picture_url": {
            "type": "string",
            "format": "uri"
          },
          "profile_url": {
            "type": "string",
            "format": "uri"
          },
          "is_open_profile": {
            "type": "boolean"
          },
          "custom": {
            "type": "object",
            "description": "Custom fields. Merged key by key: keys you leave out keep their value.",
            "properties": {},
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          },
          "list_id": {
            "type": "string",
            "format": "uuid"
          },
          "stage_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "description": "Filled only when the lead has no client yet.",
            "format": "uuid"
          }
        },
        "additionalProperties": false
      },
      "TimelineEvent": {
        "type": "object",
        "properties": {
          "at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "kind": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "Enrollment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence_name": {
            "type": "string"
          },
          "sequence_version": {
            "type": "integer"
          },
          "pinned_version": {
            "type": [
              "integer",
              "null"
            ]
          },
          "lead_id": {
            "type": "string",
            "format": "uuid"
          },
          "lead_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "sender_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "waiting_connection",
              "waiting_delay",
              "waiting_task",
              "paused",
              "completed",
              "exited_replied",
              "exited_manual",
              "exited_suppressed",
              "exited_sender_disabled",
              "failed",
              "cancelled"
            ]
          },
          "current_node_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "node_entered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "wait_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "wait_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "enrichment | ai_review | null"
          },
          "held_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set while the lead is held after a reply.",
            "format": "date-time"
          },
          "hold_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "exit_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "priority": {
            "type": "integer"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "sequence_id",
          "lead_id",
          "sender_id",
          "status"
        ],
        "additionalProperties": true
      },
      "EnrollRequest": {
        "type": "object",
        "properties": {
          "sequence_id": {
            "type": "string",
            "format": "uuid"
          },
          "lead_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "1 to 10000 lead ids."
          },
          "sender_id": {
            "type": "string",
            "description": "Force one sender from the pool. Leave out to use the sequence's assignment rule.",
            "format": "uuid"
          },
          "include_replied": {
            "type": "boolean",
            "description": "Also enrol leads who replied recently. Default false."
          }
        },
        "required": [
          "sequence_id",
          "lead_ids"
        ],
        "additionalProperties": false
      },
      "EnrollCommit": {
        "type": "object",
        "properties": {
          "sequence_id": {
            "type": "string",
            "format": "uuid"
          },
          "lead_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Send the preview's eligible_ids."
          },
          "sender_id": {
            "type": "string",
            "format": "uuid"
          },
          "include_replied": {
            "type": "boolean"
          },
          "priority": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "wait_enrichment": {
            "type": "boolean",
            "description": "Hold each lead at the start until its profile is enriched."
          },
          "confirm": {
            "type": "boolean",
            "const": true,
            "description": "Must be true. Without it the call answers E_CONFIRM_REQUIRED."
          }
        },
        "required": [
          "sequence_id",
          "lead_ids",
          "confirm"
        ],
        "additionalProperties": false
      },
      "EnrollPreview": {
        "type": "object",
        "properties": {
          "requested": {
            "type": "integer"
          },
          "eligible": {
            "type": "integer"
          },
          "eligible_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "excluded": {
            "type": "object",
            "description": "reason → {count, sample_ids}. Reasons: not_in_workspace, suppressed:<why>, replied_recently, already_enrolled, no_fresh_sender.",
            "properties": {},
            "additionalProperties": {
              "type": "object",
              "properties": {
                "count": {
                  "type": "integer"
                },
                "sample_ids": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              },
              "additionalProperties": true
            }
          },
          "replied_recently": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "company": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "last_replied_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "channel": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "additionalProperties": true
            }
          },
          "assignment": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sender_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "leads": {
                  "type": "integer"
                }
              },
              "additionalProperties": true
            }
          },
          "assignment_rule": {
            "type": "string"
          },
          "rule_effects": {
            "type": "object",
            "description": "note → count",
            "properties": {},
            "additionalProperties": {
              "type": "integer"
            }
          },
          "projection": {
            "type": "object",
            "properties": {
              "estimated_days": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "bottleneck": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "additionalProperties": true
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "requested",
          "eligible",
          "eligible_ids"
        ],
        "additionalProperties": true
      },
      "EnrollResult": {
        "type": "object",
        "properties": {
          "requested": {
            "type": "integer"
          },
          "enrolled": {
            "type": "integer"
          },
          "skipped_active": {
            "type": "integer"
          },
          "skipped_suppressed": {
            "type": "integer"
          },
          "skipped_other": {
            "type": "integer"
          },
          "skipped_replied": {
            "type": "integer"
          },
          "waiting": {
            "type": "integer",
            "description": "Enrolled but waiting for enrichment."
          }
        },
        "required": [
          "enrolled"
        ],
        "additionalProperties": true
      },
      "SequenceSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "active",
              "paused",
              "archived"
            ]
          },
          "client_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "head_version": {
            "type": "integer"
          },
          "sender_pool": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "assignment": {
            "type": "string"
          },
          "stalled": {
            "type": "boolean"
          },
          "stalled_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "throttled_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "live": {
            "type": "integer",
            "description": "Leads currently in the sequence."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "status"
        ],
        "additionalProperties": true
      },
      "Sequence": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SequenceSummary"
          },
          {
            "type": "object",
            "properties": {
              "graph": {
                "type": "object",
                "description": "Published steps: nodes and edges.",
                "properties": {},
                "additionalProperties": true
              },
              "settings": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              },
              "use_sender_schedule": {
                "type": "boolean"
              },
              "brief": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "has_draft": {
                "type": "boolean"
              },
              "node_stats": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "node_id": {
                      "type": "string"
                    },
                    "variant_id": {
                      "type": "string",
                      "description": "'' when the step has no variants. Sum the rows of a node for its total."
                    }
                  },
                  "additionalProperties": true
                }
              },
              "rules": {
                "type": "array",
                "items": {
                  "type": "object",
                  "description": "Auto-enrol rules.",
                  "properties": {},
                  "additionalProperties": true
                }
              }
            },
            "additionalProperties": true
          }
        ]
      },
      "SequenceReport": {
        "type": "object",
        "properties": {
          "sequence": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "totals": {
            "$ref": "#/components/schemas/Totals"
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": true
            }
          },
          "best_step": {
            "type": [
              "object",
              "null"
            ]
          },
          "worst_step": {
            "type": [
              "object",
              "null"
            ]
          },
          "ab_tests": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": true
            }
          },
          "exits": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "live": {},
          "period": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "required": [
          "totals"
        ],
        "additionalProperties": true
      },
      "WhyNotSending": {
        "type": "object",
        "properties": {
          "target": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "blocked": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "description": "One plain sentence."
          },
          "causes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "blocking": {
                  "type": "boolean"
                },
                "detail": {
                  "type": "string"
                },
                "remedy": {
                  "type": "string"
                },
                "sender": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sender_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "next_capacity": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "additionalProperties": true
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rule": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "blocked",
          "reason"
        ],
        "additionalProperties": true
      },
      "FailedLeads": {
        "type": "object",
        "properties": {
          "summary": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "node_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reason": {
                  "type": "string"
                },
                "error_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "leads": {
                  "type": "integer"
                },
                "recoverable": {
                  "type": "integer"
                },
                "oldest": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                }
              },
              "additionalProperties": true
            }
          },
          "leads": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "enrollment_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "lead_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "lead_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "company": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sender_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "sender_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "node_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "error_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reason": {
                  "type": "string"
                },
                "at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                }
              },
              "additionalProperties": true
            }
          }
        },
        "required": [
          "summary",
          "leads"
        ],
        "additionalProperties": true
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "direction": {
            "type": "string",
            "enum": [
              "in",
              "out"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "intent": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "interested",
              "question",
              "not_now",
              "not_interested",
              "ooo",
              "wrong_person",
              "unclear",
              "unclassified",
              null
            ]
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_first_reply": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "opens": {
            "type": [
              "integer",
              "null"
            ]
          },
          "clicks": {
            "type": [
              "integer",
              "null"
            ]
          },
          "attribution": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "automated",
                  "manual",
                  "inbound"
                ]
              },
              "sequence_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "sequence_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "node_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "step_number": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "step_label": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "node_type": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "variant_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "variant_label": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sender_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sent_by_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "replying_to_message_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            }
          }
        },
        "required": [
          "id",
          "direction"
        ],
        "additionalProperties": true
      },
      "Thread": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "sender_id": {
            "type": "string",
            "format": "uuid"
          },
          "lead_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "provider": {
            "type": "string",
            "description": "LINKEDIN or a mail provider."
          },
          "attendee_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "attendee_public_identifier": {
            "type": [
              "string",
              "null"
            ]
          },
          "attendee_provider_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "attendee_picture_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_message_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_message_preview": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_direction": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "in",
              "out",
              null
            ]
          },
          "unread": {
            "type": "boolean"
          },
          "unread_count": {
            "type": "integer"
          },
          "assigned_to": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "intent": {
            "type": "string",
            "enum": [
              "interested",
              "question",
              "not_now",
              "not_interested",
              "ooo",
              "wrong_person",
              "unclear",
              "unclassified"
            ]
          },
          "archived": {
            "type": "boolean"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "sender_id"
        ],
        "additionalProperties": true
      },
      "ThreadDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Thread"
          },
          {
            "type": "object",
            "properties": {
              "messages": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Message"
                },
                "description": "Oldest first. The newest `limit` messages."
              }
            },
            "required": [
              "messages"
            ],
            "additionalProperties": true
          }
        ]
      },
      "Budget": {
        "type": "object",
        "description": "action type → {cap, used, reserved} for today in the sender's timezone.",
        "properties": {},
        "additionalProperties": {
          "type": "object",
          "properties": {
            "cap": {
              "type": "integer"
            },
            "used": {
              "type": "integer"
            },
            "reserved": {
              "type": "integer"
            }
          },
          "additionalProperties": true
        }
      },
      "SenderSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "ok, credentials, disabled, …"
          },
          "status_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "client_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "health": {
            "type": [
              "integer",
              "null"
            ],
            "description": "0 to 100."
          },
          "warmup_level": {
            "type": "integer"
          },
          "timezone": {
            "type": "string"
          },
          "paused_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "invite_blocked_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "running_dry": {
            "type": "boolean"
          },
          "is_premium": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "today": {
            "$ref": "#/components/schemas/Budget"
          }
        },
        "required": [
          "id",
          "name",
          "status"
        ],
        "additionalProperties": true
      },
      "Sender": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SenderSummary"
          },
          {
            "type": "object",
            "properties": {
              "health_breakdown": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              },
              "schedule": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              },
              "manual_caps": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              },
              "connected_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "capacity": {
                "type": "object",
                "description": "action type → effective daily cap right now.",
                "properties": {},
                "additionalProperties": {
                  "type": "integer"
                }
              }
            },
            "additionalProperties": true
          }
        ]
      },
      "SenderCapacity": {
        "type": "object",
        "properties": {
          "sender_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string"
          },
          "warmup_level": {
            "type": "integer"
          },
          "paused_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "invite_blocked_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "capacity": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "integer"
            }
          },
          "today": {
            "$ref": "#/components/schemas/Budget"
          }
        },
        "required": [
          "sender_id",
          "capacity"
        ],
        "additionalProperties": true
      },
      "SenderHealth": {
        "type": "object",
        "properties": {
          "sender": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "health_breakdown": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "recommendations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "severity": {
                  "type": "string"
                },
                "area": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              },
              "additionalProperties": true
            }
          },
          "warmup": {
            "type": "object",
            "properties": {
              "level": {
                "type": "integer"
              },
              "max_level": {
                "type": "integer"
              },
              "locked_until": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "next_level_on": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "unlocks": {},
              "caps_now": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              },
              "caps_next": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          },
          "last_30_days": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "invites_vs_cap": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": {
                  "type": "string"
                },
                "sent": {
                  "type": "integer"
                },
                "cap": {
                  "type": "integer"
                }
              },
              "additionalProperties": true
            }
          },
          "inmail_guard": {
            "type": "object",
            "properties": {
              "max_today": {
                "type": "integer"
              },
              "rule": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "*",
                "sender.connected",
                "sender.disconnected",
                "sender.reconnected",
                "sender.paused",
                "sender.level_changed",
                "sender.running_dry",
                "lead.created",
                "lead.updated",
                "lead.unsubscribed",
                "invite.sent",
                "invite.accepted",
                "invite.withdrawn",
                "message.sent",
                "message.received",
                "message.classified",
                "email.sent",
                "email.opened",
                "email.clicked",
                "email.bounced",
                "enrollment.started",
                "enrollment.exited",
                "enrollment.completed",
                "enrollment.held",
                "enrollment.resumed",
                "enrollment.recovered",
                "task.created",
                "task.completed",
                "meeting.booked",
                "sequence.activated",
                "sequence.paused",
                "sequence.throttled",
                "sequence.webhook",
                "sequence.stalled",
                "sequence.recovered",
                "sequence.published",
                "workspace.billing_recovered"
              ]
            }
          },
          "active": {
            "type": "boolean"
          },
          "failures": {
            "type": "integer",
            "description": "Consecutive failed deliveries. The webhook is switched off at 50."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "url",
          "events"
        ],
        "additionalProperties": true
      },
      "WebhookCreated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "secret": {
            "type": "string",
            "description": "Shown once. Used to verify x-signature."
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "secret"
        ],
        "additionalProperties": true
      },
      "Delivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "webhook_id": {
            "type": "string",
            "format": "uuid"
          },
          "event": {
            "type": "string"
          },
          "status": {
            "type": [
              "integer",
              "null"
            ],
            "description": "HTTP status your endpoint answered."
          },
          "attempts": {
            "type": "integer"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "replay_of": {
            "type": [
              "integer",
              "null"
            ]
          },
          "payload": {
            "$ref": "#/components/schemas/WebhookPayload"
          }
        },
        "required": [
          "id",
          "event"
        ],
        "additionalProperties": true
      },
      "WebhookPayload": {
        "type": "object",
        "properties": {
          "event": {
            "type": "string"
          },
          "workspace_id": {
            "type": "string",
            "format": "uuid"
          },
          "at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "replayed": {
            "type": "boolean",
            "description": "Only on replays."
          },
          "replay_of": {
            "type": "integer",
            "description": "Only on replays."
          }
        },
        "required": [
          "event",
          "workspace_id",
          "at",
          "data"
        ],
        "additionalProperties": true
      },
      "Me": {
        "type": "object",
        "properties": {
          "key": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": [
                  "manager",
                  "member",
                  "client_viewer"
                ]
              },
              "client_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "description": "Empty means every client the member can see."
              },
              "acts_as_user_id": {
                "type": "string",
                "format": "uuid"
              }
            },
            "additionalProperties": true
          },
          "workspace": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "plan": {
                "type": "string"
              },
              "timezone": {
                "type": "string"
              }
            },
            "additionalProperties": true
          },
          "role": {
            "type": "string",
            "description": "Effective role of this key."
          },
          "clients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                }
              },
              "additionalProperties": true
            }
          },
          "stages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "position": {
                  "type": "integer"
                }
              },
              "additionalProperties": true
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                }
              },
              "additionalProperties": true
            }
          },
          "lists": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "client_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                }
              },
              "additionalProperties": true
            }
          }
        },
        "required": [
          "key",
          "workspace",
          "role"
        ],
        "additionalProperties": true
      }
    }
  }
}
