{
  "openapi": "3.0.3",
  "info": {
    "title": "Verdeshell CRM — Sales API",
    "version": "November 2026",
    "description": "Read and write Sales data in Verdeshell CRM with an organisation API key. Handbook: https://guides.verdeshell.com/crm/developers/"
  },
  "servers": [
    {
      "url": "https://crm.verdeshell.com"
    }
  ],
  "security": [
    {
      "ApiKey": []
    }
  ],
  "tags": [
    {
      "name": "Reference data"
    },
    {
      "name": "Contacts"
    },
    {
      "name": "Accounts"
    },
    {
      "name": "Deals"
    },
    {
      "name": "Line items and notes"
    },
    {
      "name": "Tasks"
    },
    {
      "name": "Activities"
    },
    {
      "name": "Products"
    },
    {
      "name": "Labels and custom fields"
    },
    {
      "name": "Bulk push"
    },
    {
      "name": "CSV import"
    },
    {
      "name": "Configure: Pipelines & stages"
    },
    {
      "name": "Configure: Targets"
    },
    {
      "name": "Configure: Fields, labels & lists"
    },
    {
      "name": "Configure: Lead routing"
    },
    {
      "name": "Configure: Lead scoring"
    },
    {
      "name": "Configure: Sequences"
    },
    {
      "name": "Configure: Stage automations"
    },
    {
      "name": "Configure: Greetings"
    },
    {
      "name": "Configure: Webhook subscriptions"
    }
  ],
  "paths": {
    "/api/v1/core/organization-users/me": {
      "get": {
        "operationId": "me",
        "summary": "Who the key acts as",
        "tags": [
          "Reference data"
        ],
        "description": "Returns the key creator's membership: your organizationId (needed by the pipelines call) and their userId and role. Who: Any member.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Membership retrieved",
                  "data": {
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "userId": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "roleSlug": "owner",
                    "fullName": "Alex Morgan",
                    "status": "active",
                    "moduleSales": true
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/core/organization-users/assignable": {
      "get": {
        "operationId": "assignable",
        "summary": "Team members you can assign",
        "tags": [
          "Reference data"
        ],
        "description": "Active members of your organisation. Use userId wherever a field takes an owner (assignedTo). To own a contact, the person also needs Sales access and can't be a client login. Who: Owner, manager, executive or staff.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Assignable users retrieved",
                  "data": [
                    {
                      "id": "c0ffee00-0000-4000-8000-000000000001",
                      "userId": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                      "firstName": "Alex",
                      "lastName": "Morgan",
                      "fullName": "Alex Morgan",
                      "email": "alex@yourcompany.com"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/core/pipelines": {
      "get": {
        "operationId": "pipelines",
        "summary": "List pipelines",
        "tags": [
          "Reference data"
        ],
        "description": "Your Sales pipelines, in board order. Not paged. Who: Any member.",
        "parameters": [
          {
            "name": "templateSlug",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "sales-crm"
          },
          {
            "name": "organizationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Your organisation id, from who the key acts as. Another id returns 403."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Pipelines retrieved",
                  "data": [
                    {
                      "id": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                      "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                      "templateSlug": "sales-crm",
                      "name": "Default Pipeline",
                      "isDefault": true,
                      "isActive": true,
                      "displayOrder": 0
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_pipelines_create",
        "summary": "Create a pipeline",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Creates a pipeline that already has stages: a copy of your default pipeline's stages (names, colours, order, probability, idle limit, won/lost). If you have no pipeline yet, it gets the starter stages Lead, Qualified, Proposal, Negotiation, Won and Lost. Who: Owner or manager. Only one pipeline is the default at a time. Sending isDefault: true moves the default to the new pipeline. templateSlug isn't checked against a list: send exactly sales-crm, or the pipeline won't appear among your Sales pipelines.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Your organisation id, from who the key acts as. Another id returns 403 “Access denied: you may only access your own organisation's data”."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Pipeline created",
                  "data": {
                    "id": "3f9a7c21-8b4d-4e6f-a1c3-5d7e9f0b2a4c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "templateSlug": "sales-crm",
                    "name": "Partner deals",
                    "description": "Deals that come through resellers",
                    "isDefault": false,
                    "displayOrder": 1,
                    "isActive": true,
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "description": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "templateSlug": {
                    "type": "string",
                    "description": "sales-crm for Sales. Up to 50 characters. Can't be changed later."
                  },
                  "isDefault": {
                    "type": "boolean",
                    "description": "true makes it the default pipeline; the old default stops being one. Your first pipeline is always the default."
                  },
                  "displayOrder": {
                    "type": "integer",
                    "description": "Position among your pipelines (lower comes first). Leave it out and it gets the number of pipelines you already have, so it goes last."
                  }
                },
                "required": [
                  "name",
                  "templateSlug"
                ]
              },
              "example": {
                "name": "Partner deals",
                "description": "Deals that come through resellers",
                "templateSlug": "sales-crm"
              }
            }
          }
        }
      }
    },
    "/api/v1/core/pipeline-stages": {
      "get": {
        "operationId": "stages",
        "summary": "List a pipeline's stages",
        "tags": [
          "Reference data"
        ],
        "description": "Stages in board order. A stage is won when isClosedWon is true, lost when isClosedLost is true, otherwise open. Not paged. Who: Any member. approvalGateEnabled: true means moving a deal into that stage needs someone's approval first — see update a deal.",
        "parameters": [
          {
            "name": "pipelineId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "From the pipelines list."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Pipeline stages retrieved",
                  "data": [
                    {
                      "id": "14d799e7-0000-4b44-9610-dd9206f0028e",
                      "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                      "stageName": "Lead",
                      "displayOrder": 1,
                      "probability": 10,
                      "isClosedWon": false,
                      "isClosedLost": false,
                      "stageColor": "#6366f1",
                      "approvalGateEnabled": false
                    },
                    {
                      "id": "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                      "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                      "stageName": "Qualified",
                      "displayOrder": 2,
                      "probability": 25,
                      "isClosedWon": false,
                      "isClosedLost": false,
                      "stageColor": "#8b5cf6",
                      "approvalGateEnabled": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_stages_create",
        "summary": "Add a stage",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Adds one stage to a pipeline. Who: Owner or manager. Errors (400): “Probability must be between 0 and 100.”, “Idle after must be between 1 and 365 days.”, “Pipeline not found in your organisation.”. A missing required field returns 400 “Validation failed” with the field in data, e.g. {\"stageName\": \"Stage name is required\"}. To put the new stage between others, send its displayOrder and then reorder the pipeline.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Your organisation id. Another id returns 403."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Pipeline stage created",
                  "data": {
                    "id": "7c1e5a9b-3d2f-4a6e-b8c0-9e1f2d3c4b5a",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                    "pipelineKey": "sales-crm_pipeline",
                    "stageName": "Demo booked",
                    "stageColor": "#22aa66",
                    "displayOrder": 3,
                    "probability": 35,
                    "idleAfterDays": 14,
                    "isClosedWon": false,
                    "isClosedLost": false,
                    "templateSlug": "sales-crm",
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pipelineId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The pipeline the stage belongs to — one of your pipelines (400 “Pipeline not found in your organisation.” otherwise). Always send it: a stage without one belongs to no pipeline."
                  },
                  "pipelineKey": {
                    "type": "string",
                    "description": "Up to 100 characters. An internal key; the built-in Sales stages use sales-crm_pipeline."
                  },
                  "stageName": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "stageColor": {
                    "type": "string",
                    "description": "A hex colour such as #22aa66 (up to 7 characters)."
                  },
                  "displayOrder": {
                    "type": "integer",
                    "description": "Position in the pipeline (lower comes first). Other stages are not renumbered."
                  },
                  "probability": {
                    "type": "integer",
                    "description": "0–100. New deals in this stage take it when they don't send their own."
                  },
                  "idleAfterDays": {
                    "type": "integer",
                    "description": "1–365. Days with no activity or edit before a deal here counts as idle. Leave it out for the default (30)."
                  },
                  "isClosedWon": {
                    "type": "boolean",
                    "description": "true for a won stage. Send true or false."
                  },
                  "isClosedLost": {
                    "type": "boolean",
                    "description": "true for a lost stage. Send true or false."
                  },
                  "templateSlug": {
                    "type": "string",
                    "description": "sales-crm. Up to 50 characters."
                  }
                },
                "required": [
                  "pipelineKey",
                  "stageName",
                  "displayOrder",
                  "templateSlug"
                ]
              },
              "example": {
                "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                "pipelineKey": "sales-crm_pipeline",
                "stageName": "Demo booked",
                "stageColor": "#22aa66",
                "displayOrder": 3,
                "probability": 35,
                "idleAfterDays": 14,
                "isClosedWon": false,
                "isClosedLost": false,
                "templateSlug": "sales-crm"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/contact-field-options": {
      "get": {
        "operationId": "field_options",
        "summary": "Lead source and industry lists",
        "tags": [
          "Reference data"
        ],
        "description": "The values your organisation accepts for a contact's leadSource and industry. Send the value. Who: Any member.",
        "parameters": [
          {
            "name": "field",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "lead_source or industry."
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Default false."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Options retrieved",
                  "data": [
                    {
                      "id": "3a2b1c0d-0000-4000-8000-000000000002",
                      "value": "website",
                      "label": "Website",
                      "position": 0,
                      "archived": false,
                      "origin": "default"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_field_options_add",
        "summary": "Add a lead source or industry",
        "tags": [
          "Configure: Fields, labels & lists"
        ],
        "description": "Adds a choice to one of the lists. The server makes its value from the name, and that value is what contacts store. Who: Owner only. The value is the name in lowercase, without accents, with _ between words (“Trade fair” → trade_fair). If that value is taken, _2, _3… is added. A name with no Latin letters or digits gets opt_ plus 10 hex characters. Adding the name of an archived choice (ignoring case) restores that choice instead of making a new one. A name an active choice already has: 400 “\"Trade fair\" is already one of the lead source options.” (or “…industry options.”). Errors: 400 “A name is required.”, “Keep the name to 100 characters.”, “Unknown contact field: {field}”.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Option added",
                  "data": {
                    "id": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
                    "value": "trade_fair",
                    "label": "Trade fair",
                    "position": 11,
                    "archived": false,
                    "origin": "user"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "field": {
                    "type": "string",
                    "description": "lead_source or industry."
                  },
                  "label": {
                    "type": "string",
                    "description": "The name people see. 1–100 characters after trimming spaces."
                  }
                },
                "required": [
                  "field",
                  "label"
                ]
              },
              "example": {
                "field": "lead_source",
                "label": "Trade fair"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/contacts": {
      "get": {
        "operationId": "contacts_list",
        "summary": "List contacts",
        "tags": [
          "Contacts"
        ],
        "description": "Search and filter your contacts. Paged. Who: Any member.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Matches first name, last name, email, company, phone and tags (ignores case and accents)."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "e.g. active."
          },
          {
            "name": "contactType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "e.g. lead."
          },
          {
            "name": "lifecycleStage",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "e.g. mql."
          },
          {
            "name": "leadSource",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "A lead source value."
          },
          {
            "name": "industry",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "An industry value."
          },
          {
            "name": "assignedTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Owner's userId."
          },
          {
            "name": "unassigned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Only contacts with no owner."
          },
          {
            "name": "labelIds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            },
            "description": "Contacts with any of these labels. Repeat the parameter for more than one.",
            "explode": true
          },
          {
            "name": "minScore",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Lead score at least this."
          },
          {
            "name": "maxScore",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Lead score at most this."
          },
          {
            "name": "createdAfter",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "ISO-8601, e.g. 2026-11-01T00:00:00Z."
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "created (default), updated, name, company or score."
          },
          {
            "name": "dir",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "desc (default) or asc."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Page number, starting at 0. Default 0."
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Rows per page, 1–100. Default 20. Larger values are cut to 100."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Contacts retrieved",
                  "data": {
                    "content": [
                      {
                        "id": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                        "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                        "firstName": "Lena",
                        "lastName": "Schmidt",
                        "fullName": "Lena Schmidt",
                        "email": "lena@example.com",
                        "companyName": "Example GmbH",
                        "jobTitle": "Head of Operations",
                        "contactType": "lead",
                        "status": "active",
                        "lifecycleStage": "lead",
                        "leadSource": "website",
                        "country": "DE",
                        "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "accountId": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                        "tags": [
                          "trade-fair"
                        ],
                        "consentMarketing": true,
                        "consentWhatsapp": true,
                        "lawfulBasis": "legitimate_interest",
                        "customFields": {},
                        "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "createdAt": "2026-11-07T23:29:11.057166Z",
                        "updatedAt": "2026-11-07T23:29:11.057166Z",
                        "entityVersion": 0
                      }
                    ],
                    "totalElements": 1,
                    "totalPages": 1,
                    "number": 0,
                    "size": 20,
                    "numberOfElements": 1,
                    "first": true,
                    "last": true,
                    "empty": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "contacts_create",
        "summary": "Create a contact",
        "tags": [
          "Contacts"
        ],
        "description": "Creates one contact. To push many at once with matching, use bulk push instead. Who: Owner, manager or executive. Duplicate check. With checkDuplicates=true a match returns 409 “This looks like an existing contact” and data = {\"duplicates\":[{\"id\",\"name\",\"email\",\"phone\",\"ownerName\",\"reason\"}],\"hidden\":0}. hidden counts matches the key's user can't see. Permissions. Leave consentMarketing and consentWhatsapp out and the contact follows your organisation's setting for new contacts. Send false if this person has said no. Response createdAt can be missing on the create response; read the contact again if you need it.",
        "parameters": [
          {
            "name": "checkDuplicates",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "When true, a contact with the same email, or a phone/mobile whose last 10 digits match, stops the create with 409 (see below). Default false: no check."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Contact created",
                  "data": {
                    "id": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "firstName": "Lena",
                    "lastName": "Schmidt",
                    "fullName": "Lena Schmidt",
                    "email": "lena@example.com",
                    "companyName": "Example GmbH",
                    "jobTitle": "Head of Operations",
                    "contactType": "lead",
                    "status": "active",
                    "lifecycleStage": "lead",
                    "leadSource": "website",
                    "country": "DE",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "accountId": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                    "tags": [
                      "trade-fair"
                    ],
                    "consentMarketing": true,
                    "consentWhatsapp": true,
                    "lawfulBasis": "legitimate_interest",
                    "customFields": {},
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "firstName": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "lastName": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "email": {
                    "type": "string",
                    "description": "A valid email address. Stored without surrounding spaces."
                  },
                  "phone": {
                    "type": "string",
                    "description": "Up to 20 characters."
                  },
                  "mobile": {
                    "type": "string",
                    "description": "Up to 20 characters."
                  },
                  "companyName": {
                    "type": "string",
                    "description": "If it matches exactly one of your accounts by name, the contact is linked to it."
                  },
                  "jobTitle": {
                    "type": "string"
                  },
                  "department": {
                    "type": "string"
                  },
                  "contactType": {
                    "type": "string",
                    "description": "lead, prospect, customer, partner or vendor."
                  },
                  "status": {
                    "type": "string",
                    "description": "active, inactive, unqualified or converted."
                  },
                  "lifecycleStage": {
                    "type": "string",
                    "description": "lead (default), cadence, mql, sql, customer, nurture or not_interested."
                  },
                  "leadSource": {
                    "type": "string",
                    "description": "A value from your lead source list — see IDs and lists."
                  },
                  "industry": {
                    "type": "string",
                    "description": "A value from your industry list."
                  },
                  "leadScore": {
                    "type": "integer",
                    "description": "0–100. If your organisation has lead-scoring rules, the score is recalculated and may replace this value."
                  },
                  "estimatedDealValue": {
                    "type": "number",
                    "description": "0 or more."
                  },
                  "assignedTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owner's userId. The person must have Sales access and not be a client login. Leave it out and your lead-routing rules (if any) choose the owner."
                  },
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The Sales account (company) this person works for."
                  },
                  "website": {
                    "type": "string",
                    "description": "An http(s) link or a bare domain such as example.com."
                  },
                  "linkedinUrl": {
                    "type": "string",
                    "description": "http(s) link."
                  },
                  "personalLinkedin": {
                    "type": "string",
                    "description": "http(s) link."
                  },
                  "companyLinkedin": {
                    "type": "string",
                    "description": "http(s) link."
                  },
                  "twitterHandle": {
                    "type": "string"
                  },
                  "instagram": {
                    "type": "string"
                  },
                  "whatsappNumber": {
                    "type": "string",
                    "description": "Up to 20 characters."
                  },
                  "addressLine1": {
                    "type": "string"
                  },
                  "addressLine2": {
                    "type": "string"
                  },
                  "city": {
                    "type": "string"
                  },
                  "state": {
                    "type": "string"
                  },
                  "postalCode": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string",
                    "description": "A country name, or a 2- or 3-letter ISO code. Always returned as the 2-letter code, e.g. DE."
                  },
                  "taxId": {
                    "type": "string",
                    "description": "Up to 50 characters."
                  },
                  "timezone": {
                    "type": "string",
                    "description": "An IANA zone name such as Europe/Berlin (not a fixed offset)."
                  },
                  "dateOfBirth": {
                    "type": "string",
                    "format": "date",
                    "description": "YYYY-MM-DD, between 1900-01-01 and today."
                  },
                  "workAnniversary": {
                    "type": "string",
                    "format": "date",
                    "description": "YYYY-MM-DD, between 1900-01-01 and one year from today."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Free-text tags."
                  },
                  "notes": {
                    "type": "string"
                  },
                  "consentMarketing": {
                    "type": "boolean",
                    "description": "Leave it out to use your organisation's setting for new contacts."
                  },
                  "consentWhatsapp": {
                    "type": "boolean",
                    "description": "Leave it out to use your organisation's setting for new contacts."
                  },
                  "lawfulBasis": {
                    "type": "string",
                    "description": "Up to 50 characters."
                  },
                  "externalId": {
                    "type": "string",
                    "description": "Your system's id for this person."
                  },
                  "externalSource": {
                    "type": "string",
                    "description": "Your system's name, e.g. billing-app."
                  },
                  "customFields": {
                    "type": "object",
                    "description": "Your custom fields, keyed by fieldKey — see custom fields."
                  }
                },
                "required": [
                  "firstName",
                  "contactType",
                  "status"
                ]
              },
              "example": {
                "firstName": "Lena",
                "lastName": "Schmidt",
                "email": "lena@example.com",
                "companyName": "Example GmbH",
                "jobTitle": "Head of Operations",
                "contactType": "lead",
                "status": "active",
                "leadSource": "website",
                "country": "Germany",
                "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                "tags": [
                  "trade-fair"
                ]
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/contacts/{id}": {
      "get": {
        "operationId": "contacts_get",
        "summary": "Get a contact",
        "tags": [
          "Contacts"
        ],
        "description": "One contact by id. A deleted contact returns 404. Who: Any member.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Contact retrieved",
                  "data": {
                    "id": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "firstName": "Lena",
                    "lastName": "Schmidt",
                    "fullName": "Lena Schmidt",
                    "email": "lena@example.com",
                    "companyName": "Example GmbH",
                    "jobTitle": "Head of Operations",
                    "contactType": "lead",
                    "status": "active",
                    "lifecycleStage": "lead",
                    "leadSource": "website",
                    "country": "DE",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "accountId": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                    "tags": [
                      "trade-fair"
                    ],
                    "consentMarketing": true,
                    "consentWhatsapp": true,
                    "lawfulBasis": "legitimate_interest",
                    "customFields": {},
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "contacts_update",
        "summary": "Update a contact",
        "tags": [
          "Contacts"
        ],
        "description": "Send only the fields you want to change. Who: Owner, manager or executive. A field you leave out (or send as null) keeps its value. Send \"\" to clear an optional text field. contactType, status and lifecycleStage can be changed but not cleared. \"assignedTo\": \"\" removes the owner; \"accountId\": \"\" unlinks the account. dateOfBirth, workAnniversary and timezone: send null to clear. customFields replaces the whole set: include every custom field you want to keep. A new owner needs Sales access and can't be a client login.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Contact updated",
                  "data": {
                    "id": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "firstName": "Lena",
                    "lastName": "Schmidt",
                    "fullName": "Lena Schmidt",
                    "email": "lena@example.com",
                    "companyName": "Example GmbH",
                    "jobTitle": "COO",
                    "contactType": "lead",
                    "status": "active",
                    "lifecycleStage": "lead",
                    "leadSource": "website",
                    "country": "DE",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "accountId": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                    "tags": [
                      "trade-fair"
                    ],
                    "consentMarketing": true,
                    "consentWhatsapp": true,
                    "lawfulBasis": "legitimate_interest",
                    "customFields": {},
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 1
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedVersion": {
                    "type": "integer",
                    "description": "The entityVersion you last read. If someone saved since, you get 409 with the current record in data. Leave it out for last-write-wins."
                  },
                  "firstName": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "lastName": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "email": {
                    "type": "string",
                    "description": "A valid email address. Stored without surrounding spaces."
                  },
                  "phone": {
                    "type": "string",
                    "description": "Up to 20 characters."
                  },
                  "mobile": {
                    "type": "string",
                    "description": "Up to 20 characters."
                  },
                  "companyName": {
                    "type": "string",
                    "description": "If it matches exactly one of your accounts by name, the contact is linked to it."
                  },
                  "jobTitle": {
                    "type": "string"
                  },
                  "department": {
                    "type": "string"
                  },
                  "contactType": {
                    "type": "string",
                    "description": "lead, prospect, customer, partner or vendor."
                  },
                  "status": {
                    "type": "string",
                    "description": "active, inactive, unqualified or converted."
                  },
                  "lifecycleStage": {
                    "type": "string",
                    "description": "lead, cadence, mql, sql, customer, nurture or not_interested."
                  },
                  "leadSource": {
                    "type": "string",
                    "description": "A value from your lead source list — see IDs and lists."
                  },
                  "industry": {
                    "type": "string",
                    "description": "A value from your industry list."
                  },
                  "leadScore": {
                    "type": "integer",
                    "description": "0–100. If your organisation has lead-scoring rules, the score is recalculated and may replace this value."
                  },
                  "estimatedDealValue": {
                    "type": "number",
                    "description": "0 or more."
                  },
                  "assignedTo": {
                    "type": "string",
                    "description": "Owner's userId. \"\" removes the owner."
                  },
                  "accountId": {
                    "type": "string",
                    "description": "The Sales account. \"\" unlinks it."
                  },
                  "website": {
                    "type": "string",
                    "description": "An http(s) link or a bare domain such as example.com."
                  },
                  "linkedinUrl": {
                    "type": "string",
                    "description": "http(s) link."
                  },
                  "personalLinkedin": {
                    "type": "string",
                    "description": "http(s) link."
                  },
                  "companyLinkedin": {
                    "type": "string",
                    "description": "http(s) link."
                  },
                  "twitterHandle": {
                    "type": "string"
                  },
                  "instagram": {
                    "type": "string"
                  },
                  "whatsappNumber": {
                    "type": "string",
                    "description": "Up to 20 characters."
                  },
                  "addressLine1": {
                    "type": "string"
                  },
                  "addressLine2": {
                    "type": "string"
                  },
                  "city": {
                    "type": "string"
                  },
                  "state": {
                    "type": "string"
                  },
                  "postalCode": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string",
                    "description": "A country name, or a 2- or 3-letter ISO code. Always returned as the 2-letter code, e.g. DE."
                  },
                  "taxId": {
                    "type": "string",
                    "description": "Up to 50 characters."
                  },
                  "timezone": {
                    "type": "string",
                    "description": "An IANA zone name such as Europe/Berlin (not a fixed offset)."
                  },
                  "dateOfBirth": {
                    "type": "string",
                    "format": "date",
                    "description": "YYYY-MM-DD, between 1900-01-01 and today."
                  },
                  "workAnniversary": {
                    "type": "string",
                    "format": "date",
                    "description": "YYYY-MM-DD, between 1900-01-01 and one year from today."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Free-text tags."
                  },
                  "notes": {
                    "type": "string"
                  },
                  "consentMarketing": {
                    "type": "boolean",
                    "description": "false also stops email to this address everywhere in the CRM."
                  },
                  "consentWhatsapp": {
                    "type": "boolean"
                  },
                  "lawfulBasis": {
                    "type": "string",
                    "description": "Up to 50 characters."
                  },
                  "externalId": {
                    "type": "string",
                    "description": "Your system's id for this person."
                  },
                  "externalSource": {
                    "type": "string",
                    "description": "Your system's name, e.g. billing-app."
                  },
                  "customFields": {
                    "type": "object",
                    "description": "Your custom fields, keyed by fieldKey — see custom fields."
                  }
                }
              },
              "example": {
                "jobTitle": "COO",
                "expectedVersion": 0
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "contacts_delete",
        "summary": "Delete a contact",
        "tags": [
          "Contacts"
        ],
        "description": "Removes the contact. It no longer appears in lists and returns 404. Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Contact deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/contacts/lifecycle-stage": {
      "post": {
        "operationId": "contacts_stage",
        "summary": "Set the lifecycle stage of many contacts",
        "tags": [
          "Contacts"
        ],
        "description": "Moves up to 1,000 contacts to one lifecycle stage. Who: Owner, manager or executive.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Lifecycle stage set",
                  "data": {
                    "changed": 1,
                    "already_in_stage": 0,
                    "not_allowed": 0,
                    "unavailable": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contactIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "1–1,000 contact ids."
                  },
                  "stage": {
                    "type": "string",
                    "description": "lead, cadence, mql, sql, customer, nurture or not_interested."
                  }
                },
                "required": [
                  "contactIds",
                  "stage"
                ]
              },
              "example": {
                "contactIds": [
                  "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c"
                ],
                "stage": "mql"
              }
            }
          }
        }
      }
    },
    "/api/v1/core/accounts": {
      "get": {
        "operationId": "accounts_list",
        "summary": "List accounts",
        "tags": [
          "Accounts"
        ],
        "description": "Companies your contacts belong to. Newest first. Paged. Who: Any member.",
        "parameters": [
          {
            "name": "templateSlug",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Send sales-crm to get Sales accounts only."
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Matches name, domain or email."
          },
          {
            "name": "accountType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "labelIds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            },
            "explode": true
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Page number, starting at 0. Default 0."
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Rows per page, 1–100. Default 20. Larger values are cut to 100."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Accounts retrieved",
                  "data": {
                    "content": [
                      {
                        "id": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                        "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                        "templateSlug": "sales-crm",
                        "name": "Example GmbH",
                        "domain": "example.com",
                        "accountType": "prospect",
                        "status": "active",
                        "country": "DE",
                        "employeeCount": 40,
                        "customFields": {},
                        "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "createdAt": "2026-11-07T23:29:11.057166Z",
                        "updatedAt": "2026-11-07T23:29:11.057166Z",
                        "entityVersion": 0
                      }
                    ],
                    "totalElements": 1,
                    "totalPages": 1,
                    "number": 0,
                    "size": 20,
                    "numberOfElements": 1,
                    "first": true,
                    "last": true,
                    "empty": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "accounts_create",
        "summary": "Create an account",
        "tags": [
          "Accounts"
        ],
        "description": "Who: Owner, manager or executive.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Account created",
                  "data": {
                    "id": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "templateSlug": "sales-crm",
                    "name": "Example GmbH",
                    "domain": "example.com",
                    "accountType": "prospect",
                    "status": "active",
                    "country": "DE",
                    "employeeCount": 40,
                    "customFields": {},
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "templateSlug": {
                    "type": "string",
                    "description": "Always sales-crm for Sales. Can't be changed later."
                  },
                  "name": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "legalName": {
                    "type": "string"
                  },
                  "domain": {
                    "type": "string",
                    "description": "e.g. example.com."
                  },
                  "website": {
                    "type": "string"
                  },
                  "industry": {
                    "type": "string",
                    "description": "Free text."
                  },
                  "employeeCount": {
                    "type": "integer",
                    "description": "0 or more."
                  },
                  "annualRevenue": {
                    "type": "number",
                    "description": "0 or more."
                  },
                  "phone": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "description": "A valid email address."
                  },
                  "addressLine1": {
                    "type": "string"
                  },
                  "addressLine2": {
                    "type": "string"
                  },
                  "city": {
                    "type": "string"
                  },
                  "state": {
                    "type": "string"
                  },
                  "postalCode": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string",
                    "description": "Country name or ISO code; returned as the 2-letter code."
                  },
                  "linkedinUrl": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "accountType": {
                    "type": "string",
                    "description": "prospect (default), customer, partner or vendor."
                  },
                  "status": {
                    "type": "string",
                    "description": "active (default) or inactive."
                  },
                  "assignedTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owner's userId."
                  },
                  "parentAccountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Parent account, for groups of companies."
                  },
                  "source": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "externalId": {
                    "type": "string"
                  },
                  "externalSource": {
                    "type": "string"
                  },
                  "customFields": {
                    "type": "object",
                    "description": "Keyed by fieldKey."
                  }
                },
                "required": [
                  "templateSlug",
                  "name"
                ]
              },
              "example": {
                "templateSlug": "sales-crm",
                "name": "Example GmbH",
                "domain": "example.com",
                "country": "DE",
                "employeeCount": 40
              }
            }
          }
        }
      }
    },
    "/api/v1/core/accounts/{id}": {
      "get": {
        "operationId": "accounts_get",
        "summary": "Get an account",
        "tags": [
          "Accounts"
        ],
        "description": "Who: Any member.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Account retrieved",
                  "data": {
                    "id": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "templateSlug": "sales-crm",
                    "name": "Example GmbH",
                    "domain": "example.com",
                    "accountType": "prospect",
                    "status": "active",
                    "country": "DE",
                    "employeeCount": 40,
                    "customFields": {},
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "accounts_update",
        "summary": "Update an account",
        "tags": [
          "Accounts"
        ],
        "description": "Send only the fields you want to change. Left-out fields keep their value. Who: Owner, manager or executive. \"\" is saved as an empty value (and clears country). accountType and status can be changed but not cleared. The owner can be changed but not removed through this call.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Account updated",
                  "data": {
                    "id": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "templateSlug": "sales-crm",
                    "name": "Example GmbH",
                    "domain": "example.com",
                    "accountType": "prospect",
                    "status": "active",
                    "country": "DE",
                    "employeeCount": 40,
                    "customFields": {},
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 1,
                    "industry": "Manufacturing"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "legalName": {
                    "type": "string"
                  },
                  "domain": {
                    "type": "string",
                    "description": "e.g. example.com."
                  },
                  "website": {
                    "type": "string"
                  },
                  "industry": {
                    "type": "string",
                    "description": "Free text."
                  },
                  "employeeCount": {
                    "type": "integer",
                    "description": "0 or more."
                  },
                  "annualRevenue": {
                    "type": "number",
                    "description": "0 or more."
                  },
                  "phone": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "description": "A valid email address."
                  },
                  "addressLine1": {
                    "type": "string"
                  },
                  "addressLine2": {
                    "type": "string"
                  },
                  "city": {
                    "type": "string"
                  },
                  "state": {
                    "type": "string"
                  },
                  "postalCode": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string",
                    "description": "Country name or ISO code; returned as the 2-letter code."
                  },
                  "linkedinUrl": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "accountType": {
                    "type": "string",
                    "description": "prospect, customer, partner or vendor."
                  },
                  "status": {
                    "type": "string",
                    "description": "active or inactive."
                  },
                  "assignedTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owner's userId. Can be changed but not removed (\"\" is ignored)."
                  },
                  "parentAccountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Parent account, for groups of companies."
                  },
                  "source": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "externalId": {
                    "type": "string"
                  },
                  "externalSource": {
                    "type": "string"
                  },
                  "customFields": {
                    "type": "object",
                    "description": "Keyed by fieldKey."
                  }
                }
              },
              "example": {
                "industry": "Manufacturing"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "accounts_delete",
        "summary": "Delete an account",
        "tags": [
          "Accounts"
        ],
        "description": "Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Account deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/deals": {
      "get": {
        "operationId": "deals_list",
        "summary": "List deals",
        "tags": [
          "Deals"
        ],
        "description": "Filter, sort and page through deals. Who: Any member. List rows also carry contactName, contactCompany, contactEmail, labels, lastActivityAt, nextTaskTitle, nextTaskDueDate and stageEnteredAt.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Matches the deal title and the contact's name or company."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "open, won, lost or abandoned."
          },
          {
            "name": "tab",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "A ready-made view: open, mine, closingThisMonth, pastClose, idle, noCloseDate, won, lost, all or changed."
          },
          {
            "name": "pipelineId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "stageId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "A stage id, or none for deals without a stage."
          },
          {
            "name": "assignedTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "unassigned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "contactId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "labelIds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            },
            "explode": true
          },
          {
            "name": "ids",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            },
            "description": "Only these deals.",
            "explode": true
          },
          {
            "name": "close",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "thisMonth, next30, past or none (expected close date)."
          },
          {
            "name": "attention",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "overdue, idle or noCloseDate (open deals only)."
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "created (default), title, contact, stage, value, weighted, probability, close_date, days_in_stage, last_update, next_step, assigned_to, source or board."
          },
          {
            "name": "dir",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "desc (default) or asc."
          },
          {
            "name": "then",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Second sort key (same values as sort)."
          },
          {
            "name": "thenDir",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "desc (default) or asc."
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "IANA zone that defines “today” for close-date and overdue filters. Default UTC."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Page number, starting at 0. Default 0."
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Rows per page, 1–100. Default 20. Larger values are cut to 100."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Deals retrieved",
                  "data": {
                    "content": [
                      {
                        "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                        "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                        "dealTitle": "Example GmbH — 40 licences",
                        "dealValue": 5500,
                        "currency": "EUR",
                        "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                        "stageId": "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                        "probability": 40,
                        "status": "open",
                        "expectedCloseDate": "2026-12-08",
                        "contactId": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                        "accountId": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                        "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "customFields": {},
                        "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "createdAt": "2026-11-07T23:29:11.057166Z",
                        "updatedAt": "2026-11-07T23:29:11.057166Z",
                        "entityVersion": 2,
                        "contactName": "Lena Schmidt",
                        "contactCompany": "Example GmbH"
                      }
                    ],
                    "totalElements": 1,
                    "totalPages": 1,
                    "number": 0,
                    "size": 20,
                    "numberOfElements": 1,
                    "first": true,
                    "last": true,
                    "empty": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "deals_create",
        "summary": "Create a deal",
        "tags": [
          "Deals"
        ],
        "description": "Who: Owner, manager or executive. No stageId? An open deal starts in the first open stage of pipelineId, or of your default pipeline. If the starting stage has an approval gate, the deal is saved without a stage and pendingApprovalRequestId is set until someone approves. A won/lost status sent with it is saved as open until then. A deal created won or lost gets its wonAt / lostAt at once (its expected close date when that is in the past); created won also sends the deal.won webhook — unless its stage needs approval, when it is saved open and wins on approval.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Deal created",
                  "data": {
                    "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "dealTitle": "Example GmbH — 40 licences",
                    "dealValue": 5000,
                    "currency": "EUR",
                    "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                    "stageId": "14d799e7-0000-4b44-9610-dd9206f0028e",
                    "status": "open",
                    "expectedCloseDate": "2026-12-08",
                    "contactId": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                    "accountId": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "customFields": {},
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dealTitle": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "status": {
                    "type": "string",
                    "description": "open, won, lost or abandoned. Fits the stage: a won stage holds won, a lost stage lost/abandoned, an open stage open/abandoned. Sent with a stageId that contradicts it: 400."
                  },
                  "dealValue": {
                    "type": "number",
                    "description": "0 or more. Stored with 2 decimals (extra decimals are rounded)."
                  },
                  "currency": {
                    "type": "string",
                    "description": "A currency code such as EUR (stored in capitals; a code that isn't a real currency is refused). Leave it out and the deal takes your organisation's currency — its billing currency, else its country's; an organisation with neither gets 400 “Choose a currency for this deal.”"
                  },
                  "pipelineId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Only used to pick the starting stage when you don't send stageId."
                  },
                  "stageId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A stage of one of your Sales pipelines. The deal's pipeline always follows its stage."
                  },
                  "probability": {
                    "type": "integer",
                    "description": "0–100. Leave it out to use the stage's probability."
                  },
                  "expectedCloseDate": {
                    "type": "string",
                    "format": "date",
                    "description": "YYYY-MM-DD."
                  },
                  "contactId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Main contact."
                  },
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Account (company)."
                  },
                  "assignedTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owner's userId; must be a member of your organisation."
                  },
                  "description": {
                    "type": "string"
                  },
                  "leadSource": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "customFields": {
                    "type": "object",
                    "description": "Keyed by fieldKey."
                  }
                },
                "required": [
                  "dealTitle",
                  "status"
                ]
              },
              "example": {
                "dealTitle": "Example GmbH — 40 licences",
                "status": "open",
                "dealValue": 5000,
                "currency": "EUR",
                "contactId": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                "accountId": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                "expectedCloseDate": "2026-12-08"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/deals/{id}": {
      "get": {
        "operationId": "deals_get",
        "summary": "Get a deal",
        "tags": [
          "Deals"
        ],
        "description": "Who: Any member.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Deal retrieved",
                  "data": {
                    "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "dealTitle": "Example GmbH — 40 licences",
                    "dealValue": 5500,
                    "currency": "EUR",
                    "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                    "stageId": "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                    "probability": 40,
                    "status": "open",
                    "expectedCloseDate": "2026-12-08",
                    "contactId": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                    "accountId": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "customFields": {},
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 2
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "deals_update",
        "summary": "Update a deal",
        "tags": [
          "Deals"
        ],
        "description": "Send only the fields you want to change: move stage, change value, win or lose. Who: Owner, manager or executive. Left-out or null fields keep their value. \"assignedTo\": \"\" removes the owner. Win, lose or reopen: move the deal to a won, lost or open stage — send just stageId and the status follows (a won stage makes it won, an open stage reopens a won or lost deal). Send just status and the deal moves to its pipeline's matching stage (won → the Won stage, through its approval if it has one; 400 if the pipeline has no such stage). A stageId sent with a status that contradicts it is refused (400). Sending the deal's current status back unchanged moves nothing. A deal with no stage takes any status. won sets wonAt; lost/abandoned set lostAt; reopening clears both. Approval gates: moving into a gated stage doesn't move the deal yet. It sets pendingApprovalRequestId, and while that's pending, status changes are not applied. While a request is pending, a move into another gated stage returns 400 “An approval is already pending for this item”; a move into an ungated stage still happens, and status changes stay blocked until the request is decided.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Deal updated",
                  "data": {
                    "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "dealTitle": "Example GmbH — 40 licences",
                    "dealValue": 5500,
                    "currency": "EUR",
                    "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                    "stageId": "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                    "probability": 40,
                    "status": "open",
                    "expectedCloseDate": "2026-12-08",
                    "contactId": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                    "accountId": "2c4e6a8b-0d1f-4e3a-9b5c-7d9e1f3a5b7c",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "customFields": {},
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 2
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dealTitle": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "status": {
                    "type": "string",
                    "description": "open, won, lost or abandoned. Fits the stage: a won stage holds won, a lost stage lost/abandoned, an open stage open/abandoned. Sent with a stageId that contradicts it: 400."
                  },
                  "dealValue": {
                    "type": "number",
                    "description": "0 or more. Stored with 2 decimals (extra decimals are rounded)."
                  },
                  "currency": {
                    "type": "string",
                    "description": "A currency code such as EUR; it can't be emptied (400). For a deal, its line items follow."
                  },
                  "stageId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A stage of one of your Sales pipelines. The deal's pipeline always follows its stage."
                  },
                  "probability": {
                    "type": "integer",
                    "description": "0–100."
                  },
                  "expectedCloseDate": {
                    "type": "string",
                    "format": "date",
                    "description": "YYYY-MM-DD."
                  },
                  "contactId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Main contact."
                  },
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The Sales account. \"\" unlinks it."
                  },
                  "assignedTo": {
                    "type": "string",
                    "description": "Owner's userId. \"\" removes the owner."
                  },
                  "description": {
                    "type": "string"
                  },
                  "leadSource": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "customFields": {
                    "type": "object",
                    "description": "Keyed by fieldKey."
                  },
                  "lostReason": {
                    "type": "string",
                    "description": "Why it was lost."
                  },
                  "lostReasonDetails": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "stageId": "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                "probability": 40,
                "dealValue": 5500
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deals_delete",
        "summary": "Delete a deal",
        "tags": [
          "Deals"
        ],
        "description": "Removes the deal and cancels any approval waiting on it. Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Deal deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/deals/{id}/history": {
      "get": {
        "operationId": "deals_history",
        "summary": "A deal's history",
        "tags": [
          "Deals"
        ],
        "description": "Stage moves, value changes and close-date changes, newest first. Not paged. Who: Any member except client logins. eventType: created, stage, value or close_date. source: user, approval or system.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Deal history retrieved",
                  "data": [
                    {
                      "id": "7e6d5c4b-0000-4a3a-8b2b-1c0d9e8f7a6b",
                      "dealId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                      "eventType": "value",
                      "fromValue": 5000,
                      "toValue": 5500,
                      "fromCurrency": "EUR",
                      "toCurrency": "EUR",
                      "source": "user",
                      "changedBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                      "changedByName": "Alex Morgan",
                      "changedAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/deals/changes": {
      "get": {
        "operationId": "deals_changes",
        "summary": "Deals that changed recently",
        "tags": [
          "Deals"
        ],
        "description": "One row per deal whose value or close date changed, or which moved back to an earlier stage, in the last N days. Who: Any member except client logins. This is a summary for people, not a full change feed. To sync every change, see keeping in sync.",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Default 7. Values outside 1–90 are brought into that range."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Deal changes retrieved",
                  "data": [
                    {
                      "dealId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                      "valueFrom": 5000,
                      "valueTo": 5500,
                      "currencyFrom": "EUR",
                      "currencyTo": "EUR",
                      "valueDirection": "up",
                      "movedBack": false,
                      "lastChangedAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/deal-line-items": {
      "get": {
        "operationId": "lines_list",
        "summary": "List a deal's line items",
        "tags": [
          "Line items and notes"
        ],
        "description": "Not paged. Who: Any member.",
        "parameters": [
          {
            "name": "dealId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Line items retrieved",
                  "data": [
                    {
                      "id": "1f2e3d4c-5b6a-4978-8c9d-0e1f2a3b4c5e",
                      "dealId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                      "productId": "e7f8a9b0-c1d2-4e3f-a4b5-c6d7e8f9a0b1",
                      "name": "Annual licence",
                      "quantity": 4,
                      "unitPrice": 275.5,
                      "discountPercent": 10,
                      "lineTotal": 991.8,
                      "currency": "EUR",
                      "displayOrder": 0
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "lines_create",
        "summary": "Add a line item",
        "tags": [
          "Line items and notes"
        ],
        "description": "Who: Owner, manager or executive. lineTotal = quantity × unitPrice × (1 − discount/100), rounded to 2 decimals, worked out by the server. Line items don't change the deal's dealValue. Update the deal if you want them to match.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Line item added",
                  "data": {
                    "id": "1f2e3d4c-5b6a-4978-8c9d-0e1f2a3b4c5e",
                    "dealId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                    "productId": "e7f8a9b0-c1d2-4e3f-a4b5-c6d7e8f9a0b1",
                    "name": "Annual licence",
                    "quantity": 4,
                    "unitPrice": 275.5,
                    "discountPercent": 10,
                    "lineTotal": 991.8,
                    "currency": "EUR",
                    "displayOrder": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dealId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "name": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "productId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A product from your catalogue. Fills in unitPrice when you leave it out — only if the product is priced in the deal's currency; otherwise send the price (400 “This product is priced in USD and the deal is in EUR …”)."
                  },
                  "quantity": {
                    "type": "number",
                    "description": "More than 0. Default 1."
                  },
                  "unitPrice": {
                    "type": "number",
                    "description": "0 or more. Default: the product's price (same currency only), else 0."
                  },
                  "discountPercent": {
                    "type": "number",
                    "description": "0–100. Default 0."
                  },
                  "currency": {
                    "type": "string",
                    "description": "Always the deal's currency — leave it out, or send the deal's (400 “A line item uses its deal's currency (EUR).” otherwise). Changing the deal's currency relabels its lines; amounts aren't converted."
                  },
                  "displayOrder": {
                    "type": "integer",
                    "description": "Default 0."
                  }
                },
                "required": [
                  "dealId",
                  "name"
                ]
              },
              "example": {
                "dealId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                "productId": "e7f8a9b0-c1d2-4e3f-a4b5-c6d7e8f9a0b1",
                "name": "Annual licence",
                "quantity": 4,
                "discountPercent": 10
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/deal-line-items/{id}": {
      "put": {
        "operationId": "lines_update",
        "summary": "Update a line item",
        "tags": [
          "Line items and notes"
        ],
        "description": "Send only what changes. The deal and product can't be changed. Who: Owner, manager or executive.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "quantity": {
                    "type": "number"
                  },
                  "unitPrice": {
                    "type": "number"
                  },
                  "discountPercent": {
                    "type": "number"
                  },
                  "currency": {
                    "type": "string",
                    "description": "Only the deal's currency is accepted (a line can't change currency on its own)."
                  },
                  "displayOrder": {
                    "type": "integer"
                  }
                }
              },
              "example": {
                "quantity": 5
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "lines_delete",
        "summary": "Remove a line item",
        "tags": [
          "Line items and notes"
        ],
        "description": "Deletes it permanently. Who: Owner, manager or executive.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Line item removed"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/deal-notes": {
      "get": {
        "operationId": "notes_list",
        "summary": "List a deal's notes",
        "tags": [
          "Line items and notes"
        ],
        "description": "Newest first. Paged. Who: Any member except client logins. Private notes are only visible to their author and to owners and managers.",
        "parameters": [
          {
            "name": "dealId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Page number, starting at 0. Default 0."
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Rows per page, 1–100. Default 20. Larger values are cut to 100."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Deal notes retrieved",
                  "data": {
                    "content": [
                      {
                        "id": "2a3b4c5d-6e7f-4a8b-9c0d-1e2f3a4b5c6d",
                        "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                        "dealId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                        "content": "Asked for a 3-year price.",
                        "isPrivate": false,
                        "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "createdAt": "2026-11-07T23:29:11.057166Z",
                        "updatedAt": "2026-11-07T23:29:11.057166Z"
                      }
                    ],
                    "totalElements": 1,
                    "totalPages": 1,
                    "number": 0,
                    "size": 20,
                    "numberOfElements": 1,
                    "first": true,
                    "last": true,
                    "empty": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "notes_create",
        "summary": "Add a note to a deal",
        "tags": [
          "Line items and notes"
        ],
        "description": "Who: Owner, manager or executive.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dealId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "content": {
                    "type": "string"
                  },
                  "isPrivate": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "dealId",
                  "content",
                  "isPrivate"
                ]
              },
              "example": {
                "dealId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                "content": "Asked for a 3-year price.",
                "isPrivate": false
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/deal-notes/{id}": {
      "put": {
        "operationId": "notes_update",
        "summary": "Edit a note",
        "tags": [
          "Line items and notes"
        ],
        "description": "Only the note's author, or an owner or manager, can edit it (403 “Only the person who wrote this note, or a manager, can change it.” otherwise). Someone else's private note answers 404. Who: Its author (owner, manager or executive), or any owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string"
                  },
                  "isPrivate": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "content": "Asked for a 3-year price (sent)."
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "notes_delete",
        "summary": "Delete a note",
        "tags": [
          "Line items and notes"
        ],
        "description": "An owner or manager, or the note's author if they hold one of those roles. Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Deal note deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/tasks": {
      "get": {
        "operationId": "tasks_list",
        "summary": "List tasks",
        "tags": [
          "Tasks"
        ],
        "description": "Paged. Who: Any member. List rows also carry relatedName: the deal title or contact name.",
        "parameters": [
          {
            "name": "entityType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "deal or contact."
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "A status, or open for anything not completed or cancelled."
          },
          {
            "name": "assignedTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dueBefore",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Due on or before (YYYY-MM-DD)."
          },
          {
            "name": "dueAfter",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Due on or after."
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "createdAt (default, newest first) or dueDate (soonest first, undated last)."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Page number, starting at 0. Default 0."
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Rows per page, 1–100. Default 20. Larger values are cut to 100."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Tasks retrieved",
                  "data": {
                    "content": [
                      {
                        "id": "6b7c8d9e-0f1a-4b2c-8d3e-4f5a6b7c8d9e",
                        "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                        "entityType": "deal",
                        "entityId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                        "title": "Send the proposal",
                        "priority": "medium",
                        "status": "pending",
                        "dueDate": "2026-11-11",
                        "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "isEscalated": false,
                        "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "createdAt": "2026-11-07T23:29:11.057166Z",
                        "updatedAt": "2026-11-07T23:29:11.057166Z",
                        "relatedName": "Example GmbH — 40 licences"
                      }
                    ],
                    "totalElements": 1,
                    "totalPages": 1,
                    "number": 0,
                    "size": 20,
                    "numberOfElements": 1,
                    "first": true,
                    "last": true,
                    "empty": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "tasks_create",
        "summary": "Create a task",
        "tags": [
          "Tasks"
        ],
        "description": "Who: Owner, manager or executive.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Task created",
                  "data": {
                    "id": "6b7c8d9e-0f1a-4b2c-8d3e-4f5a6b7c8d9e",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "entityType": "deal",
                    "entityId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                    "title": "Send the proposal",
                    "priority": "medium",
                    "status": "pending",
                    "dueDate": "2026-11-11",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "isEscalated": false,
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "priority": {
                    "type": "string",
                    "description": "low, medium, high or urgent."
                  },
                  "status": {
                    "type": "string",
                    "description": "pending, in_progress, completed or cancelled."
                  },
                  "isEscalated": {
                    "type": "boolean",
                    "description": "Send false for a normal task."
                  },
                  "entityType": {
                    "type": "string",
                    "description": "deal or contact. Leave both entityType and entityId out for a standalone task."
                  },
                  "entityId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The deal or contact id. It must exist in your organisation."
                  },
                  "description": {
                    "type": "string"
                  },
                  "taskType": {
                    "type": "string",
                    "description": "Free text up to 50 characters, e.g. call."
                  },
                  "dueDate": {
                    "type": "string",
                    "format": "date",
                    "description": "YYYY-MM-DD (a date, no time)."
                  },
                  "recurrence": {
                    "type": "string",
                    "description": "daily, weekly or monthly. Completing the task creates the next one."
                  },
                  "reminderDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When to remind the owner in the app."
                  },
                  "assignedTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owner's userId."
                  },
                  "escalatedTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Who to escalate to, when isEscalated is true."
                  }
                },
                "required": [
                  "title",
                  "priority",
                  "status",
                  "isEscalated"
                ]
              },
              "example": {
                "entityType": "deal",
                "entityId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                "title": "Send the proposal",
                "priority": "medium",
                "status": "pending",
                "isEscalated": false,
                "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                "dueDate": "2026-11-11"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/tasks/{id}": {
      "get": {
        "operationId": "tasks_get",
        "summary": "Get a task",
        "tags": [
          "Tasks"
        ],
        "description": "Who: Any member.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Task retrieved",
                  "data": {
                    "id": "6b7c8d9e-0f1a-4b2c-8d3e-4f5a6b7c8d9e",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "entityType": "deal",
                    "entityId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                    "title": "Send the proposal",
                    "priority": "medium",
                    "status": "pending",
                    "dueDate": "2026-11-11",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "isEscalated": false,
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "tasks_update",
        "summary": "Update or complete a task",
        "tags": [
          "Tasks"
        ],
        "description": "Send only what changes. Who: Owner, manager or executive. \"status\": \"completed\" sets completedAt and completedBy, and for a repeating task creates the next one. \"assignedTo\": \"\" removes the owner; \"entityType\": \"\" detaches the task; \"recurrence\": \"\" stops it repeating. \"isEscalated\": false clears the escalation.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Task updated",
                  "data": {
                    "id": "6b7c8d9e-0f1a-4b2c-8d3e-4f5a6b7c8d9e",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "entityType": "deal",
                    "entityId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                    "title": "Send the proposal",
                    "priority": "medium",
                    "status": "completed",
                    "dueDate": "2026-11-11",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "isEscalated": false,
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "completedAt": "2026-11-07T23:29:11.057166Z",
                    "completedBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "priority": {
                    "type": "string",
                    "description": "low, medium, high or urgent."
                  },
                  "status": {
                    "type": "string",
                    "description": "pending, in_progress, completed or cancelled."
                  },
                  "isEscalated": {
                    "type": "boolean",
                    "description": "Send false for a normal task."
                  },
                  "entityType": {
                    "type": "string",
                    "description": "deal or contact. Leave both entityType and entityId out for a standalone task."
                  },
                  "entityId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The deal or contact id. It must exist in your organisation."
                  },
                  "description": {
                    "type": "string"
                  },
                  "taskType": {
                    "type": "string",
                    "description": "Free text up to 50 characters, e.g. call."
                  },
                  "dueDate": {
                    "type": "string",
                    "format": "date",
                    "description": "YYYY-MM-DD (a date, no time)."
                  },
                  "recurrence": {
                    "type": "string",
                    "description": "daily, weekly or monthly. Completing the task creates the next one."
                  },
                  "reminderDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When to remind the owner in the app."
                  },
                  "assignedTo": {
                    "type": "string",
                    "description": "Owner's userId. \"\" removes the owner."
                  },
                  "escalatedTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Who to escalate to, when isEscalated is true."
                  },
                  "clearReminder": {
                    "type": "boolean",
                    "description": "true removes the reminder."
                  }
                }
              },
              "example": {
                "status": "completed"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "tasks_delete",
        "summary": "Delete a task",
        "tags": [
          "Tasks"
        ],
        "description": "Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Task deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/activities": {
      "get": {
        "operationId": "acts_list",
        "summary": "List activities",
        "tags": [
          "Activities"
        ],
        "description": "Calls, meetings, emails and other logged activity. Newest first. Paged. Who: Any member except client logins. Some activities are added automatically (stage moves, notes, emails). Those have autoSource set; on update don't send their subject, activityType, entityType or entityId, even unchanged (400). Send only the fields you're changing, e.g. notes or outcome.",
        "parameters": [
          {
            "name": "entityType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "activityType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "e.g. call."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Page number, starting at 0. Default 0."
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Rows per page, 1–100. Default 20. Larger values are cut to 100."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Activities retrieved",
                  "data": {
                    "content": [
                      {
                        "id": "0a1b2c3d-4e5f-4a6b-9c7d-8e9f0a1b2c3d",
                        "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                        "entityType": "deal",
                        "entityId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                        "activityType": "call",
                        "subject": "Discovery call",
                        "durationMinutes": 15,
                        "outcome": "connected",
                        "completedAt": "2026-11-07T23:29:00Z",
                        "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "createdAt": "2026-11-07T23:29:11.057166Z"
                      }
                    ],
                    "totalElements": 1,
                    "totalPages": 1,
                    "number": 0,
                    "size": 20,
                    "numberOfElements": 1,
                    "first": true,
                    "last": true,
                    "empty": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "acts_create",
        "summary": "Log an activity",
        "tags": [
          "Activities"
        ],
        "description": "Who: Owner, manager or executive. A whatsapp activity on a contact needs that contact's WhatsApp permission (403 otherwise). An unknown activityType returns 400 “One of the submitted values isn't allowed for that field…”.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Activity created",
                  "data": {
                    "id": "0a1b2c3d-4e5f-4a6b-9c7d-8e9f0a1b2c3d",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "entityType": "deal",
                    "entityId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                    "activityType": "call",
                    "subject": "Discovery call",
                    "durationMinutes": 15,
                    "outcome": "connected",
                    "completedAt": "2026-11-07T23:29:00Z",
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityType": {
                    "type": "string",
                    "description": "deal or contact."
                  },
                  "entityId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The deal or contact id."
                  },
                  "activityType": {
                    "type": "string",
                    "description": "call, email, meeting, demo, note, task, follow_up, whatsapp or other."
                  },
                  "subject": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "notes": {
                    "type": "string"
                  },
                  "durationMinutes": {
                    "type": "integer",
                    "description": "More than 0."
                  },
                  "outcome": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "location": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "scheduledAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "completedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "assignedTo": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "participants": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "Team members' userIds."
                  }
                },
                "required": [
                  "entityType",
                  "entityId",
                  "activityType",
                  "subject"
                ]
              },
              "example": {
                "entityType": "deal",
                "entityId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                "activityType": "call",
                "subject": "Discovery call",
                "durationMinutes": 15,
                "outcome": "connected",
                "completedAt": "2026-11-07T23:29:00Z"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/activities/{id}": {
      "get": {
        "operationId": "acts_get",
        "summary": "Get an activity",
        "tags": [
          "Activities"
        ],
        "description": "Who: Any member except client logins.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Activity retrieved",
                  "data": {
                    "id": "0a1b2c3d-4e5f-4a6b-9c7d-8e9f0a1b2c3d",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "entityType": "deal",
                    "entityId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                    "activityType": "call",
                    "subject": "Discovery call",
                    "durationMinutes": 15,
                    "outcome": "connected",
                    "completedAt": "2026-11-07T23:29:00Z",
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "acts_update",
        "summary": "Update an activity",
        "tags": [
          "Activities"
        ],
        "description": "Send only what changes. Sending null leaves a field as it is. Only the person who logged it, the person it's assigned to, or an owner or manager can change it (403 “Only the person who logged this, or a manager, can change it.” otherwise). Who: Its author (owner, manager or executive), or any owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityType": {
                    "type": "string",
                    "description": "deal or contact."
                  },
                  "entityId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The deal or contact id."
                  },
                  "activityType": {
                    "type": "string",
                    "description": "call, email, meeting, demo, note, task, follow_up, whatsapp or other."
                  },
                  "subject": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "notes": {
                    "type": "string"
                  },
                  "durationMinutes": {
                    "type": "integer",
                    "description": "More than 0."
                  },
                  "outcome": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "location": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "scheduledAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "completedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "assignedTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owner's userId. \"\" removes the owner."
                  },
                  "participants": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "Team members' userIds."
                  }
                }
              },
              "example": {
                "notes": "Discussed pricing"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "acts_delete",
        "summary": "Delete an activity",
        "tags": [
          "Activities"
        ],
        "description": "Deletes it permanently. Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Activity deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/products": {
      "get": {
        "operationId": "products_list",
        "summary": "List products",
        "tags": [
          "Products"
        ],
        "description": "Sorted by name. Not paged. Who: Any member.",
        "parameters": [
          {
            "name": "activeOnly",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Default false."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Products retrieved",
                  "data": [
                    {
                      "id": "e7f8a9b0-c1d2-4e3f-a4b5-c6d7e8f9a0b1",
                      "name": "Annual licence",
                      "sku": "LIC-1",
                      "unit": "licence",
                      "unitPrice": 275.5,
                      "currency": "EUR",
                      "isActive": true,
                      "createdAt": "2026-11-07T23:29:11.057166Z",
                      "updatedAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "products_create",
        "summary": "Create a product",
        "tags": [
          "Products"
        ],
        "description": "Who: Owner or manager.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "sku": {
                    "type": "string",
                    "description": "Up to 100 characters. Not required to be unique."
                  },
                  "description": {
                    "type": "string"
                  },
                  "unit": {
                    "type": "string",
                    "description": "e.g. licence, hour."
                  },
                  "unitPrice": {
                    "type": "number",
                    "description": "0 or more. Default 0."
                  },
                  "currency": {
                    "type": "string",
                    "description": "A currency code such as EUR. Leave it out and the product takes your organisation's currency."
                  },
                  "category": {
                    "type": "string"
                  },
                  "isActive": {
                    "type": "boolean",
                    "description": "Default true."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Annual licence",
                "sku": "LIC-1",
                "unit": "licence",
                "unitPrice": 275.5,
                "currency": "EUR"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/products/{id}": {
      "put": {
        "operationId": "products_update",
        "summary": "Update a product",
        "tags": [
          "Products"
        ],
        "description": "Send only what changes. Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "sku": {
                    "type": "string",
                    "description": "Up to 100 characters. Not required to be unique."
                  },
                  "description": {
                    "type": "string"
                  },
                  "unit": {
                    "type": "string",
                    "description": "e.g. licence, hour."
                  },
                  "unitPrice": {
                    "type": "number",
                    "description": "0 or more."
                  },
                  "currency": {
                    "type": "string",
                    "description": "A currency code such as EUR; it can't be emptied (400). For a deal, its line items follow."
                  },
                  "category": {
                    "type": "string"
                  },
                  "isActive": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "unitPrice": 299
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "products_delete",
        "summary": "Delete a product",
        "tags": [
          "Products"
        ],
        "description": "Existing line items keep their name and price. Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Product deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/core/custom-fields": {
      "get": {
        "operationId": "custom_fields",
        "summary": "List custom fields",
        "tags": [
          "Labels and custom fields"
        ],
        "description": "Your own fields on contacts, deals or accounts. Not paged. Includes switched-off fields (isActive: false); write only active ones. Who: Any member.",
        "parameters": [
          {
            "name": "templateSlug",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "sales-crm"
          },
          {
            "name": "entityType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "contact, deal or account."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Custom fields retrieved",
                  "data": [
                    {
                      "id": "4d5e6f70-0000-4a1b-8c2d-3e4f5a6b7c8d",
                      "templateSlug": "sales-crm",
                      "entityType": "contact",
                      "fieldKey": "contract_end",
                      "label": "Contract end",
                      "dataType": "date",
                      "required": false,
                      "displayOrder": 0,
                      "isActive": true
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_custom_fields_create",
        "summary": "Create a custom field",
        "tags": [
          "Configure: Fields, labels & lists"
        ],
        "description": "Adds your own field to contacts, deals or accounts. Records then store its value in customFields under the fieldKey. Who: Owner or manager. How to send values in a record's customFields: text → a string; number → a JSON number (not a string); boolean → true/false; date → a YYYY-MM-DD string; select → one string from options; multiselect → an array of strings from options, e.g. {\"plan_tier\": \"Pro\", \"regions\": [\"EU\", \"US\"]}. Option strings must match exactly (case included). A key already used by another field of the same entity type: 400 “A field with key 'plan_tier' already exists here”. A bad key: 400 “fieldKey must be lowercase, start with a letter, and use only a-z 0-9 _”. The keys html, sku, code, password, otp, token and secret are reserved: 400 “fieldKey 'code' is reserved — choose another key”. A select/multiselect field without options: 400 “options are required for a select / multiselect field”. An unknown entityType or dataType: 400, e.g. “dataType must be one of [text, number, date, boolean, select, multiselect]”. required only applies when a save sends customFields. A record created without customFields at all is never refused.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Custom field created",
                  "data": {
                    "id": "7b1e4c2a-9d3f-4e6b-a5c8-1f2e3d4c5b6a",
                    "templateSlug": "sales-crm",
                    "entityType": "contact",
                    "fieldKey": "plan_tier",
                    "label": "Plan tier",
                    "dataType": "select",
                    "options": [
                      "Basic",
                      "Pro",
                      "Enterprise"
                    ],
                    "required": false,
                    "displayOrder": 1,
                    "isActive": true,
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "templateSlug": {
                    "type": "string",
                    "description": "sales-crm. Can't be changed later."
                  },
                  "entityType": {
                    "type": "string",
                    "description": "contact, deal or account. Can't be changed later."
                  },
                  "fieldKey": {
                    "type": "string",
                    "description": "The key you write values under in customFields. Lowercase, starts with a letter, then only a-z, 0-9 and _; up to 60 characters. Unique per templateSlug + entityType. Can't be changed later."
                  },
                  "label": {
                    "type": "string",
                    "description": "The name people see. Up to 150 characters."
                  },
                  "dataType": {
                    "type": "string",
                    "description": "text, number, date, boolean, select or multiselect. Can't be changed later."
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The choices, as plain strings. Required (at least one) for select and multiselect."
                  },
                  "required": {
                    "type": "boolean",
                    "description": "Default false. When true, a save that sends customFields must include a value for this field."
                  },
                  "displayOrder": {
                    "type": "integer",
                    "description": "Position in forms; lower comes first. Default 0."
                  }
                },
                "required": [
                  "templateSlug",
                  "entityType",
                  "fieldKey",
                  "label",
                  "dataType"
                ]
              },
              "example": {
                "templateSlug": "sales-crm",
                "entityType": "contact",
                "fieldKey": "plan_tier",
                "label": "Plan tier",
                "dataType": "select",
                "options": [
                  "Basic",
                  "Pro",
                  "Enterprise"
                ],
                "displayOrder": 1
              }
            }
          }
        }
      }
    },
    "/api/v1/core/labels": {
      "get": {
        "operationId": "labels",
        "summary": "List labels",
        "tags": [
          "Labels and custom fields"
        ],
        "description": "Not paged. Who: Any member.",
        "parameters": [
          {
            "name": "activeOnly",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Default false."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Labels retrieved",
                  "data": [
                    {
                      "id": "9c8b7a6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d",
                      "name": "VIP",
                      "color": "#f59e0b",
                      "displayOrder": 0,
                      "isActive": true,
                      "createdAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_labels_create",
        "summary": "Create a label",
        "tags": [
          "Configure: Fields, labels & lists"
        ],
        "description": "Adds a label to your organisation's list. Put it on records with set the labels on a record. Who: Owner or manager. A name already used (ignoring case): 400 “A label named 'Trade fair 2026' already exists”. A blank name: 400 “Validation failed”.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Label created",
                  "data": {
                    "id": "b4a3c2d1-e0f9-4a8b-9c7d-6e5f4a3b2c1d",
                    "name": "Trade fair 2026",
                    "color": "#10b981",
                    "description": "Met at the November fair",
                    "displayOrder": 1,
                    "isActive": true,
                    "createdAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 60 characters. Spaces around it are trimmed. Unique in your organisation, ignoring case."
                  },
                  "color": {
                    "type": "string",
                    "description": "Up to 20 characters, e.g. #f59e0b. Not checked for format."
                  },
                  "description": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "displayOrder": {
                    "type": "integer",
                    "description": "Lower comes first. Default 0."
                  },
                  "isActive": {
                    "type": "boolean",
                    "description": "Default true. false archives the label (left out of activeOnly=true lists)."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Trade fair 2026",
                "color": "#10b981",
                "description": "Met at the November fair",
                "displayOrder": 1
              }
            }
          }
        }
      }
    },
    "/api/v1/core/entity-labels": {
      "get": {
        "operationId": "entity_labels_get",
        "summary": "Labels on a record",
        "tags": [
          "Labels and custom fields"
        ],
        "description": "Who: Any member.",
        "parameters": [
          {
            "name": "entityType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "contact, account or deal."
          },
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Labels retrieved",
                  "data": [
                    {
                      "id": "9c8b7a6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d",
                      "name": "VIP",
                      "color": "#f59e0b"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "entity_labels_set",
        "summary": "Set the labels on a record",
        "tags": [
          "Labels and custom fields"
        ],
        "description": "Replaces the record's labels with exactly this list. [] removes them all. Who: Owner, manager or executive.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Labels updated",
                  "data": [
                    {
                      "id": "9c8b7a6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d",
                      "name": "VIP",
                      "color": "#f59e0b"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityType": {
                    "type": "string",
                    "description": "contact, account or deal."
                  },
                  "entityId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "labelIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "required": [
                  "entityType",
                  "entityId",
                  "labelIds"
                ]
              },
              "example": {
                "entityType": "contact",
                "entityId": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                "labelIds": [
                  "9c8b7a6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d"
                ]
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/ingest/contacts": {
      "post": {
        "operationId": "ingest_contacts",
        "summary": "Push contacts (create or update)",
        "tags": [
          "Bulk push"
        ],
        "description": "Send up to 1,000 contacts in one call. Each one is matched to an existing contact or created. One bad record doesn't stop the rest. Records after the 1,000th are not processed; the report then has truncated: true. Who: Owner, manager or executive.",
        "parameters": [
          {
            "name": "module",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "sales (default)."
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Written to externalSource on records that don't name their own. Default api."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Ingested",
                  "data": {
                    "total": 2,
                    "created": 1,
                    "updated": 1,
                    "failed": 0,
                    "skipped": 0,
                    "skippedDuplicates": 0,
                    "truncated": false,
                    "errors": [],
                    "warnings": []
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "maxItems": 1000,
                "items": {
                  "type": "object",
                  "properties": {
                    "firstName": {
                      "type": "string",
                      "description": "If missing, the email (or “Unknown”) is used for a new contact."
                    },
                    "lastName": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "description": "Used to find an existing contact."
                    },
                    "phone": {
                      "type": "string",
                      "description": "Used to find an existing contact (last 10 digits)."
                    },
                    "mobile": {
                      "type": "string"
                    },
                    "companyName": {
                      "type": "string",
                      "description": "Finds or creates the account."
                    },
                    "accountDomain": {
                      "type": "string",
                      "description": "Finds the account by domain first."
                    },
                    "jobTitle": {
                      "type": "string"
                    },
                    "department": {
                      "type": "string"
                    },
                    "industry": {
                      "type": "string",
                      "description": "Unknown values are added to your list."
                    },
                    "leadSource": {
                      "type": "string",
                      "description": "Unknown values are added to your list."
                    },
                    "contactType": {
                      "type": "string",
                      "description": "Used only when creating. Default lead."
                    },
                    "website": {
                      "type": "string"
                    },
                    "linkedinUrl": {
                      "type": "string",
                      "description": "Personal LinkedIn."
                    },
                    "companyLinkedin": {
                      "type": "string"
                    },
                    "twitterHandle": {
                      "type": "string"
                    },
                    "instagram": {
                      "type": "string"
                    },
                    "whatsappNumber": {
                      "type": "string"
                    },
                    "addressLine1": {
                      "type": "string"
                    },
                    "addressLine2": {
                      "type": "string"
                    },
                    "city": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "postalCode": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string",
                      "description": "Name or ISO code; an unknown country is dropped with a warning."
                    },
                    "estimatedDealValue": {
                      "type": "number"
                    },
                    "leadScore": {
                      "type": "integer"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "notes": {
                      "type": "string"
                    },
                    "dateOfBirth": {
                      "type": "string",
                      "format": "date"
                    },
                    "workAnniversary": {
                      "type": "string",
                      "format": "date"
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "externalSource": {
                      "type": "string",
                      "description": "Your system's name. Needed for externalId matching."
                    },
                    "externalId": {
                      "type": "string",
                      "description": "Your system's id. Matched first, when externalSource is set."
                    }
                  }
                }
              },
              "example": [
                {
                  "firstName": "Lena",
                  "lastName": "Schmidt",
                  "email": "lena@example.com",
                  "companyName": "Example GmbH",
                  "jobTitle": "Head of Operations",
                  "country": "DE",
                  "externalSource": "billing-app",
                  "externalId": "cus_1042"
                },
                {
                  "firstName": "Tom",
                  "email": "tom@example.org",
                  "externalSource": "billing-app",
                  "externalId": "cus_1043"
                }
              ]
            }
          }
        }
      }
    },
    "/api/v1/integration/ingest/accounts": {
      "post": {
        "operationId": "ingest_accounts",
        "summary": "Push accounts (create or update)",
        "tags": [
          "Bulk push"
        ],
        "description": "Up to 1,000 accounts per call. Matched by externalId, then domain, then name. Who: Owner, manager or executive.",
        "parameters": [
          {
            "name": "module",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "sales (default)."
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Ingested",
                  "data": {
                    "total": 1,
                    "created": 1,
                    "updated": 0,
                    "failed": 0,
                    "skipped": 0,
                    "skippedDuplicates": 0,
                    "truncated": false,
                    "errors": [],
                    "warnings": []
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "maxItems": 1000,
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "If missing, the domain is used for a new account."
                    },
                    "domain": {
                      "type": "string",
                      "description": "Matched after externalId; normalised (no scheme, path or www.)."
                    },
                    "website": {
                      "type": "string"
                    },
                    "industry": {
                      "type": "string"
                    },
                    "phone": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "legalName": {
                      "type": "string"
                    },
                    "employeeCount": {
                      "type": "integer"
                    },
                    "annualRevenue": {
                      "type": "number"
                    },
                    "addressLine1": {
                      "type": "string"
                    },
                    "addressLine2": {
                      "type": "string"
                    },
                    "city": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "postalCode": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    },
                    "linkedinUrl": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "accountType": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "externalSource": {
                      "type": "string"
                    },
                    "externalId": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": [
                {
                  "name": "Example GmbH",
                  "domain": "example.com",
                  "country": "DE",
                  "externalSource": "billing-app",
                  "externalId": "org_77"
                }
              ]
            }
          }
        }
      }
    },
    "/api/v1/integration/import/contacts/preview": {
      "post": {
        "operationId": "import_preview",
        "summary": "Preview a CSV file",
        "tags": [
          "CSV import"
        ],
        "description": "Reads the header row and the first 5 rows, and suggests which column goes to which field. Who: Owner, manager or executive.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Preview",
                  "data": {
                    "headers": [
                      "First name",
                      "Last name",
                      "Email"
                    ],
                    "sampleRows": [
                      [
                        "Lena",
                        "Schmidt",
                        "lena@example.com"
                      ]
                    ],
                    "suggestedMapping": {
                      "firstName": "First name",
                      "lastName": "Last name",
                      "email": "Email"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "A UTF-8 CSV file, comma-separated, header in row 1. Up to 25 MB."
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/import/contacts": {
      "post": {
        "operationId": "import_run",
        "summary": "Import a CSV file",
        "tags": [
          "CSV import"
        ],
        "description": "Imports up to 10,000 rows, using the same matching as bulk push. Rows after the 10,000th are not processed; the report then has truncated: true. Who: Owner, manager or executive. Empty cells never clear a value. Extra CSV-only fields: ownerEmail (a team member with Sales access) and lifecycleStage (a key or its label). Numbers without a leading + get your organisation's country calling code (if your organisation has a country set; otherwise they're kept as written, with a warning). Bulk push and CSV import also need the role's permission to import contacts (403 otherwise).",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Import complete",
                  "data": {
                    "total": 1,
                    "created": 1,
                    "updated": 0,
                    "failed": 0,
                    "skipped": 0,
                    "skippedDuplicates": 0,
                    "truncated": false,
                    "errors": [],
                    "warnings": []
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The CSV file."
                  },
                  "mapping": {
                    "type": "string",
                    "description": "JSON text: {\"field\": \"CSV header\"}, e.g. from the preview's suggestedMapping. Custom fields as cf.<fieldKey>."
                  },
                  "module": {
                    "type": "string",
                    "description": "sales (default)."
                  },
                  "onDuplicate": {
                    "type": "string",
                    "description": "update (default), skip or create."
                  },
                  "source": {
                    "type": "string",
                    "description": "Default csv."
                  }
                },
                "required": [
                  "file",
                  "mapping"
                ]
              }
            }
          }
        }
      }
    },
    "/api/v1/core/pipelines/{id}": {
      "get": {
        "operationId": "cfg_pipelines_get",
        "summary": "Get a pipeline",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "One pipeline by id. A deleted pipeline, or one from another organisation, returns 404 “Pipeline not found with id: …”. Who: Any member.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Pipeline retrieved",
                  "data": {
                    "id": "3f9a7c21-8b4d-4e6f-a1c3-5d7e9f0b2a4c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "templateSlug": "sales-crm",
                    "name": "Partner deals",
                    "description": "Deals that come through resellers",
                    "isDefault": false,
                    "displayOrder": 1,
                    "isActive": true,
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "cfg_pipelines_update",
        "summary": "Update a pipeline",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Send only the fields you want to change. Left-out fields keep their value. Who: Owner or manager. There is no expectedVersion here: the last save wins.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Pipeline updated",
                  "data": {
                    "id": "3f9a7c21-8b4d-4e6f-a1c3-5d7e9f0b2a4c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "templateSlug": "sales-crm",
                    "name": "Reseller deals",
                    "description": "Deals that come through resellers",
                    "isDefault": false,
                    "displayOrder": 2,
                    "isActive": true,
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 1
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "description": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "displayOrder": {
                    "type": "integer",
                    "description": "Position among your pipelines (lower comes first)."
                  },
                  "isActive": {
                    "type": "boolean",
                    "description": "false marks the pipeline inactive."
                  },
                  "isDefault": {
                    "type": "boolean",
                    "description": "true makes it the default pipeline. false is ignored — to change the default, make another pipeline the default."
                  }
                }
              },
              "example": {
                "name": "Reseller deals",
                "displayOrder": 2
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_pipelines_delete",
        "summary": "Delete a pipeline",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Removes the pipeline and all its stages. If it was the default, the next pipeline (lowest displayOrder) becomes the default. Who: Owner or manager. Refused with 400 when it is your only pipeline: “Cannot delete the only pipeline for this module.” Refused with 400 while any deal (any status, any owner) is in it: “Cannot delete a pipeline that still has 3 deal(s). Move or remove those deals first.” Refused with 400 while one of its stages has an automation or approval gate switched on, e.g. “Stage \"Proposal\" is used by an approval gate. Remove those first.” Switched-off automations and gates are removed with the stages.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Pipeline deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/core/pipelines/{id}/default": {
      "put": {
        "operationId": "cfg_pipelines_default",
        "summary": "Make a pipeline the default",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Makes this pipeline the default for its module; the previous default stops being one. No body. Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Default pipeline set",
                  "data": {
                    "id": "3f9a7c21-8b4d-4e6f-a1c3-5d7e9f0b2a4c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "templateSlug": "sales-crm",
                    "name": "Partner deals",
                    "description": "Deals that come through resellers",
                    "isDefault": true,
                    "displayOrder": 1,
                    "isActive": true,
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 1
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/core/pipeline-stages/{id}": {
      "get": {
        "operationId": "cfg_stages_get",
        "summary": "Get a stage",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "One stage by id. A deleted stage returns 404 “Pipeline stage not found with id: …”. Who: Any member. Unlike the stage list, this answer has no automationCount or approvalGateEnabled.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Pipeline stage retrieved",
                  "data": {
                    "id": "7c1e5a9b-3d2f-4a6e-b8c0-9e1f2d3c4b5a",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                    "pipelineKey": "sales-crm_pipeline",
                    "stageName": "Demo booked",
                    "stageColor": "#22aa66",
                    "displayOrder": 3,
                    "probability": 35,
                    "idleAfterDays": 14,
                    "isClosedWon": false,
                    "isClosedLost": false,
                    "templateSlug": "sales-crm",
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "cfg_stages_update",
        "summary": "Update a stage",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Send only the fields you want to change. Left-out fields keep their value. Who: Owner or manager. Locked stages. While an automation or an approval gate is switched on for the stage, moving it to another pipeline or changing its won/lost setting returns 400, e.g. “Cannot change its won/lost setting: used by an approval gate. Remove those first.” or “Cannot move this stage: used by 1 automation(s). Remove those first.” Renaming, colour, probability and order are always allowed. Sending the current won/lost value back unchanged is fine. Same range errors as on create: “Probability must be between 0 and 100.”, “Idle after must be between 1 and 365 days.”",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Pipeline stage updated",
                  "data": {
                    "id": "7c1e5a9b-3d2f-4a6e-b8c0-9e1f2d3c4b5a",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                    "pipelineKey": "sales-crm_pipeline",
                    "stageName": "Demo held",
                    "stageColor": "#22aa66",
                    "displayOrder": 3,
                    "probability": 40,
                    "idleAfterDays": 14,
                    "isClosedWon": false,
                    "isClosedLost": false,
                    "templateSlug": "sales-crm",
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "entityVersion": 1
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "stageName": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "stageColor": {
                    "type": "string",
                    "description": "Hex colour, up to 7 characters."
                  },
                  "displayOrder": {
                    "type": "integer",
                    "description": "Position in the pipeline (lower comes first)."
                  },
                  "probability": {
                    "type": "integer",
                    "description": "0–100."
                  },
                  "idleAfterDays": {
                    "type": "integer",
                    "description": "1–365, or 0 to go back to the default (30)."
                  },
                  "isClosedWon": {
                    "type": "boolean",
                    "description": "Changing it is refused while the stage has an automation or approval gate switched on."
                  },
                  "isClosedLost": {
                    "type": "boolean",
                    "description": "Same rule as isClosedWon."
                  },
                  "pipelineId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Moves the stage to another of your pipelines. Refused while the stage has an automation or approval gate switched on."
                  },
                  "pipelineKey": {
                    "type": "string",
                    "description": "Up to 100 characters."
                  },
                  "templateSlug": {
                    "type": "string",
                    "description": "Up to 50 characters. Keep sales-crm."
                  }
                }
              },
              "example": {
                "stageName": "Demo held",
                "probability": 40
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_stages_delete",
        "summary": "Delete a stage",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Removes the stage. Who: Owner or manager. Refused with 400 while the stage has an automation or approval gate switched on: “Cannot delete this stage: used by an approval gate. Remove those first.” Refused with 400 while any deal (any status, any owner) is in it: “This stage still has 2 deal(s). Move them to another stage first.” Switched-off automations and approval gates of the stage are removed with it.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Pipeline stage deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/core/pipeline-stages/reorder": {
      "put": {
        "operationId": "cfg_stages_reorder",
        "summary": "Reorder stages",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Send the pipeline's stage ids as a JSON array, in the order you want. Each listed stage gets its position in the list as its displayOrder (starting at 0). Who: Owner or manager. Body: a JSON array of stage ids, up to 500. More than 500 ids (or a body of null) returns 400 “Reorder list must be 1-500 items”; no body at all returns 400 “Malformed request body”. Stages you leave out of the list keep their displayOrder; ids that aren't stages of the pipeline are ignored. Without pipelineId, the call orders by organizationId + templateSlug query parameters across all of the module's stages instead; with none of the three, nothing changes.",
        "parameters": [
          {
            "name": "pipelineId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The pipeline whose stages you're ordering. Send it."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Pipeline stages reordered"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "example": [
                "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                "14d799e7-0000-4b44-9610-dd9206f0028e",
                "7c1e5a9b-3d2f-4a6e-b8c0-9e1f2d3c4b5a"
              ]
            }
          }
        }
      }
    },
    "/api/v1/core/pipeline-stages/{stageId}/approval-config": {
      "get": {
        "operationId": "cfg_gate_get",
        "summary": "Get a stage's approval gate",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Whether moving a deal into this stage needs approval, and who decides. A stage that never had a gate saved returns isEnabled: false, decisionMode: any, an empty approverIds and no id. Who: Any member. This call doesn't check that the stage exists: an unknown stageId also returns the empty default.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Approval config retrieved",
                  "data": {
                    "id": "b4d6f8a0-2c4e-4f6a-8b0c-1d3e5f7a9b2c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "stageId": "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                    "isEnabled": true,
                    "decisionMode": "all",
                    "approverIds": [
                      "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                      "d2e4f6a8-0b1c-4d3e-9f5a-6b7c8d9e0f1a"
                    ],
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "cfg_gate_set",
        "summary": "Set a stage's approval gate",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Creates or changes the stage's approval gate. Send only the fields you want to change; left-out fields keep their value. Who: Owner only. Turning a gate on needs the Growth plan or higher: 403 “Approval gates: available from the Growth plan. Change your plan in Settings → Billing to use it.” Turning one off always works. Errors (400): “stageId does not reference an existing pipeline stage”, “approverIds must reference members of this organisation (<id> is not one).”, and “Validation failed” with {\"decisionMode\": \"decisionMode must be 'any' or 'all'\"}. While a gate is on, the stage can't be deleted, moved to another pipeline or have its won/lost setting changed.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Approval config saved",
                  "data": {
                    "id": "b4d6f8a0-2c4e-4f6a-8b0c-1d3e5f7a9b2c",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "stageId": "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                    "isEnabled": true,
                    "decisionMode": "all",
                    "approverIds": [
                      "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                      "d2e4f6a8-0b1c-4d3e-9f5a-6b7c8d9e0f1a"
                    ],
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "isEnabled": {
                    "type": "boolean",
                    "description": "true turns the gate on, false off. On a stage that has never had a gate saved, leaving it out means true."
                  },
                  "decisionMode": {
                    "type": "string",
                    "description": "any (default): the first approver's decision settles it. all: every named approver must approve; one rejection ends it."
                  },
                  "approverIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "Team members' userIds. Each must be a member of your organisation. Duplicates are dropped. Empty list: any owner or manager can decide (and decisionMode is treated as any)."
                  }
                }
              },
              "example": {
                "isEnabled": true,
                "decisionMode": "all",
                "approverIds": [
                  "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                  "d2e4f6a8-0b1c-4d3e-9f5a-6b7c8d9e0f1a"
                ]
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/board-settings": {
      "get": {
        "operationId": "cfg_card_fields_get",
        "summary": "Get the deal card fields",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Which fields the cards on the deal board show (the deal title always shows). One setting for your whole organisation. Who: Any member. Until a manager chooses, you get the defaults with isDefault: true and no entityVersion: value, contact, closeDate, owner, daysInStage, labels, probability.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Board settings retrieved",
                  "data": {
                    "cardFields": [
                      "value",
                      "contact",
                      "closeDate",
                      "owner",
                      "daysInStage",
                      "labels",
                      "probability"
                    ],
                    "isDefault": true
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "cfg_card_fields_set",
        "summary": "Choose the deal card fields",
        "tags": [
          "Configure: Pipelines & stages"
        ],
        "description": "Replaces the list of fields deal cards show, for everyone in your organisation. Who: Owner or manager. An unknown value returns 400 “Unknown card field: dealValue”. A missing cardFields returns 400 “Validation failed”. 409 conflicts: a stale expectedVersion gives “Someone else changed the card fields since you opened them. Reload and try again.”; expectNoSettings: true when settings already exist gives “Someone else chose the card fields since you opened them. Reload and try again.”",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Board settings saved",
                  "data": {
                    "cardFields": [
                      "value",
                      "owner",
                      "nextStep",
                      "lastActivity"
                    ],
                    "isDefault": false,
                    "entityVersion": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cardFields": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Up to 20 values from: value, contact, closeDate, owner, daysInStage, labels, probability, nextStep, lastActivity. Duplicates are dropped and the list is saved in that fixed order. [] shows the title only."
                  },
                  "expectedVersion": {
                    "type": "integer",
                    "description": "The entityVersion you last read. If someone saved since, you get 409. Leave it out for last-write-wins."
                  },
                  "expectNoSettings": {
                    "type": "boolean",
                    "description": "Send true when you started from the defaults (isDefault: true): if another manager saved settings meanwhile, you get 409."
                  }
                },
                "required": [
                  "cardFields"
                ]
              },
              "example": {
                "cardFields": [
                  "value",
                  "owner",
                  "nextStep",
                  "lastActivity"
                ],
                "expectNoSettings": true
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/targets": {
      "get": {
        "operationId": "cfg_targets_list",
        "summary": "List targets",
        "tags": [
          "Configure: Targets"
        ],
        "description": "Your targets, newest first. Paged. Who: Any member.",
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Exact period, e.g. 2026-Q4."
          },
          {
            "name": "targetType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "revenue, deals or leads."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Page number, starting at 0. Default 0."
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Rows per page, 1–100. Default 20. Larger values are cut to 100."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Targets retrieved",
                  "data": {
                    "content": [
                      {
                        "id": "e9f1a3b5-7c9d-4e1f-a3b5-c7d9e1f3a5b7",
                        "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                        "period": "2026-Q4",
                        "targetType": "revenue",
                        "targetValue": 150000,
                        "achievedValue": 0,
                        "currency": "EUR",
                        "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "createdAt": "2026-11-07T23:29:11.057166Z",
                        "updatedAt": "2026-11-07T23:29:11.057166Z"
                      }
                    ],
                    "totalElements": 1,
                    "totalPages": 1,
                    "number": 0,
                    "size": 20,
                    "numberOfElements": 1,
                    "first": true,
                    "last": true,
                    "empty": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_targets_create",
        "summary": "Create a target",
        "tags": [
          "Configure: Targets"
        ],
        "description": "Sets a revenue, deal or lead goal for one period, for one person or the whole team. Who: Owner or manager. Needs the Growth plan or higher: 403 “Targets: available from the Growth plan. Change your plan in Settings → Billing to use it.” Errors (400): “period must be a year (2026), a quarter (2026-Q2) or a month (2026-06)”, “targetValue cannot be negative”, “achievedValue cannot be negative”. A targetType outside the three values returns 400 “One of the submitted values isn't allowed for that field. Please review the values and try again.” Progress is computed, not stored. achievedValue is just a saved number; the real progress comes from won deals (and new leads) in the period. Won deals count on their won date, in your organisation's time zone.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Target created",
                  "data": {
                    "id": "e9f1a3b5-7c9d-4e1f-a3b5-c7d9e1f3a5b7",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "period": "2026-Q4",
                    "targetType": "revenue",
                    "targetValue": 150000,
                    "achievedValue": 0,
                    "currency": "EUR",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "period": {
                    "type": "string",
                    "description": "A year (2026), a quarter (2026-Q2) or a month (2026-06). Up to 20 characters."
                  },
                  "targetType": {
                    "type": "string",
                    "description": "revenue (sum of won deal values), deals (number of won deals) or leads (number of new lead contacts)."
                  },
                  "targetValue": {
                    "type": "number",
                    "description": "0 or more."
                  },
                  "achievedValue": {
                    "type": "number",
                    "description": "0 or more. Default 0. Not used for progress — see the notes."
                  },
                  "currency": {
                    "type": "string",
                    "description": "Up to 3 characters, e.g. EUR. For revenue targets: only won deals in this currency count. Leave it out to use your organisation's currency."
                  },
                  "assignedTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A team member's userId (400 “assignedTo must be a member of your organisation.” otherwise). Leave it out for a team target that counts everyone's deals."
                  }
                },
                "required": [
                  "period",
                  "targetType",
                  "targetValue"
                ]
              },
              "example": {
                "period": "2026-Q4",
                "targetType": "revenue",
                "targetValue": 150000,
                "currency": "EUR",
                "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/targets/{id}": {
      "get": {
        "operationId": "cfg_targets_get",
        "summary": "Get a target",
        "tags": [
          "Configure: Targets"
        ],
        "description": "One target by id. A deleted target returns 404 “Sales Target not found with id: …”. Who: Any member.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Target retrieved",
                  "data": {
                    "id": "e9f1a3b5-7c9d-4e1f-a3b5-c7d9e1f3a5b7",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "period": "2026-Q4",
                    "targetType": "revenue",
                    "targetValue": 150000,
                    "achievedValue": 0,
                    "currency": "EUR",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "cfg_targets_update",
        "summary": "Update a target",
        "tags": [
          "Configure: Targets"
        ],
        "description": "Send only the fields you want to change. Left-out fields keep their value. Who: Owner or manager. Same checks as on create for period, the values, targetType and assignedTo.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Target updated",
                  "data": {
                    "id": "e9f1a3b5-7c9d-4e1f-a3b5-c7d9e1f3a5b7",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "period": "2026-Q4",
                    "targetType": "revenue",
                    "targetValue": 180000,
                    "achievedValue": 0,
                    "currency": "EUR",
                    "assignedTo": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z",
                    "updatedBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "period": {
                    "type": "string",
                    "description": "A year, quarter or month, as on create."
                  },
                  "targetType": {
                    "type": "string",
                    "description": "revenue, deals or leads."
                  },
                  "targetValue": {
                    "type": "number",
                    "description": "0 or more."
                  },
                  "achievedValue": {
                    "type": "number",
                    "description": "0 or more."
                  },
                  "currency": {
                    "type": "string",
                    "description": "Up to 3 characters. Can be changed but not cleared."
                  },
                  "assignedTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A team member's userId. Can be changed but not cleared."
                  }
                }
              },
              "example": {
                "targetValue": 180000
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_targets_delete",
        "summary": "Delete a target",
        "tags": [
          "Configure: Targets"
        ],
        "description": "Removes the target. It no longer appears in lists and returns 404. Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Target deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/core/custom-fields/{id}": {
      "put": {
        "operationId": "cfg_custom_fields_update",
        "summary": "Update a custom field",
        "tags": [
          "Configure: Fields, labels & lists"
        ],
        "description": "Send only what changes. fieldKey, dataType, entityType and templateSlug can't be changed. Who: Owner or manager. Removing an option doesn't touch records that already hold it: they keep the value and can still be saved. Only a newly chosen value must be one of today's options. Switching a field off (isActive: false) hides it; its values are kept on every record and come back when you switch it on again. Write values only for active fields — on create, an inactive or unknown key is refused with 400 “Unknown custom field: plan_tier”. Unknown id: 404 “Custom field not found: {id}”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Custom field updated",
                  "data": {
                    "id": "7b1e4c2a-9d3f-4e6b-a5c8-1f2e3d4c5b6a",
                    "templateSlug": "sales-crm",
                    "entityType": "contact",
                    "fieldKey": "plan_tier",
                    "label": "Plan tier",
                    "dataType": "select",
                    "options": [
                      "Basic",
                      "Pro",
                      "Enterprise",
                      "Partner"
                    ],
                    "required": true,
                    "displayOrder": 1,
                    "isActive": true,
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "description": "Up to 150 characters."
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Replaces the whole list. A select/multiselect field can't be left with none."
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "displayOrder": {
                    "type": "integer",
                    "description": "Lower comes first. This is how you reorder fields."
                  },
                  "isActive": {
                    "type": "boolean",
                    "description": "false switches the field off: it is hidden, but values already stored are kept."
                  }
                }
              },
              "example": {
                "options": [
                  "Basic",
                  "Pro",
                  "Enterprise",
                  "Partner"
                ],
                "required": true
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_custom_fields_delete",
        "summary": "Delete a custom field",
        "tags": [
          "Configure: Fields, labels & lists"
        ],
        "description": "Removes the field definition. Its key can then be used again. Who: Owner or manager. Values already stored on records are not erased: they stay in each record's customFields under the old key. A new field created later with the same key and entity type picks them up again. Check field usage and lists and views using a field first to see what it affects. Unknown id: 404 “Custom field not found: {id}”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Custom field deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/core/custom-fields/usage": {
      "get": {
        "operationId": "cfg_custom_fields_usage",
        "summary": "Records using each custom field",
        "tags": [
          "Configure: Fields, labels & lists"
        ],
        "description": "How many records carry a value under each key. Keys with no records are left out. Who: Owner or manager. Counts every key found on the records, including keys of switched-off or deleted fields. Deleted records aren't counted.",
        "parameters": [
          {
            "name": "templateSlug",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "sales-crm"
          },
          {
            "name": "entityType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "contact, deal or account."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Custom-field usage",
                  "data": {
                    "plan_tier": 12,
                    "contract_end": 3
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/core/custom-fields/filter-usage": {
      "get": {
        "operationId": "cfg_custom_fields_filter_usage",
        "summary": "Lists and views using each custom field",
        "tags": [
          "Configure: Fields, labels & lists"
        ],
        "description": "How many contact lists and saved contact views filter on each custom field. Only fields used at least once are returned. Who: Owner or manager. Use it before deleting or switching off a field, or removing one of its options: those lists and views will need attention.",
        "parameters": [
          {
            "name": "templateSlug",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "sales-crm"
          },
          {
            "name": "entityType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "contact, deal or account. Only contact returns data; the others always return {}."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Custom-field filter usage",
                  "data": {
                    "plan_tier": {
                      "lists": 2,
                      "views": 1
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/core/labels/{id}": {
      "put": {
        "operationId": "cfg_labels_update",
        "summary": "Update a label",
        "tags": [
          "Configure: Fields, labels & lists"
        ],
        "description": "Rename, recolour, describe, reorder or archive a label. Send only what changes. Who: Owner or manager. color and description can be changed but not cleared: \"\" is ignored. A blank name: 400 “Label name is required”. A name another label has: 400 “A label named '…' already exists”. Unknown id: 404 “Label not found: {id}”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Label updated",
                  "data": {
                    "id": "b4a3c2d1-e0f9-4a8b-9c7d-6e5f4a3b2c1d",
                    "name": "Trade fair 2026",
                    "color": "#0ea5e9",
                    "description": "Met at the November fair",
                    "displayOrder": 1,
                    "isActive": false,
                    "createdAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 60 characters. Unique in your organisation, ignoring case."
                  },
                  "color": {
                    "type": "string",
                    "description": "Up to 20 characters."
                  },
                  "description": {
                    "type": "string",
                    "description": "Up to 255 characters."
                  },
                  "displayOrder": {
                    "type": "integer",
                    "description": "Lower comes first."
                  },
                  "isActive": {
                    "type": "boolean",
                    "description": "false archives the label; true restores it. Records keep it either way."
                  }
                }
              },
              "example": {
                "color": "#0ea5e9",
                "isActive": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_labels_delete",
        "summary": "Delete a label",
        "tags": [
          "Configure: Fields, labels & lists"
        ],
        "description": "Deletes the label and removes it from every record it was on. Its name can be used again. To keep it on records but stop offering it, archive it instead (isActive: false). Who: Owner or manager. Unknown id: 404 “Label not found: {id}”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Label deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/contact-field-options/{id}": {
      "put": {
        "operationId": "cfg_field_options_update",
        "summary": "Rename or archive a lead source or industry",
        "tags": [
          "Configure: Fields, labels & lists"
        ],
        "description": "Send label, archived or both. Left-out fields don't change. Who: Owner only. Contacts that already have an archived choice keep it. New saves can't pick it: a contact create or update sending it gets 400, and bulk push / imports drop it. A name another choice of the same list has (ignoring case): 400 “\"Trade fair\" is already one of the options.” Unknown id: 404 “Option not found”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Option updated",
                  "data": {
                    "id": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
                    "value": "trade_fair",
                    "label": "Trade fair",
                    "position": 11,
                    "archived": true,
                    "origin": "user"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "description": "New name, 1–100 characters. The stored value never changes, so no contact is touched."
                  },
                  "archived": {
                    "type": "boolean",
                    "description": "true archives the choice, false restores it."
                  }
                }
              },
              "example": {
                "archived": true
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/contact-field-options/order": {
      "put": {
        "operationId": "cfg_field_options_reorder",
        "summary": "Reorder a lead source or industry list",
        "tags": [
          "Configure: Fields, labels & lists"
        ],
        "description": "Puts the listed choices first, in the order sent (positions 0, 1, 2…). Choices you leave out follow, in their current order. Returns the whole list, archived choices included. Who: Owner only. An id that isn't a choice of that list: 400 “The order must list this field's options only.” There is no delete call: archive a choice instead.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Order saved",
                  "data": [
                    {
                      "id": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
                      "value": "trade_fair",
                      "label": "Trade fair",
                      "position": 0,
                      "archived": false,
                      "origin": "user"
                    },
                    {
                      "id": "8f9e0d1c-2b3a-4c5d-8e6f-7a8b9c0d1e2f",
                      "value": "website",
                      "label": "Website",
                      "position": 1,
                      "archived": false,
                      "origin": "default"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "field": {
                    "type": "string",
                    "description": "lead_source or industry."
                  },
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "Choice ids of that list, in the new order."
                  }
                },
                "required": [
                  "field",
                  "ids"
                ]
              },
              "example": {
                "field": "lead_source",
                "ids": [
                  "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
                  "8f9e0d1c-2b3a-4c5d-8e6f-7a8b9c0d1e2f"
                ]
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/assignment-rules": {
      "get": {
        "operationId": "cfg_rules_list",
        "summary": "List lead routing rules",
        "tags": [
          "Configure: Lead routing"
        ],
        "description": "All rules, in the order they run (lowest priority first, then oldest). Not paged. Who: Any member. assignedCount is how many contacts the rule has assigned; lastAssignedAt is missing until it first fires.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Assignment rules retrieved",
                  "data": [
                    {
                      "id": "c2d3e4f5-a6b7-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "DACH leads",
                      "matchField": "country",
                      "matchOperator": "equals",
                      "matchValue": "DE",
                      "strategy": "round_robin",
                      "poolUserIds": [
                        "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b"
                      ],
                      "priority": 0,
                      "isActive": true,
                      "assignedCount": 0,
                      "createdAt": "2026-11-07T23:29:11.057166Z",
                      "updatedAt": "2026-11-07T23:29:11.057166Z"
                    },
                    {
                      "id": "d9e8f7a6-b5c4-4d3e-8f2a-1b0c9d8e7f6a",
                      "name": "Everyone else",
                      "strategy": "direct",
                      "assignedUserId": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                      "priority": 1,
                      "isActive": true,
                      "assignedCount": 42,
                      "lastAssignedAt": "2026-11-07T23:29:11.057166Z",
                      "createdAt": "2026-11-07T23:29:11.057166Z",
                      "updatedAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_rules_create",
        "summary": "Create a lead routing rule",
        "tags": [
          "Configure: Lead routing"
        ],
        "description": "When a contact is created without assignedTo, active rules run in order and the first one that matches and has someone available sets the owner. If none does, the contact stays unassigned. Who: Owner or manager. Matching. equals ignores case, and compares numbers as numbers (50000 equals 50000.00). contains ignores case. is_set means the field has any value. country compares as the 2-letter code (a name like “Germany” works too); with contains it reads the English name. leadSource and industry accept the value or the label; with contains they read the label. Who can receive leads. Every person in assignedUserId / poolUserIds must be an active or invited member with Sales access (owners always have it), and not a client login. Otherwise 400 “Assignee {userId} is not a member of your organisation” or “Assignee {userId} is … and cannot receive leads”. If a person later loses access, the rule skips them: a pool takes turns among those still eligible, and a direct rule passes the contact on to the next rule. Plan. Lead routing needs the Growth plan or higher. Otherwise create, update, reorder and apply return 403 “Lead routing: available from the Growth plan. Change your plan in Settings → Billing to use it.”, and existing rules don't assign anyone. Other 400s: “assignedUserId is required for a direct rule”, “poolUserIds must be non-empty for a round-robin rule”, “matchOperator is required when matchField is set”, “matchValue is required for the 'equals' operator”, “The 'greater_than' operator needs a numeric matchValue”, “Unsupported match field: {field} (use a standard contact field, leadScore, or custom.<key>)”.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Assignment rule created",
                  "data": {
                    "id": "c2d3e4f5-a6b7-4c8d-9e0f-1a2b3c4d5e6f",
                    "name": "DACH leads",
                    "matchField": "country",
                    "matchOperator": "equals",
                    "matchValue": "DE",
                    "strategy": "round_robin",
                    "poolUserIds": [
                      "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                      "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b"
                    ],
                    "priority": 0,
                    "isActive": true,
                    "assignedCount": 0,
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 150 characters."
                  },
                  "matchField": {
                    "type": "string",
                    "description": "The contact field the rule checks. Leave it out (or send \"\") for a catch-all rule that matches every contact. One of leadSource, industry, contactType, status, jobTitle, companyName, country, state, city, department, estimatedDealValue, leadScore, or custom.<fieldKey> for a custom field. Up to 80 characters."
                  },
                  "matchOperator": {
                    "type": "string",
                    "description": "Required when matchField is set. equals, contains, is_set, greater_than or less_than."
                  },
                  "matchValue": {
                    "type": "string",
                    "description": "Up to 500 characters. Required for every operator except is_set. Must be a number for greater_than / less_than."
                  },
                  "strategy": {
                    "type": "string",
                    "description": "direct (always the same person) or round_robin (takes turns through a pool)."
                  },
                  "assignedUserId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Required for direct. A team member's userId."
                  },
                  "poolUserIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "Required (at least one) for round_robin. Team members' userIds."
                  },
                  "priority": {
                    "type": "integer",
                    "description": "Lower runs first. Default 0. Rules with the same priority run oldest first."
                  },
                  "isActive": {
                    "type": "boolean",
                    "description": "Default true. Inactive rules never route."
                  }
                },
                "required": [
                  "name",
                  "strategy"
                ]
              },
              "example": {
                "name": "DACH leads",
                "matchField": "country",
                "matchOperator": "equals",
                "matchValue": "DE",
                "strategy": "round_robin",
                "poolUserIds": [
                  "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                  "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b"
                ],
                "priority": 0
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/assignment-rules/{id}": {
      "put": {
        "operationId": "cfg_rules_update",
        "summary": "Update a lead routing rule",
        "tags": [
          "Configure: Lead routing"
        ],
        "description": "Send only what changes. Who: Owner or manager. Membership is checked only for people this call adds. People already on the rule stay even if they have since lost access (the rule just skips them when routing). Setting matchOperator to is_set clears matchValue. Blank name: 400 “name must not be blank”. Blank strategy: 400 “strategy must be one of: direct, round_robin”. Unknown id: 404 “Assignment rule not found: {id}”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Assignment rule updated",
                  "data": {
                    "id": "c2d3e4f5-a6b7-4c8d-9e0f-1a2b3c4d5e6f",
                    "name": "DACH leads",
                    "matchField": "country",
                    "matchOperator": "equals",
                    "matchValue": "DE",
                    "strategy": "round_robin",
                    "poolUserIds": [
                      "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d"
                    ],
                    "priority": 0,
                    "isActive": true,
                    "assignedCount": 0,
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 150 characters. Can't be blank."
                  },
                  "matchField": {
                    "type": "string",
                    "description": "Send \"\" to turn the rule into a catch-all (this also clears matchOperator and matchValue). Same values as on create."
                  },
                  "matchOperator": {
                    "type": "string",
                    "description": "Required when matchField is set. equals, contains, is_set, greater_than or less_than."
                  },
                  "matchValue": {
                    "type": "string",
                    "description": "Up to 500 characters. Required for every operator except is_set. Must be a number for greater_than / less_than."
                  },
                  "strategy": {
                    "type": "string",
                    "description": "direct or round_robin."
                  },
                  "assignedUserId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Required for direct. A team member's userId."
                  },
                  "poolUserIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "Replaces the whole pool. Can't be empty for a round_robin rule."
                  },
                  "priority": {
                    "type": "integer",
                    "description": "Lower runs first. To reorder many rules at once, use reorder rules."
                  },
                  "isActive": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "poolUserIds": [
                  "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d"
                ],
                "isActive": true
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_rules_delete",
        "summary": "Delete a lead routing rule",
        "tags": [
          "Configure: Lead routing"
        ],
        "description": "Contacts it already assigned keep their owner. Who: Owner or manager. Unknown id: 404 “Assignment rule not found: {id}”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Assignment rule deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/assignment-rules/reorder": {
      "put": {
        "operationId": "cfg_rules_reorder",
        "summary": "Reorder lead routing rules",
        "tags": [
          "Configure: Lead routing"
        ],
        "description": "Sets the run order in one go: the rules get priority 0, 1, 2… in the order sent. Returns the rules in their new order. Who: Owner or manager. A missing, extra or repeated id: 400 “orderedRuleIds must list every rule of this organization exactly once”.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Rules reordered",
                  "data": [
                    {
                      "id": "d9e8f7a6-b5c4-4d3e-8f2a-1b0c9d8e7f6a",
                      "name": "Everyone else",
                      "strategy": "direct",
                      "assignedUserId": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                      "priority": 0,
                      "isActive": true,
                      "assignedCount": 42,
                      "lastAssignedAt": "2026-11-07T23:29:11.057166Z",
                      "createdAt": "2026-11-07T23:29:11.057166Z",
                      "updatedAt": "2026-11-07T23:29:11.057166Z"
                    },
                    {
                      "id": "c2d3e4f5-a6b7-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "DACH leads",
                      "matchField": "country",
                      "matchOperator": "equals",
                      "matchValue": "DE",
                      "strategy": "round_robin",
                      "poolUserIds": [
                        "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                        "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b"
                      ],
                      "priority": 1,
                      "isActive": true,
                      "assignedCount": 0,
                      "createdAt": "2026-11-07T23:29:11.057166Z",
                      "updatedAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orderedRuleIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "Every rule id of your organisation, each exactly once."
                  }
                },
                "required": [
                  "orderedRuleIds"
                ]
              },
              "example": {
                "orderedRuleIds": [
                  "d9e8f7a6-b5c4-4d3e-8f2a-1b0c9d8e7f6a",
                  "c2d3e4f5-a6b7-4c8d-9e0f-1a2b3c4d5e6f"
                ]
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/assignment-rules/apply": {
      "post": {
        "operationId": "cfg_rules_apply",
        "summary": "Route unassigned contacts now",
        "tags": [
          "Configure: Lead routing"
        ],
        "description": "Runs the active rules over every contact that has no owner yet. Contacts with an owner are never changed. No request body. Who: Owner or manager. The message says what happened: “Assigned {assigned} of {scanned} unassigned contact(s)”. scanned counts every unassigned contact looked at; those no rule could place stay unassigned. Pools take turns exactly as for new leads. Each person who received contacts gets one in-app notification. Your role must also be allowed to edit contacts: otherwise 403 “Your role does not allow you to edit contact records”.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Assigned 3 of 5 unassigned contact(s)",
                  "data": {
                    "scanned": 5,
                    "assigned": 3
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/assignment-rules/preview": {
      "post": {
        "operationId": "cfg_rules_preview",
        "summary": "Preview a rule condition",
        "tags": [
          "Configure: Lead routing"
        ],
        "description": "Counts how many unassigned contacts a condition would match right now. Saves nothing. Use it to catch a typo before saving a rule. Who: Owner or manager. Looks at up to 5,000 unassigned contacts, newest first. truncated: true means there were more, and the counts describe only those 5,000. The condition is checked like on create (same 400 messages). Your role must be allowed to edit contacts (otherwise 403).",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Rule condition previewed",
                  "data": {
                    "scanned": 120,
                    "matched": 18,
                    "truncated": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "matchField": {
                    "type": "string",
                    "description": "As on create. Leave it out to count a catch-all (matches all)."
                  },
                  "matchOperator": {
                    "type": "string",
                    "description": "As on create."
                  },
                  "matchValue": {
                    "type": "string",
                    "description": "As on create."
                  }
                }
              },
              "example": {
                "matchField": "country",
                "matchOperator": "equals",
                "matchValue": "DE"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/assignment-rules/test/{contactId}": {
      "get": {
        "operationId": "cfg_rules_test",
        "summary": "Test routing for a contact",
        "tags": [
          "Configure: Lead routing"
        ],
        "description": "Says which rule would route this contact and to whom. Changes nothing (a pool's turn doesn't move). Who: Owner or manager. matched: false means no active rule would assign anyone; ruleId, ruleName, strategy and assigneeUserId are then missing. alreadyAssigned: true means the contact has an owner, so routing wouldn't actually change it. For a pool, assigneeUserId is whoever's turn it is now. A contact you can't see or that doesn't exist: 404 “Contact not found: {contactId}”. Your role must be allowed to edit contacts (otherwise 403).",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Routing prediction",
                  "data": {
                    "matched": true,
                    "ruleId": "c2d3e4f5-a6b7-4c8d-9e0f-1a2b3c4d5e6f",
                    "ruleName": "DACH leads",
                    "strategy": "round_robin",
                    "assigneeUserId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                    "alreadyAssigned": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/lead-scoring/rules": {
      "get": {
        "operationId": "cfg_score_rules_list",
        "summary": "List scoring rules",
        "tags": [
          "Configure: Lead scoring"
        ],
        "description": "Your organisation's lead-scoring rules, in displayOrder. Not paged. Who: Any member.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Scoring rules retrieved",
                  "data": [
                    {
                      "id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e70",
                      "name": "Came from the website",
                      "field": "leadSource",
                      "operator": "equals",
                      "value": "website",
                      "points": 20,
                      "isActive": true,
                      "displayOrder": 0,
                      "createdAt": "2026-11-07T23:29:11.057166Z",
                      "updatedAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_score_rules_create",
        "summary": "Create a scoring rule",
        "tags": [
          "Configure: Lead scoring"
        ],
        "description": "Adds one rule: “if field operator value, add points”. Who: Owner or manager. How the score is worked out. A contact's score is the sum of the points of every active rule it matches, kept between 0 and 100. It is recalculated when the contact is created or edited and every night. If your organisation has no active rules, the leadScore you send on a contact is kept as it is. Text compares ignore upper/lower case and surrounding spaces. A number field with equals compares as numbers (50000 matches 50000.00). country compares as the ISO code, so Germany and DE mean the same. leadSource and industry accept the list value or its label. equals, not_equals and contains never match a contact whose field is empty. Errors (400): “operator must be one of [equals, not_equals, contains, is_set, greater_than, less_than]”; “Unsupported scoring field: … (use a standard contact field, behaviour.<signal> or custom.<key>)”; “A value is required for the 'equals' operator”; “The 'greater_than' operator needs a numeric value”; “A behaviour signal is always a number — use 'greater than' (e.g. greater than 0) instead of 'is set'”. Saving a rule does not re-score existing contacts. Call re-score all contacts afterwards. Plan. Lead scoring is part of the Growth and Business plans. On a lower (or lapsed) plan this call returns 403 “Lead scoring: available from the Growth plan. Change your plan in Settings → Billing to use it.”",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Scoring rule created",
                  "data": {
                    "id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e70",
                    "name": "Came from the website",
                    "field": "leadSource",
                    "operator": "equals",
                    "value": "website",
                    "points": 20,
                    "isActive": true,
                    "displayOrder": 0,
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 150 characters."
                  },
                  "field": {
                    "type": "string",
                    "description": "What the rule looks at, up to 80 characters. A contact field: leadSource, industry, contactType, status, jobTitle, companyName, country, state, city, department or estimatedDealValue. A behaviour signal: behaviour.emailOpens30d, behaviour.emailClicks30d or behaviour.daysSinceLastTouch. Or a custom field: custom. + its fieldKey (lower case, e.g. custom.fleet_size)."
                  },
                  "operator": {
                    "type": "string",
                    "description": "equals, not_equals, contains, is_set, greater_than or less_than."
                  },
                  "value": {
                    "type": "string",
                    "description": "Up to 500 characters. Needed for every operator except is_set. Must be a number for greater_than and less_than."
                  },
                  "points": {
                    "type": "integer",
                    "description": "−1000 to 1000. Negative points lower the score."
                  },
                  "isActive": {
                    "type": "boolean",
                    "description": "Default true. Only active rules score."
                  },
                  "displayOrder": {
                    "type": "integer",
                    "description": "Position in the list. Default 0."
                  }
                },
                "required": [
                  "name",
                  "field",
                  "operator",
                  "points"
                ]
              },
              "example": {
                "name": "Came from the website",
                "field": "leadSource",
                "operator": "equals",
                "value": "website",
                "points": 20
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/lead-scoring/rules/{id}": {
      "put": {
        "operationId": "cfg_score_rules_update",
        "summary": "Update a scoring rule",
        "tags": [
          "Configure: Lead scoring"
        ],
        "description": "Send only the fields you want to change. Left-out fields keep their value. Who: Owner or manager. A changed condition is checked with the same rules as create. A new points value outside −1000…1000 returns 400 “points must be between -1000 and 1000”. Unknown id: 404 “Scoring rule not found: <id>”. Plan. Lead scoring is part of the Growth and Business plans. On a lower (or lapsed) plan this call returns 403 “Lead scoring: available from the Growth plan. Change your plan in Settings → Billing to use it.”",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Scoring rule updated",
                  "data": {
                    "id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e70",
                    "name": "Came from the website",
                    "field": "leadSource",
                    "operator": "equals",
                    "value": "website",
                    "points": 25,
                    "isActive": true,
                    "displayOrder": 0,
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 150 characters."
                  },
                  "field": {
                    "type": "string",
                    "description": "What the rule looks at, up to 80 characters. A contact field: leadSource, industry, contactType, status, jobTitle, companyName, country, state, city, department or estimatedDealValue. A behaviour signal: behaviour.emailOpens30d, behaviour.emailClicks30d or behaviour.daysSinceLastTouch. Or a custom field: custom. + its fieldKey (lower case, e.g. custom.fleet_size)."
                  },
                  "operator": {
                    "type": "string",
                    "description": "equals, not_equals, contains, is_set, greater_than or less_than."
                  },
                  "value": {
                    "type": "string",
                    "description": "Up to 500 characters. Needed for every operator except is_set. Must be a number for greater_than and less_than."
                  },
                  "points": {
                    "type": "integer",
                    "description": "−1000 to 1000. Negative points lower the score."
                  },
                  "isActive": {
                    "type": "boolean",
                    "description": "Default true. Only active rules score."
                  },
                  "displayOrder": {
                    "type": "integer",
                    "description": "Position in the list."
                  }
                }
              },
              "example": {
                "points": 25
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_score_rules_delete",
        "summary": "Delete a scoring rule",
        "tags": [
          "Configure: Lead scoring"
        ],
        "description": "Removes the rule. Existing scores change on the next recalculation. Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Scoring rule deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/lead-scoring/recalculate": {
      "post": {
        "operationId": "cfg_score_recalculate",
        "summary": "Re-score all contacts",
        "tags": [
          "Configure: Lead scoring"
        ],
        "description": "Applies the current active rules to every contact in your organisation now. No body. Who: Owner or manager. scanned = contacts looked at; updated = contacts whose score changed. The message says the same. Needs the key's role to be allowed to edit contacts (403 otherwise). Plan. Lead scoring is part of the Growth and Business plans. On a lower (or lapsed) plan this call returns 403 “Lead scoring: available from the Growth plan. Change your plan in Settings → Billing to use it.”",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Re-scored 12 of 40 contact(s)",
                  "data": {
                    "scanned": 40,
                    "updated": 12
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/lead-scoring/breakdown/{contactId}": {
      "get": {
        "operationId": "cfg_score_breakdown",
        "summary": "Why a contact has its score",
        "tags": [
          "Configure: Lead scoring"
        ],
        "description": "The score the current rules give this contact, and which rules matched. Who: Any member. activeRuleCount 0 means scoring is off: the contact's stored score is a manual one. This is worked out live; it can differ from the contact's stored leadScore until the next recalculation. Unknown contact: 404 “Contact not found: <id>”.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Score breakdown",
                  "data": {
                    "score": 20,
                    "activeRuleCount": 3,
                    "matched": [
                      {
                        "ruleId": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e70",
                        "name": "Came from the website",
                        "field": "leadSource",
                        "operator": "equals",
                        "value": "website",
                        "points": 20
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/lead-scoring/automations": {
      "get": {
        "operationId": "cfg_score_autos_list",
        "summary": "List score automations",
        "tags": [
          "Configure: Lead scoring"
        ],
        "description": "Actions that run when a contact's score crosses a threshold. Lowest threshold first. Not paged. Who: Any member. firedCount = how many contacts it has acted on; lastFiredAt is missing until it first fires. targetLabel is the sequence name for enroll_sequence.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Automations retrieved",
                  "data": [
                    {
                      "id": "4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a71",
                      "name": "Hot lead → owner follow-up",
                      "threshold": 70,
                      "actionType": "create_task",
                      "targetValue": "Call this hot lead",
                      "isEnabled": true,
                      "firedCount": 0
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_score_autos_create",
        "summary": "Create a score automation",
        "tags": [
          "Configure: Lead scoring"
        ],
        "description": "“When a contact's score reaches threshold, do actionType.” It fires only on an upward crossing (from below to at or above). Who: Owner or manager. What each action does. enroll_sequence: enrols the contact (the same checks as bulk enrol; a contact who can't be enrolled is skipped). create_task: a high-priority follow-up task on the contact, due tomorrow, for the contact's owner — not repeated while the last one is still open. set_lifecycle_stage: moves the contact forward only; never backwards, and never out of nurture or not_interested. notify_owner: an in-app notification to the contact's owner (skipped when the contact has no owner). Errors (400): “actionType must be one of [enroll_sequence, create_task, set_lifecycle_stage, notify_owner]”; “Pick the sequence to enrol the contact in”; “Sequence not found in your organisation”; “The sequence \"…\" is paused — resume it first”; “The sequence \"…\" has no steps yet”; “Pick a lifecycle stage: lead, cadence, mql, sql, customer”; “An identical automation already exists at a score of 70”. Existing contacts already above the threshold are not acted on. Use run for contacts already above.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Automation created",
                  "data": {
                    "id": "4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a71",
                    "name": "Hot lead → owner follow-up",
                    "threshold": 70,
                    "actionType": "create_task",
                    "targetValue": "Call this hot lead",
                    "isEnabled": true,
                    "firedCount": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 120 characters."
                  },
                  "threshold": {
                    "type": "integer",
                    "description": "1–100. Fires when a contact's score rises from below this number to this number or above."
                  },
                  "actionType": {
                    "type": "string",
                    "description": "enroll_sequence, create_task, set_lifecycle_stage or notify_owner."
                  },
                  "targetId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The sequence id. Needed for enroll_sequence; the sequence must be active and have at least one step."
                  },
                  "targetValue": {
                    "type": "string",
                    "description": "Up to 255 characters. For set_lifecycle_stage (needed): lead, cadence, mql, sql or customer. For create_task (optional): the task title — default “Follow up — lead score reached <threshold>”."
                  },
                  "isEnabled": {
                    "type": "boolean",
                    "description": "Default true."
                  }
                },
                "required": [
                  "name",
                  "threshold",
                  "actionType"
                ]
              },
              "example": {
                "name": "Hot lead → owner follow-up",
                "threshold": 70,
                "actionType": "create_task",
                "targetValue": "Call this hot lead"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/lead-scoring/automations/{id}": {
      "put": {
        "operationId": "cfg_score_autos_update",
        "summary": "Update a score automation",
        "tags": [
          "Configure: Lead scoring"
        ],
        "description": "Rename it, change its threshold, or switch it on or off. Send only what changes. Who: Owner or manager. The action and its target can't be changed: delete the automation and create a new one. Unknown id: 404 “Lead score automation not found with id: <id>”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Automation updated",
                  "data": {
                    "id": "4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a71",
                    "name": "Hot lead → owner follow-up",
                    "threshold": 70,
                    "actionType": "create_task",
                    "targetValue": "Call this hot lead",
                    "isEnabled": false,
                    "firedCount": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 120 characters. A blank name is ignored."
                  },
                  "threshold": {
                    "type": "integer",
                    "description": "1–100."
                  },
                  "isEnabled": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "isEnabled": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_score_autos_delete",
        "summary": "Delete a score automation",
        "tags": [
          "Configure: Lead scoring"
        ],
        "description": "Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Automation deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/lead-scoring/automations/{id}/run": {
      "post": {
        "operationId": "cfg_score_autos_run",
        "summary": "Run for contacts already above",
        "tags": [
          "Configure: Lead scoring"
        ],
        "description": "Runs the automation for contacts whose stored score is already at or above its threshold, oldest contact first. No body. Who: Owner or manager. One call acts on at most 200 contacts, looks at at most 5,000, and stops after about 20 seconds. Then truncated is true and nextAfter says where to continue. skipped = contacts it did not act on (already enrolled, already at that stage, no owner to notify, …). Errors (400): “Enable this automation before running it”; “Can't continue this run — its position no longer exists. Start a new run.”; for enroll_sequence, the sequence messages listed under create.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Continue a run that stopped early: send the nextAfter from the previous answer."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Automation run complete",
                  "data": {
                    "scanned": 3,
                    "eligible": 3,
                    "fired": 2,
                    "skipped": 1,
                    "truncated": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/sequences": {
      "get": {
        "operationId": "cfg_seq_list",
        "summary": "List sequences",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "All your sequences with their steps, newest first. Not paged. Who: Any member. enrollListId appears when the sequence enrols a contact list's new members (set up in the app).",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Sequences retrieved",
                  "data": [
                    {
                      "id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82",
                      "name": "New website leads",
                      "description": "Two touches over three days",
                      "isActive": true,
                      "includeUnsubscribe": true,
                      "dailySendCap": 50,
                      "removeOnLeave": false,
                      "steps": [
                        {
                          "id": "6c7d8e9f-0a1b-4c2d-9e3f-4a5b6c7d8e93",
                          "stepOrder": 1,
                          "delayDays": 0,
                          "actionType": "email",
                          "emailSubject": "Quick question, {{firstName}}",
                          "emailBody": "Hi {{firstName|there}}, …",
                          "replyToPrevious": false
                        },
                        {
                          "id": "7d8e9f0a-1b2c-4d3e-a4f5-6b7c8d9e0fa4",
                          "stepOrder": 2,
                          "delayDays": 3,
                          "actionType": "task",
                          "taskTitle": "Call if no reply",
                          "conditionType": "not_clicked",
                          "replyToPrevious": false
                        }
                      ],
                      "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                      "createdAt": "2026-11-07T23:29:11.057166Z",
                      "updatedAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_seq_create",
        "summary": "Create a sequence",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Creates an empty sequence. Add steps with add a step. Who: Owner or manager. Every sequence needs a way to opt out: the unsubscribe link, or a P.S. line. 400 “Choose a P.S. line, or keep the unsubscribe link — every sequence needs one” or “That P.S. line isn't one you can choose”. Plan. Sequences are part of the Growth and Business plans. On a lower (or lapsed) plan this call returns 403 “Sequences: available from the Growth plan. Change your plan in Settings → Billing to use it.”",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Sequence created",
                  "data": {
                    "id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82",
                    "name": "New website leads",
                    "description": "Two touches over three days",
                    "isActive": true,
                    "includeUnsubscribe": true,
                    "dailySendCap": 50,
                    "removeOnLeave": false,
                    "steps": [],
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 150 characters."
                  },
                  "description": {
                    "type": "string"
                  },
                  "isActive": {
                    "type": "boolean",
                    "description": "Default true. false = paused."
                  },
                  "includeUnsubscribe": {
                    "type": "boolean",
                    "description": "Default true: every email gets an unsubscribe footer and a one-click unsubscribe header."
                  },
                  "optOutLine": {
                    "type": "string",
                    "description": "The key of a “P.S.” opt-out line — see P.S. lines. Needed when includeUnsubscribe is false."
                  },
                  "dailySendCap": {
                    "type": "integer",
                    "description": "1–10,000. The most emails this sequence sends in one day (your organisation's time zone). Leave it out for no limit."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "New website leads",
                "description": "Two touches over three days",
                "dailySendCap": 50
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/sequences/{id}": {
      "get": {
        "operationId": "cfg_seq_get",
        "summary": "Get a sequence",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "One sequence with its steps in run order. Unknown id: 404 “Sequence not found: <id>”. Who: Any member.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Sequence retrieved",
                  "data": {
                    "id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82",
                    "name": "New website leads",
                    "description": "Two touches over three days",
                    "isActive": true,
                    "includeUnsubscribe": true,
                    "dailySendCap": 50,
                    "removeOnLeave": false,
                    "steps": [
                      {
                        "id": "6c7d8e9f-0a1b-4c2d-9e3f-4a5b6c7d8e93",
                        "stepOrder": 1,
                        "delayDays": 0,
                        "actionType": "email",
                        "emailSubject": "Quick question, {{firstName}}",
                        "emailBody": "Hi {{firstName|there}}, …",
                        "replyToPrevious": false
                      },
                      {
                        "id": "7d8e9f0a-1b2c-4d3e-a4f5-6b7c8d9e0fa4",
                        "stepOrder": 2,
                        "delayDays": 3,
                        "actionType": "task",
                        "taskTitle": "Call if no reply",
                        "conditionType": "not_clicked",
                        "replyToPrevious": false
                      }
                    ],
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "cfg_seq_update",
        "summary": "Update, pause or resume a sequence",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Send only the fields you want to change. \"isActive\": false pauses it; true resumes it. Who: Owner or manager. Paused: enrolled contacts wait — no step runs — and carry on where they were once you resume. New enrolments are refused while paused. Plan. Sequences are part of the Growth and Business plans. On a lower (or lapsed) plan this call returns 403 “Sequences: available from the Growth plan. Change your plan in Settings → Billing to use it.”",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Sequence updated",
                  "data": {
                    "id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82",
                    "name": "New website leads",
                    "description": "Two touches over three days",
                    "isActive": false,
                    "includeUnsubscribe": true,
                    "dailySendCap": 50,
                    "removeOnLeave": false,
                    "steps": [
                      {
                        "id": "6c7d8e9f-0a1b-4c2d-9e3f-4a5b6c7d8e93",
                        "stepOrder": 1,
                        "delayDays": 0,
                        "actionType": "email",
                        "emailSubject": "Quick question, {{firstName}}",
                        "emailBody": "Hi {{firstName|there}}, …",
                        "replyToPrevious": false
                      },
                      {
                        "id": "7d8e9f0a-1b2c-4d3e-a4f5-6b7c8d9e0fa4",
                        "stepOrder": 2,
                        "delayDays": 3,
                        "actionType": "task",
                        "taskTitle": "Call if no reply",
                        "conditionType": "not_clicked",
                        "replyToPrevious": false
                      }
                    ],
                    "createdBy": "5b7e9a1c-2d3f-4a5b-8c6d-7e8f9a0b1c2d",
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 150 characters. Can't be blank (400 “A sequence needs a name”)."
                  },
                  "description": {
                    "type": "string"
                  },
                  "isActive": {
                    "type": "boolean",
                    "description": "false = paused, true = running."
                  },
                  "includeUnsubscribe": {
                    "type": "boolean"
                  },
                  "optOutLine": {
                    "type": "string",
                    "description": "A P.S. line key."
                  },
                  "dailySendCap": {
                    "type": "integer",
                    "description": "1–10,000. Send null to remove the limit; leave it out to keep it."
                  }
                }
              },
              "example": {
                "isActive": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_seq_delete",
        "summary": "Delete a sequence",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Removes the sequence. Its active enrolments stop at once (stoppedReason: sequence_deleted). Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Sequence deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/sequences/opt-out-lines": {
      "get": {
        "operationId": "cfg_seq_optout",
        "summary": "P.S. lines",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "The fixed list of “P.S.” lines a sequence can end its emails with instead of the unsubscribe link. Send the key as optOutLine. Who: Any member. Keys today: not-relevant, not-right-time, wrong-person, prefer-not-to-receive, not-of-interest, stop-following-up, not-interested, reply-stop, wrong-person-or-time.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "P.S. lines retrieved",
                  "data": [
                    {
                      "key": "not-right-time",
                      "text": "P.S. Not the right time? Just reply \"no thanks\" and I'll stop here."
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/sequences/{id}/steps": {
      "post": {
        "operationId": "cfg_seq_step_add",
        "summary": "Add a step",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Adds one email or task step to the sequence. Returns the step. Who: Owner or manager. Conditions look only at emails sent by this enrolment; a click also counts as an open. When the condition is false the step is skipped and the next one is scheduled. Two steps on consecutive numbers with opposite conditions work as an if/else. Steps run in stepOrder. The scheduler checks for due steps every 5 minutes. Errors (400): “actionType must be one of [task, email]”; “emailSubject is required for an email step”; “taskTitle is required for a task step”; “delayDays must not be negative”; “conditionType must be one of [opened, not_opened, clicked, not_clicked]”; “Step order 2 already exists in this sequence”. Unknown sequence: 404 “Sequence not found: <id>”. Plan. Sequences are part of the Growth and Business plans. On a lower (or lapsed) plan this call returns 403 “Sequences: available from the Growth plan. Change your plan in Settings → Billing to use it.”",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Step added",
                  "data": {
                    "id": "7d8e9f0a-1b2c-4d3e-a4f5-6b7c8d9e0fa4",
                    "stepOrder": 2,
                    "delayDays": 3,
                    "actionType": "task",
                    "taskTitle": "Call if no reply",
                    "conditionType": "not_clicked",
                    "replyToPrevious": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "actionType": {
                    "type": "string",
                    "description": "email (sends an email to the contact) or task (creates a task on the contact for its owner, due that day)."
                  },
                  "stepOrder": {
                    "type": "integer",
                    "description": "The step's position. Default: after the last step. Two steps can't share a number."
                  },
                  "delayDays": {
                    "type": "integer",
                    "description": "Days to wait before this step: after enrolment for the first step, after the previous step for the others. 0 or more. Default 0."
                  },
                  "emailSubject": {
                    "type": "string",
                    "description": "Up to 255 characters. Needed for an email step."
                  },
                  "emailBody": {
                    "type": "string",
                    "description": "The email text. Can use {{variables}} such as {{firstName}}; {{firstName|there}} uses the text after | when the value is empty."
                  },
                  "taskTitle": {
                    "type": "string",
                    "description": "Up to 255 characters. Needed for a task step."
                  },
                  "taskDescription": {
                    "type": "string"
                  },
                  "conditionType": {
                    "type": "string",
                    "description": "Run this step only if: opened, not_opened, clicked or not_clicked. Leave it out to always run it."
                  },
                  "replyToPrevious": {
                    "type": "boolean",
                    "description": "Email steps: send as a reply to this enrolment's previous email (same conversation). Default false."
                  }
                },
                "required": [
                  "actionType"
                ]
              },
              "example": {
                "actionType": "task",
                "delayDays": 3,
                "taskTitle": "Call if no reply",
                "conditionType": "not_clicked"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/sequences/steps/{stepId}": {
      "put": {
        "operationId": "cfg_seq_step_update",
        "summary": "Update a step",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Send only the fields you want to change. Who: Owner or manager. Changing the email's subject or body: enrolments made by other people stop sending from those people's own mailboxes and go out from the company address instead. Errors (400): the same as add a step, plus, for an A/B half, “Move the whole step rather than one A/B arm — reorder the sequence instead” and “An A/B arm cannot change its action type — delete the variant first”; for variantPercent on a normal step, “This step has no A/B variant — add one before setting a split”. Unknown step: 404 “Step not found: <id>”. Plan. Sequences are part of the Growth and Business plans. On a lower (or lapsed) plan this call returns 403 “Sequences: available from the Growth plan. Change your plan in Settings → Billing to use it.”",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Step updated",
                  "data": {
                    "id": "7d8e9f0a-1b2c-4d3e-a4f5-6b7c8d9e0fa4",
                    "stepOrder": 2,
                    "delayDays": 2,
                    "actionType": "task",
                    "taskTitle": "Call if no reply",
                    "conditionType": "not_clicked",
                    "replyToPrevious": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "actionType": {
                    "type": "string",
                    "description": "email (sends an email to the contact) or task (creates a task on the contact for its owner, due that day)."
                  },
                  "stepOrder": {
                    "type": "integer",
                    "description": "The step's position. Two steps can't share a number."
                  },
                  "delayDays": {
                    "type": "integer",
                    "description": "Days to wait before this step: after enrolment for the first step, after the previous step for the others. 0 or more."
                  },
                  "emailSubject": {
                    "type": "string",
                    "description": "Up to 255 characters. Needed for an email step."
                  },
                  "emailBody": {
                    "type": "string",
                    "description": "The email text. Can use {{variables}} such as {{firstName}}; {{firstName|there}} uses the text after | when the value is empty."
                  },
                  "taskTitle": {
                    "type": "string",
                    "description": "Up to 255 characters. Needed for a task step."
                  },
                  "taskDescription": {
                    "type": "string"
                  },
                  "conditionType": {
                    "type": "string",
                    "description": "Run this step only if: opened, not_opened, clicked or not_clicked. Send null to make the step always run; leave it out to keep it."
                  },
                  "replyToPrevious": {
                    "type": "boolean",
                    "description": "Email steps: send as a reply to this enrolment's previous email (same conversation)."
                  },
                  "variantPercent": {
                    "type": "integer",
                    "description": "1–99. Only for a step that is one half of an A/B test (set up in the app); the other half gets the rest of 100."
                  }
                }
              },
              "example": {
                "delayDays": 2
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_seq_step_delete",
        "summary": "Delete a step",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Removes the step. Contacts waiting on it move on to the next step. Who: Owner or manager.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Step deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/sequences/{id}/steps/reorder": {
      "put": {
        "operationId": "cfg_seq_steps_reorder",
        "summary": "Reorder steps",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Renumbers the steps 1, 2, 3 … in the order you list them. Returns the steps. Who: Owner or manager. A list that misses a step, repeats one or has a foreign id: 400 “orderedStepIds must list every step of this sequence exactly once”. Plan. Sequences are part of the Growth and Business plans. On a lower (or lapsed) plan this call returns 403 “Sequences: available from the Growth plan. Change your plan in Settings → Billing to use it.”",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Steps reordered",
                  "data": [
                    {
                      "id": "7d8e9f0a-1b2c-4d3e-a4f5-6b7c8d9e0fa4",
                      "stepOrder": 1,
                      "delayDays": 3,
                      "actionType": "task",
                      "taskTitle": "Call if no reply",
                      "conditionType": "not_clicked",
                      "replyToPrevious": false
                    },
                    {
                      "id": "6c7d8e9f-0a1b-4c2d-9e3f-4a5b6c7d8e93",
                      "stepOrder": 2,
                      "delayDays": 0,
                      "actionType": "email",
                      "emailSubject": "Quick question, {{firstName}}",
                      "emailBody": "Hi {{firstName|there}}, …",
                      "replyToPrevious": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orderedStepIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "Every step id of this sequence, each once, in the new order."
                  }
                },
                "required": [
                  "orderedStepIds"
                ]
              },
              "example": {
                "orderedStepIds": [
                  "7d8e9f0a-1b2c-4d3e-a4f5-6b7c8d9e0fa4",
                  "6c7d8e9f-0a1b-4c2d-9e3f-4a5b6c7d8e93"
                ]
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/sequences/run-due": {
      "post": {
        "operationId": "cfg_seq_run_due",
        "summary": "Run due steps now",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Runs your organisation's due steps now instead of waiting for the next 5-minute pass. Handy for testing a new sequence. No body. Who: Owner or manager. processed = due enrolments looked at; executed = steps that actually ran (an email handed to the provider or a task created). Plan. Sequences are part of the Growth and Business plans. On a lower (or lapsed) plan this call returns 403 “Sequences: available from the Growth plan. Change your plan in Settings → Billing to use it.”",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Processed 2 due enrollment(s); ran 1 step(s)",
                  "data": {
                    "processed": 2,
                    "executed": 1
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/sequence-enrollments": {
      "get": {
        "operationId": "cfg_enrol_list",
        "summary": "List enrolments",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Enrolments of one contact, or everyone enrolled in one sequence. Newest first. Not paged. Who: Any member. Send exactly one of the two, else 400 “Supply exactly one of contactId or sequenceId”. status: active, completed or stopped. A stopped one has stoppedReason, e.g. manual, sequence_deleted, contact_deleted, converted, not_interested, bounced, marked_spam or send_failed. lastError says why a step last failed. enrolledVia: manual, automation (a stage or score automation) or list.",
        "parameters": [
          {
            "name": "contactId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "A contact's enrolments in any sequence."
          },
          {
            "name": "sequenceId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Everyone in this sequence. Rows then also carry contactName and contactEmail."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Enrollments retrieved",
                  "data": [
                    {
                      "id": "8e9f0a1b-2c3d-4e4f-b5a6-7c8d9e0f1ab5",
                      "sequenceId": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82",
                      "contactId": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                      "status": "active",
                      "currentStepOrder": 1,
                      "nextActionAt": "2026-11-07T23:29:11.057166Z",
                      "enrolledAt": "2026-11-07T23:29:11.057166Z",
                      "attemptCount": 0,
                      "contactName": "Lena Schmidt",
                      "contactEmail": "lena@example.com",
                      "enrolledVia": "manual"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_enrol_one",
        "summary": "Enrol a contact",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Puts one contact into a sequence. Its first step is due after the first step's delayDays. Who: Owner, manager or executive. Who can be enrolled. Not a customer (lifecycleStage or contactType customer), not marked not_interested, not erased. If the sequence has an email step, the contact also needs an email address, must not be unsubscribed or suppressed, and needs marketing permission. Errors (400): “Cannot enroll into an inactive sequence”; “Sequence has no steps”; “Unknown contact: <id>”; “That contact is already enrolled in this sequence”; “That contact is already a customer — sequences target prospects.”; “That contact is marked Not interested, so they can't be enrolled.”; “That contact's data was erased, so they can't be enrolled.”; “This sequence sends email, but that contact has no email address.”; “That contact has unsubscribed or been suppressed and cannot be emailed.”; “That contact hasn't given marketing permission, so this sequence can't email them.” Unknown sequence: 404 “Sequence not found: <id>”. Plan. Sequences are part of the Growth and Business plans. On a lower (or lapsed) plan this call returns 403 “Sequences: available from the Growth plan. Change your plan in Settings → Billing to use it.”",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Contact enrolled",
                  "data": {
                    "id": "8e9f0a1b-2c3d-4e4f-b5a6-7c8d9e0f1ab5",
                    "sequenceId": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82",
                    "contactId": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                    "status": "active",
                    "currentStepOrder": 1,
                    "nextActionAt": "2026-11-07T23:29:11.057166Z",
                    "enrolledAt": "2026-11-07T23:29:11.057166Z",
                    "attemptCount": 0,
                    "contactName": "Lena Schmidt",
                    "contactEmail": "lena@example.com"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sequenceId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "An active sequence with at least one step."
                  },
                  "contactId": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "sequenceId",
                  "contactId"
                ]
              },
              "example": {
                "sequenceId": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82",
                "contactId": "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/sequence-enrollments/bulk": {
      "post": {
        "operationId": "cfg_enrol_bulk",
        "summary": "Enrol many contacts",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Enrols up to 100 contacts in one sequence. Contacts that can't be enrolled are skipped and listed; the rest still go in. Who: Owner, manager or executive. Skip reason: already_enrolled, unknown_contact, converted, not_interested, erased, no_email, suppressed or no_permission — the same checks as enrol a contact. More than 100 ids: 400 “Validation failed” (“Enroll at most 100 contacts per request”). An inactive, empty or unknown sequence fails the whole call, as for a single enrolment. Plan. Sequences are part of the Growth and Business plans. On a lower (or lapsed) plan this call returns 403 “Sequences: available from the Growth plan. Change your plan in Settings → Billing to use it.”",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "1 contact(s) enrolled, 1 skipped",
                  "data": {
                    "enrolled": 1,
                    "skipped": 1,
                    "skippedContacts": [
                      {
                        "contactId": "e5f6a7b8-c9d0-4e1f-82a3-4d5e6f7a8b1b",
                        "reason": "no_email"
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sequenceId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "An active sequence with at least one step."
                  },
                  "contactIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "1–100 contact ids. Repeats are counted once."
                  }
                },
                "required": [
                  "sequenceId",
                  "contactIds"
                ]
              },
              "example": {
                "sequenceId": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82",
                "contactIds": [
                  "0f3a6b9c-1d2e-4f5a-8b7c-6d5e4f3a2b1c",
                  "e5f6a7b8-c9d0-4e1f-82a3-4d5e6f7a8b1b"
                ]
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/sequence-enrollments/{id}": {
      "delete": {
        "operationId": "cfg_enrol_stop",
        "summary": "Stop an enrolment",
        "tags": [
          "Configure: Sequences"
        ],
        "description": "Takes the contact out of the sequence: no more steps run. The enrolment stays in the list as stopped with stoppedReason manual. Who: Owner, manager or executive. Only an active enrolment can be stopped: 400 “Only an active enrolment can be stopped — this one is completed” (or stopped). Unknown id: 404 “Enrollment not found: <id>”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Enrollment stopped"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/stage-automations": {
      "get": {
        "operationId": "cfg_stage_autos_list",
        "summary": "List stage automations",
        "tags": [
          "Configure: Stage automations"
        ],
        "description": "Actions that run when a deal enters a pipeline stage. Oldest first. Not paged. Who: Owner or manager. firedCount = how many times the action actually happened; lastFiredAt is missing until then.",
        "parameters": [
          {
            "name": "stageId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Only this stage's automations."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Stage automations retrieved",
                  "data": [
                    {
                      "id": "9f0a1b2c-3d4e-4f5a-86b7-8d9e0f1a2bc6",
                      "stageId": "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                      "stageName": "Qualified",
                      "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                      "actionType": "enroll_sequence",
                      "targetId": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82",
                      "targetName": "New website leads",
                      "isEnabled": true,
                      "firedCount": 0,
                      "createdAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_stage_autos_create",
        "summary": "Create a stage automation",
        "tags": [
          "Configure: Stage automations"
        ],
        "description": "“When a deal enters this stage, do this for the deal's main contact.” Who: Owner or manager. It acts on the deal's contactId; a deal with no contact is skipped. enroll_sequence uses the same checks as bulk enrol and is skipped (not an error) on a plan without Sequences. send_email_template goes from the company address and needs no marketing permission, but never to someone with no address, who unsubscribed or was erased. send_whatsapp_template needs a WhatsApp connection and the contact's WhatsApp permission. It runs once, when a deal moves into the stage (or is created in it). Deals already in the stage are not touched — use run for deals already in the stage. Errors (400): “actionType must be one of [enroll_sequence, send_whatsapp_template, send_email_template]”; “Stage not found in your organisation.”; “Stage automations are available for Sales pipelines only.”; “Automation target not found in your organisation.”; “This automation is already mapped to the stage.”",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Stage automation created",
                  "data": {
                    "id": "9f0a1b2c-3d4e-4f5a-86b7-8d9e0f1a2bc6",
                    "stageId": "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                    "stageName": "Qualified",
                    "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                    "actionType": "enroll_sequence",
                    "targetId": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82",
                    "targetName": "New website leads",
                    "isEnabled": true,
                    "firedCount": 0,
                    "createdAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "stageId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A stage of one of your Sales pipelines."
                  },
                  "actionType": {
                    "type": "string",
                    "description": "enroll_sequence, send_whatsapp_template or send_email_template."
                  },
                  "targetId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The sequence, WhatsApp template or email template to use. It must be in your organisation."
                  },
                  "isEnabled": {
                    "type": "boolean",
                    "description": "Default true."
                  }
                },
                "required": [
                  "stageId",
                  "actionType",
                  "targetId"
                ]
              },
              "example": {
                "stageId": "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                "actionType": "enroll_sequence",
                "targetId": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82"
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/stage-automations/{id}": {
      "put": {
        "operationId": "cfg_stage_autos_update",
        "summary": "Switch a stage automation on or off",
        "tags": [
          "Configure: Stage automations"
        ],
        "description": "Only isEnabled can change. To change the stage, action or target, delete it and create a new one. Who: Owner or manager. Unknown id: 404 “Stage automation not found: <id>”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Stage automation updated",
                  "data": {
                    "id": "9f0a1b2c-3d4e-4f5a-86b7-8d9e0f1a2bc6",
                    "stageId": "66f3bc09-0000-4156-bb00-dd1f2ca60e97",
                    "stageName": "Qualified",
                    "pipelineId": "1e2d3c4b-5a69-4788-9a0b-c1d2e3f4a5b6",
                    "actionType": "enroll_sequence",
                    "targetId": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c82",
                    "targetName": "New website leads",
                    "isEnabled": false,
                    "firedCount": 0,
                    "createdAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "isEnabled": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "isEnabled": false
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_stage_autos_delete",
        "summary": "Delete a stage automation",
        "tags": [
          "Configure: Stage automations"
        ],
        "description": "Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Stage automation removed"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/stage-automations/{id}/run": {
      "post": {
        "operationId": "cfg_stage_autos_run",
        "summary": "Run for deals already in the stage",
        "tags": [
          "Configure: Stage automations"
        ],
        "description": "Runs this automation for the open deals now in its stage, oldest first. No body. Who: Owner or manager. At most 200 deals per call, always the 200 oldest — calling again does not continue past them. totalInStage tells you if there are more. A run does not remember earlier runs: a template email or WhatsApp message goes again to every deal it reaches. (Enrolling is safe to repeat: an enrolled contact is skipped.) skipped = deals where nothing happened (no contact, no address or number, no permission, already enrolled, …). A disabled automation: 400 “Enable the automation before running it.”",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Stage automation run complete",
                  "data": {
                    "totalInStage": 3,
                    "attempted": 3,
                    "fired": 2,
                    "skipped": 1
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/contact-date-campaigns": {
      "get": {
        "operationId": "cfg_greetings_list",
        "summary": "List greetings",
        "tags": [
          "Configure: Greetings"
        ],
        "description": "Your birthday and work-anniversary greetings, newest first. Not paged. Who: Any member. contactListId is missing when the greeting goes to everyone with marketing permission.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Greeting campaigns",
                  "data": [
                    {
                      "id": "b1c2d3e4-f5a6-4b7c-88d9-0f1a2b3c4de8",
                      "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                      "name": "Birthday wishes",
                      "occasion": "birthday",
                      "subject": "Happy birthday, {{firstName}}!",
                      "htmlBody": "<p>Hi {{firstName}}, all the best for your day!</p>",
                      "sendTime": "09:00:00",
                      "sendTimezone": "Europe/Berlin",
                      "useContactTimezone": true,
                      "isEnabled": true,
                      "createdAt": "2026-11-07T23:29:11.057166Z",
                      "updatedAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "cfg_greetings_create",
        "summary": "Create a greeting",
        "tags": [
          "Configure: Greetings"
        ],
        "description": "An email sent automatically on each contact's birthday or work anniversary. Who: Owner or manager. Who gets it. Contacts with the date set, an email address, marketing permission (consentMarketing true), and not unsubscribed or erased. Each contact gets one per year. A 29 February date is greeted on 1 March in other years. It goes out at or after sendTime on the day, sent as whoever saved the greeting last (their connected mailbox, the company mailbox, or your Email Sender). Only one greeting per occasion can be on: 400 “\"Birthday wishes\" is already the enabled birthday greeting. Disable it before enabling another.” Switching it on needs a role that can see every Sales contact: 403 “This greeting goes to every contact with marketing permission, including ones you can't see. Only someone who can see every contact can save it while it's on — switch it off, or ask a manager.” (with a list: “This list includes contacts you can't see. Ask a manager to send to it.”). Other errors (400): “Occasion must be one of [birthday, work_anniversary] but was '…'” (the order of the two may vary); “Send time must be 23:45 or earlier. …”; “Send timezone must be a region name such as 'Asia/Kolkata' or 'UTC', not a fixed offset — an offset cannot follow daylight saving.”; “Unknown timezone '…'”; “The selected contact list no longer exists.”",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Greeting campaign created",
                  "data": {
                    "id": "b1c2d3e4-f5a6-4b7c-88d9-0f1a2b3c4de8",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "name": "Birthday wishes",
                    "occasion": "birthday",
                    "subject": "Happy birthday, {{firstName}}!",
                    "htmlBody": "<p>Hi {{firstName}}, all the best for your day!</p>",
                    "sendTime": "09:00:00",
                    "sendTimezone": "Europe/Berlin",
                    "useContactTimezone": true,
                    "isEnabled": true,
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 200 characters."
                  },
                  "occasion": {
                    "type": "string",
                    "description": "birthday (uses the contact's dateOfBirth) or work_anniversary (uses workAnniversary). Can't be changed later."
                  },
                  "subject": {
                    "type": "string",
                    "description": "Up to 500 characters. Can use {{variables}}."
                  },
                  "htmlBody": {
                    "type": "string",
                    "description": "The email, in HTML. Can use {{variables}}, including {{years}}."
                  },
                  "sendTime": {
                    "type": "string",
                    "description": "Local time HH:mm, 23:45 at the latest. Default 09:00. Greetings go out on the quarter-hour."
                  },
                  "sendTimezone": {
                    "type": "string",
                    "description": "An IANA zone name such as Europe/Berlin (not a fixed offset). Default: your organisation's time zone (else UTC)."
                  },
                  "useContactTimezone": {
                    "type": "boolean",
                    "description": "Default false. True: use each contact's own timezone when set, else sendTimezone."
                  },
                  "contactListId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Greet only this contact list's members. Leave it out to greet everyone with marketing permission."
                  },
                  "isEnabled": {
                    "type": "boolean",
                    "description": "Default false: a new greeting is off until you switch it on."
                  }
                },
                "required": [
                  "name",
                  "occasion",
                  "subject",
                  "htmlBody"
                ]
              },
              "example": {
                "name": "Birthday wishes",
                "occasion": "birthday",
                "subject": "Happy birthday, {{firstName}}!",
                "htmlBody": "<p>Hi {{firstName}}, all the best for your day!</p>",
                "sendTime": "09:00",
                "sendTimezone": "Europe/Berlin",
                "useContactTimezone": true,
                "isEnabled": true
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/contact-date-campaigns/{id}": {
      "get": {
        "operationId": "cfg_greetings_get",
        "summary": "Get a greeting",
        "tags": [
          "Configure: Greetings"
        ],
        "description": "Unknown id: 404 “Greeting campaign not found: <id>”. Who: Any member.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Greeting campaign",
                  "data": {
                    "id": "b1c2d3e4-f5a6-4b7c-88d9-0f1a2b3c4de8",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "name": "Birthday wishes",
                    "occasion": "birthday",
                    "subject": "Happy birthday, {{firstName}}!",
                    "htmlBody": "<p>Hi {{firstName}}, all the best for your day!</p>",
                    "sendTime": "09:00:00",
                    "sendTimezone": "Europe/Berlin",
                    "useContactTimezone": true,
                    "isEnabled": true,
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "cfg_greetings_update",
        "summary": "Update a greeting",
        "tags": [
          "Configure: Greetings"
        ],
        "description": "Send only the fields you want to change. occasion can't be changed: delete and create a new one. Who: Owner or manager. name, subject and htmlBody can't be blank: 400 “Validation failed” (“Name cannot be blank”, “Subject cannot be blank”, “Message body cannot be blank”). Whoever saves a greeting becomes the person it is sent as. Saving one that stays on needs a role that can see every Sales contact (403, as on create); switching it off does not.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Greeting campaign updated",
                  "data": {
                    "id": "b1c2d3e4-f5a6-4b7c-88d9-0f1a2b3c4de8",
                    "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                    "name": "Birthday wishes",
                    "occasion": "birthday",
                    "subject": "Happy birthday, {{firstName}}!",
                    "htmlBody": "<p>Hi {{firstName}}, all the best for your day!</p>",
                    "sendTime": "08:30:00",
                    "sendTimezone": "Europe/Berlin",
                    "useContactTimezone": true,
                    "isEnabled": true,
                    "createdAt": "2026-11-07T23:29:11.057166Z",
                    "updatedAt": "2026-11-07T23:29:11.057166Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 200 characters."
                  },
                  "subject": {
                    "type": "string",
                    "description": "Up to 500 characters. Can use {{variables}}."
                  },
                  "htmlBody": {
                    "type": "string",
                    "description": "The email, in HTML. Can use {{variables}}, including {{years}}."
                  },
                  "sendTime": {
                    "type": "string",
                    "description": "Local time HH:mm, 23:45 at the latest. Greetings go out on the quarter-hour."
                  },
                  "sendTimezone": {
                    "type": "string",
                    "description": "An IANA zone name such as Europe/Berlin (not a fixed offset)."
                  },
                  "useContactTimezone": {
                    "type": "boolean",
                    "description": "Default false. True: use each contact's own timezone when set, else sendTimezone."
                  },
                  "contactListId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Greet only this contact list's members."
                  },
                  "everyone": {
                    "type": "boolean",
                    "description": "true drops the contact list: greet everyone with marketing permission."
                  },
                  "isEnabled": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "sendTime": "08:30"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cfg_greetings_delete",
        "summary": "Delete a greeting",
        "tags": [
          "Configure: Greetings"
        ],
        "description": "Removes the greeting; it never sends again. Who: Owner or manager.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Greeting campaign deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales/contact-date-campaigns/{id}/failures": {
      "get": {
        "operationId": "cfg_greetings_failures",
        "summary": "Greetings that didn't go out",
        "tags": [
          "Configure: Greetings"
        ],
        "description": "Greetings this campaign tried to send and could not, newest first. Who: Owner, manager, executive or staff. outcome: failed (nothing went out) or unconfirmed (the mail server never confirmed it — it may have arrived, and was not sent again). reason is the provider's answer, with anything that looks like a password or key removed. A failed contact counts as greeted for this year; fix the address and send by hand if needed.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "1–100. Default 20."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Greeting failures",
                  "data": [
                    {
                      "email": "old@example.com",
                      "subject": "Happy birthday, Lena!",
                      "attemptedAt": "2026-11-07T23:29:11.057166Z",
                      "reason": "550 Mailbox not found",
                      "outcome": "failed"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/webhook-subscriptions": {
      "get": {
        "operationId": "cfg_hooks_list",
        "summary": "List webhook subscriptions",
        "tags": [
          "Configure: Webhook subscriptions"
        ],
        "description": "The addresses your organisation sends webhooks to, newest first. Not paged. The signing secret is never returned — hasSecret says one is set. Who: Owner or manager. A subscription with no templateSlug receives events from every module. Another templateSlug: 400 “templateSlug must be one of sales-crm, service-crm, interior-crm or nutrition-crm (or \"\" for every module)”. Adding, changing and deleting subscriptions needs a signed-in owner: an API key gets 403 “API keys can't do this — sign in to change it.”",
        "parameters": [
          {
            "name": "templateSlug",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "sales-crm, service-crm, interior-crm or nutrition-crm: that module's subscriptions plus the all-module ones. Leave it out for all."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Subscriptions retrieved",
                  "data": [
                    {
                      "id": "c3d4e5f6-a7b8-4c9d-a0e1-2b3c4d5e6ff9",
                      "organizationId": "8d0c2f4e-6a1b-4c3d-9e8f-0a1b2c3d4e5f",
                      "templateSlug": "sales-crm",
                      "eventTypes": [
                        "deal.created",
                        "deal.won"
                      ],
                      "targetUrl": "https://your-system.example.com/verdeshell",
                      "hasSecret": true,
                      "enabled": true,
                      "createdAt": "2026-11-07T23:29:11.057166Z",
                      "updatedAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/webhook-subscriptions/{id}/deliveries": {
      "get": {
        "operationId": "cfg_hooks_deliveries",
        "summary": "Recent deliveries",
        "tags": [
          "Configure: Webhook subscriptions"
        ],
        "description": "The subscription's last 50 deliveries, newest first. The payload is never included. Who: Owner or manager. status: pending, success or failed. A failed one with nextRetryAt will be tried again. responseCode is your server's HTTP answer; lastError is a cleaned-up error text. Unknown id: 404 “Webhook subscription not found: <id>”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Deliveries retrieved",
                  "data": [
                    {
                      "id": "d4e5f6a7-b8c9-4d0e-b1f2-3c4d5e6f7a0a",
                      "subscriptionId": "c3d4e5f6-a7b8-4c9d-a0e1-2b3c4d5e6ff9",
                      "eventType": "deal.won",
                      "status": "success",
                      "attempts": 1,
                      "responseCode": 200,
                      "createdAt": "2026-11-07T23:29:11.057166Z",
                      "deliveredAt": "2026-11-07T23:29:11.057166Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/webhook-subscriptions/run-due": {
      "post": {
        "operationId": "cfg_hooks_run_due",
        "summary": "Send due deliveries now",
        "tags": [
          "Configure: Webhook subscriptions"
        ],
        "description": "Sends your organisation's waiting deliveries (new ones and due retries) now, instead of on the next scheduled pass. Up to 25 per call. No body. Who: Owner only. processed = deliveries tried in this call. more is 1 when more are waiting — call again — else 0. Handy for testing your receiver. The scheduled pass runs every 30 seconds anyway.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Deliveries processed",
                  "data": {
                    "processed": 1,
                    "more": 0
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Rate limit: wait the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the allowance resets"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "Envelope": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "SUCCESS",
              "ERROR"
            ]
          },
          "message": {
            "type": "string"
          },
          "data": {}
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Envelope"
            }
          }
        }
      }
    }
  }
}