{
  "openapi": "3.1.0",
  "info": {
    "title": "Eloout API",
    "version": "1.1.1",
    "description": "The Eloout public REST API. Authenticate with an organization API key (`Authorization: Bearer elo_…`) created in Settings → API keys.\n\n**Permissions.** Each operation needs one permission, listed in `x-eloout-required-scopes`; reading and writing are separate. A key without it gets 403 `FORBIDDEN` with `details.requiredScope`. `GET /me` reports a key's effective permissions. For the MCP server, create a key with exactly: `opportunities:read`, `pipelines:read`, `lists:read`, `records:read`.\n\n**Limits.** 120 requests per 60 s per key and 300 per 60 s per organization; 20 failed authentications per 10 min per client IP. Bodies up to 1048576 bytes.\n\n**Text limits.** Request strings are trimmed before they are checked: a length limit applies to the trimmed value, and the schemas express it as a `pattern` over that value. Lengths count Unicode characters (code points), as JSON Schema does.\n\n**Writes.** With `Idempotency-Key`, a retry of the same request with the same API key within 24 h gets the stored answer instead of running again; answers of 500 and above are not stored. `?dryRun=true` plans a write and changes nothing. Both only where listed.\n\n**Changelog.**\n- 1.1.1: descriptions corrected to match the server, no behaviour change. `X-RateLimit-Reset` is the number of seconds until the window resets, not a Unix time; the `X-RateLimit-*` headers come only on answers to an authenticated key; `Idempotency-Key` is 1–255 printable ASCII characters without spaces, and answers of 500 and above are not stored, so a retry after one runs the write again.\n- 1.1.0 (ELO-33): every operation requires a per-resource permission (`x-eloout-required-scopes`); `lists:write` is retired in favour of `records:write`; record endpoints need `records:read` / `records:write` instead of `lists:read` / `lists:write`; `GET /me` reports effective permissions and the `legacy` flag and no longer returns the key prefix. Keys created before this release were migrated to explicit permissions matching their previous access.\n- 1.0.0: first published contract of the existing `/api/v1` (opportunities, pipelines, custom fields, lists, records, webhooks)."
  },
  "servers": [
    {
      "url": "https://app.eloout.com/api/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Account"
    },
    {
      "name": "Catalog",
      "description": "Pipelines and opportunity custom fields (read only)."
    },
    {
      "name": "Opportunities"
    },
    {
      "name": "Lists",
      "description": "List metadata (read only)."
    },
    {
      "name": "Records",
      "description": "Records of a list."
    },
    {
      "name": "Webhooks",
      "description": "Outbound webhook subscriptions."
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "operationId": "getMe",
        "summary": "Get the organization and permissions of the calling key",
        "description": "Any valid key may call it. Use it to check a key and its effective permissions before calling anything else. Returns no credential material.\n\nRequires a valid key; no permission.",
        "tags": [
          "Account"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Me"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "organization": {
                          "id": "6f1d2c3b-4a59-4e6f-8a7b-9c0d1e2f3a4b",
                          "name": "Acme"
                        },
                        "apiKey": {
                          "id": "f5e6f7a8-9b0c-4e1f-8a3b-4c5d6e7f8a9b",
                          "name": "MCP read only",
                          "scopes": [
                            "opportunities:read",
                            "pipelines:read",
                            "lists:read",
                            "records:read"
                          ],
                          "legacy": false
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/pipelines": {
      "get": {
        "operationId": "listPipelines",
        "summary": "List pipelines and their stages",
        "description": "Requires the `pipelines:read` permission.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "pipelines:read"
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PipelineCollection"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "pipelines": [
                          {
                            "id": "0b6c1e2d-3f4a-4b5c-8d6e-7f8091a2b3c4",
                            "name": "Sales",
                            "opportunityType": {
                              "id": "a6f7a8b9-0c1d-4f2a-9b4c-5d6e7f8a9b0c",
                              "name": "Sale"
                            },
                            "stages": [
                              {
                                "id": "1c2d3e4f-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
                                "name": "Proposal",
                                "order": 0,
                                "kind": "open"
                              },
                              {
                                "id": "2d3e4f5a-6b7c-4d8e-9f0a-1b2c3d4e5f6a",
                                "name": "Won",
                                "order": 1,
                                "kind": "won"
                              }
                            ]
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/custom-fields": {
      "get": {
        "operationId": "listCustomFields",
        "summary": "List opportunity custom fields",
        "description": "Requires the `custom-fields:read` permission.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "custom-fields:read"
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/CustomFieldCollection"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "customFields": [
                          {
                            "id": "3e4f5a6b-7c8d-4e9f-8a1b-2c3d4e5f6a7b",
                            "name": "Payment term (days)",
                            "type": "number",
                            "entity": "opportunity",
                            "required": false,
                            "options": []
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/opportunities": {
      "get": {
        "operationId": "listOpportunities",
        "summary": "List opportunities",
        "description": "Cursor pages ordered by last change, oldest first: an item changed while you page is seen again, never skipped.\n\nRequires the `opportunities:read` permission.",
        "tags": [
          "Opportunities"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "opportunities:read"
        ],
        "parameters": [
          {
            "in": "query",
            "required": false,
            "name": "limit",
            "description": "Page size, 1–100 (default 50).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "cursor",
            "description": "The `nextCursor` of the previous page. Opaque; only valid with the same filters and key's organization.",
            "schema": {
              "type": "string",
              "maxLength": 500
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "filter[pipelineId]",
            "description": "Only opportunities of this pipeline.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "filter[stageId]",
            "description": "Only opportunities in this stage.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "filter[source]",
            "description": "Deprecated (ELO-8): source names are no longer stored.",
            "schema": {
              "type": "string",
              "maxLength": 120
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "filter[externalId]",
            "description": "Only the opportunity with this external ID.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "filter[updatedSince]",
            "description": "Only items changed at or after this ISO 8601 date or date-time.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/OpportunityPage"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "opportunities": [
                          {
                            "id": "4f5a6b7c-8d9e-4f0a-9b2c-3d4e5f6a7b8c",
                            "title": "Annual plan — Acme",
                            "value": "1250000.00",
                            "discount": null,
                            "currency": "COP",
                            "pipeline": {
                              "id": "0b6c1e2d-3f4a-4b5c-8d6e-7f8091a2b3c4",
                              "name": "Sales"
                            },
                            "stage": {
                              "id": "1c2d3e4f-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
                              "name": "Proposal",
                              "kind": "open"
                            },
                            "contact": {
                              "id": "c2b3c4d5-6e7f-4b8c-9d0e-1f2a3b4c5d6e",
                              "name": "Ana Pérez",
                              "phone": "+573001234567"
                            },
                            "client": {
                              "id": "d3c4d5e6-7f8a-4c9d-8e1f-2a3b4c5d6e7f",
                              "name": "Acme S.A.S.",
                              "taxId": "900123456"
                            },
                            "externalId": "ERP-1001",
                            "externalKeys": [
                              {
                                "source": null,
                                "externalId": "ERP-1001"
                              }
                            ],
                            "customFields": {
                              "3e4f5a6b-7c8d-4e9f-8a1b-2c3d4e5f6a7b": 30
                            },
                            "closedAt": null,
                            "createdAt": "2026-11-20T15:04:05.000Z",
                            "updatedAt": "2026-12-01T10:00:00.000Z"
                          }
                        ],
                        "nextCursor": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/opportunities/{id}": {
      "get": {
        "operationId": "getOpportunity",
        "summary": "Get an opportunity",
        "description": "Requires the `opportunities:read` permission.",
        "tags": [
          "Opportunities"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "opportunities:read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Opportunity"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "4f5a6b7c-8d9e-4f0a-9b2c-3d4e5f6a7b8c",
                        "title": "Annual plan — Acme",
                        "value": "1250000.00",
                        "discount": null,
                        "currency": "COP",
                        "pipeline": {
                          "id": "0b6c1e2d-3f4a-4b5c-8d6e-7f8091a2b3c4",
                          "name": "Sales"
                        },
                        "stage": {
                          "id": "1c2d3e4f-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
                          "name": "Proposal",
                          "kind": "open"
                        },
                        "contact": {
                          "id": "c2b3c4d5-6e7f-4b8c-9d0e-1f2a3b4c5d6e",
                          "name": "Ana Pérez",
                          "phone": "+573001234567"
                        },
                        "client": {
                          "id": "d3c4d5e6-7f8a-4c9d-8e1f-2a3b4c5d6e7f",
                          "name": "Acme S.A.S.",
                          "taxId": "900123456"
                        },
                        "externalId": "ERP-1001",
                        "externalKeys": [
                          {
                            "source": null,
                            "externalId": "ERP-1001"
                          }
                        ],
                        "customFields": {
                          "3e4f5a6b-7c8d-4e9f-8a1b-2c3d4e5f6a7b": 30
                        },
                        "closedAt": null,
                        "createdAt": "2026-11-20T15:04:05.000Z",
                        "updatedAt": "2026-12-01T10:00:00.000Z"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "updateOpportunity",
        "summary": "Update an opportunity",
        "description": "Moving to a WON stage marks the deal won. A value a person owns is never overwritten.\n\nRequires the `opportunities:write` permission.",
        "tags": [
          "Opportunities"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "opportunities:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DryRun"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpportunityPatchBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/OpportunityWriteResult"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "4f5a6b7c-8d9e-4f0a-9b2c-3d4e5f6a7b8c",
                        "result": "updated",
                        "stageId": "2d3e4f5a-6b7c-4d8e-9f0a-1b2c3d4e5f6a",
                        "stageChange": {
                          "fromStageId": "1c2d3e4f-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
                          "toStageId": "2d3e4f5a-6b7c-4d8e-9f0a-1b2c3d4e5f6a"
                        },
                        "protectedFields": []
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/opportunities/external/{source}/{externalId}": {
      "put": {
        "operationId": "upsertOpportunityByExternalId",
        "summary": "Create or update an opportunity by external ID",
        "description": "Requires the `opportunities:write` permission.",
        "tags": [
          "Opportunities"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "opportunities:write"
        ],
        "parameters": [
          {
            "name": "source",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Ignored since ELO-8; any non-empty value."
          },
          {
            "name": "externalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DryRun"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpportunityUpsertBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated, unchanged, frozen, or a dry run.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/OpportunityWriteResult"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "4f5a6b7c-8d9e-4f0a-9b2c-3d4e5f6a7b8c",
                        "result": "created",
                        "stageId": "1c2d3e4f-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
                        "stageChange": null,
                        "protectedFields": []
                      }
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Created.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/OpportunityWriteResult"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "4f5a6b7c-8d9e-4f0a-9b2c-3d4e5f6a7b8c",
                        "result": "created",
                        "stageId": "1c2d3e4f-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
                        "stageChange": null,
                        "protectedFields": []
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/opportunities/batch-upsert": {
      "post": {
        "operationId": "batchUpsertOpportunities",
        "summary": "Create or update up to 50 opportunities by external ID",
        "description": "Each item is validated and runs in its own transaction, and gets its own result (`ok`, `status`, `data` or `error`); a failing or invalid item never rolls back or fails the others, and the request as a whole answers 200. A body that is not `{ items: [1–50 items] }` is a 422 for the whole request, like the other request-level 422s (for example an invalid `dryRun` or a reused `Idempotency-Key`).\n\nRequires the `opportunities:write` permission.",
        "tags": [
          "Opportunities"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "opportunities:write"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DryRun"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpportunityBatchBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/OpportunityBatchResult"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "results": [
                          {
                            "ok": true,
                            "status": 201,
                            "data": {
                              "id": "4f5a6b7c-8d9e-4f0a-9b2c-3d4e5f6a7b8c",
                              "result": "created",
                              "stageId": "1c2d3e4f-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
                              "stageChange": null,
                              "protectedFields": []
                            }
                          },
                          {
                            "ok": false,
                            "status": 422,
                            "error": {
                              "code": "VALIDATION_ERROR",
                              "message": "The request is not valid",
                              "details": {
                                "fieldErrors": {
                                  "pipelineId": [
                                    "Required"
                                  ]
                                }
                              }
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists": {
      "get": {
        "operationId": "listLists",
        "summary": "List the organization's lists",
        "description": "Requires the `lists:read` permission.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "lists:read"
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ListCollection"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "lists": [
                          {
                            "id": "5a6b7c8d-9e0f-4a1b-8c3d-4e5f6a7b8c9d",
                            "name": "Invoices",
                            "codePrefix": "FA",
                            "columns": [
                              {
                                "id": "6b7c8d9e-0f1a-4b2c-9d4e-5f6a7b8c9d0e",
                                "name": "Amount",
                                "type": "number",
                                "required": false,
                                "options": [],
                                "relation": null
                              }
                            ],
                            "pipeline": {
                              "id": "e4d5e6f7-8a9b-4d0e-9f2a-3b4c5d6e7f8a",
                              "name": "Collection",
                              "stages": [
                                {
                                  "id": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f",
                                  "name": "Due",
                                  "order": 0,
                                  "kind": "OPEN"
                                }
                              ]
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{listId}": {
      "get": {
        "operationId": "getList",
        "summary": "Get a list",
        "description": "Requires the `lists:read` permission.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "lists:read"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/List"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "5a6b7c8d-9e0f-4a1b-8c3d-4e5f6a7b8c9d",
                        "name": "Invoices",
                        "codePrefix": "FA",
                        "columns": [
                          {
                            "id": "6b7c8d9e-0f1a-4b2c-9d4e-5f6a7b8c9d0e",
                            "name": "Amount",
                            "type": "number",
                            "required": false,
                            "options": [],
                            "relation": null
                          }
                        ],
                        "pipeline": {
                          "id": "e4d5e6f7-8a9b-4d0e-9f2a-3b4c5d6e7f8a",
                          "name": "Collection",
                          "stages": [
                            {
                              "id": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f",
                              "name": "Due",
                              "order": 0,
                              "kind": "OPEN"
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{listId}/records": {
      "get": {
        "operationId": "listListRecords",
        "summary": "List a list's records",
        "description": "Needs only `records:read`: an integration that already knows the list id does not need `lists:read`.\n\nRequires the `records:read` permission.",
        "tags": [
          "Records"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "records:read"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "limit",
            "description": "Page size, 1–100 (default 50).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "cursor",
            "description": "The `nextCursor` of the previous page. Opaque; only valid with the same filters and key's organization.",
            "schema": {
              "type": "string",
              "maxLength": 500
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "filter[stage]",
            "description": "A stage of the list's pipeline, by id or by name.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "filter[updatedSince]",
            "description": "Only items changed at or after this ISO 8601 date or date-time.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ListRecordPage"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "records": [
                          {
                            "id": "8d9e0f1a-2b3c-4d4e-9f6a-7b8c9d0e1f2a",
                            "listId": "5a6b7c8d-9e0f-4a1b-8c3d-4e5f6a7b8c9d",
                            "code": "FA-00012",
                            "externalId": "INV-77",
                            "externalKeys": [
                              {
                                "source": null,
                                "externalId": "INV-77"
                              }
                            ],
                            "stage": {
                              "id": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f",
                              "name": "Due",
                              "kind": "OPEN"
                            },
                            "closedAt": null,
                            "values": {
                              "6b7c8d9e-0f1a-4b2c-9d4e-5f6a7b8c9d0e": 480000
                            },
                            "createdAt": "2026-11-25T08:00:00.000Z",
                            "updatedAt": "2026-12-01T09:30:00.000Z"
                          }
                        ],
                        "nextCursor": "eyJ1IjoiMjAyNi0xMi0wMVQwOTozMDowMC4wMDAwMDBaIn0"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{listId}/records/{ref}": {
      "get": {
        "operationId": "getListRecord",
        "summary": "Get a record by code or ID",
        "description": "`ref` is the record's code (`FA-00012`) or its id.\n\nRequires the `records:read` permission.",
        "tags": [
          "Records"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "records:read"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The record's code or id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ListRecord"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "8d9e0f1a-2b3c-4d4e-9f6a-7b8c9d0e1f2a",
                        "listId": "5a6b7c8d-9e0f-4a1b-8c3d-4e5f6a7b8c9d",
                        "code": "FA-00012",
                        "externalId": "INV-77",
                        "externalKeys": [
                          {
                            "source": null,
                            "externalId": "INV-77"
                          }
                        ],
                        "stage": {
                          "id": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f",
                          "name": "Due",
                          "kind": "OPEN"
                        },
                        "closedAt": null,
                        "values": {
                          "6b7c8d9e-0f1a-4b2c-9d4e-5f6a7b8c9d0e": 480000
                        },
                        "createdAt": "2026-11-25T08:00:00.000Z",
                        "updatedAt": "2026-12-01T09:30:00.000Z"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{listId}/records/{ref}/stage": {
      "put": {
        "operationId": "setListRecordStage",
        "summary": "Move a record to a stage",
        "description": "Requires the `records:write` permission.",
        "tags": [
          "Records"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "records:write"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The record's code or id."
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DryRun"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListRecordStageBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ListRecordWriteResult"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "8d9e0f1a-2b3c-4d4e-9f6a-7b8c9d0e1f2a",
                        "code": "FA-00012",
                        "result": "updated",
                        "stageId": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f",
                        "stageChange": {
                          "fromStageId": null,
                          "toStageId": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f"
                        },
                        "protectedFields": []
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{listId}/records/external/{externalId}": {
      "get": {
        "operationId": "getListRecordByExternalId",
        "summary": "Get a record by external ID",
        "description": "Requires the `records:read` permission.",
        "tags": [
          "Records"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "records:read"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "externalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ListRecord"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "8d9e0f1a-2b3c-4d4e-9f6a-7b8c9d0e1f2a",
                        "listId": "5a6b7c8d-9e0f-4a1b-8c3d-4e5f6a7b8c9d",
                        "code": "FA-00012",
                        "externalId": "INV-77",
                        "externalKeys": [
                          {
                            "source": null,
                            "externalId": "INV-77"
                          }
                        ],
                        "stage": {
                          "id": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f",
                          "name": "Due",
                          "kind": "OPEN"
                        },
                        "closedAt": null,
                        "values": {
                          "6b7c8d9e-0f1a-4b2c-9d4e-5f6a7b8c9d0e": 480000
                        },
                        "createdAt": "2026-11-25T08:00:00.000Z",
                        "updatedAt": "2026-12-01T09:30:00.000Z"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "upsertListRecordByExternalId",
        "summary": "Create or update a record by external ID",
        "description": "Requires the `records:write` permission.",
        "tags": [
          "Records"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "records:write"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "externalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DryRun"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListRecordUpsertBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated, unchanged, or a dry run.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ListRecordWriteResult"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "8d9e0f1a-2b3c-4d4e-9f6a-7b8c9d0e1f2a",
                        "code": "FA-00012",
                        "result": "updated",
                        "stageId": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f",
                        "stageChange": null,
                        "protectedFields": []
                      }
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Created.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ListRecordWriteResult"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "8d9e0f1a-2b3c-4d4e-9f6a-7b8c9d0e1f2a",
                        "code": "FA-00012",
                        "result": "updated",
                        "stageId": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f",
                        "stageChange": null,
                        "protectedFields": []
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/lists/{listId}/records/external/{source}/{externalId}": {
      "get": {
        "operationId": "getListRecordByExternalIdLegacy",
        "summary": "Get a record by external ID (legacy path; source is ignored)",
        "description": "Legacy alias: `source` is ignored. Use `GET /lists/{listId}/records/external/{externalId}`.\n\nRequires the `records:read` permission.",
        "tags": [
          "Records"
        ],
        "deprecated": true,
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "records:read"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "source",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Ignored since ELO-8; any non-empty value."
          },
          {
            "name": "externalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ListRecord"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "8d9e0f1a-2b3c-4d4e-9f6a-7b8c9d0e1f2a",
                        "listId": "5a6b7c8d-9e0f-4a1b-8c3d-4e5f6a7b8c9d",
                        "code": "FA-00012",
                        "externalId": "INV-77",
                        "externalKeys": [
                          {
                            "source": null,
                            "externalId": "INV-77"
                          }
                        ],
                        "stage": {
                          "id": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f",
                          "name": "Due",
                          "kind": "OPEN"
                        },
                        "closedAt": null,
                        "values": {
                          "6b7c8d9e-0f1a-4b2c-9d4e-5f6a7b8c9d0e": 480000
                        },
                        "createdAt": "2026-11-25T08:00:00.000Z",
                        "updatedAt": "2026-12-01T09:30:00.000Z"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "upsertListRecordByExternalIdLegacy",
        "summary": "Create or update a record by external ID (legacy path; source is ignored)",
        "description": "Legacy alias: `source` is ignored. Use `PUT /lists/{listId}/records/external/{externalId}`.\n\nRequires the `records:write` permission.",
        "tags": [
          "Records"
        ],
        "deprecated": true,
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "records:write"
        ],
        "parameters": [
          {
            "name": "listId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "source",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Ignored since ELO-8; any non-empty value."
          },
          {
            "name": "externalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DryRun"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListRecordUpsertBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated, unchanged, or a dry run.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ListRecordWriteResult"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "8d9e0f1a-2b3c-4d4e-9f6a-7b8c9d0e1f2a",
                        "code": "FA-00012",
                        "result": "updated",
                        "stageId": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f",
                        "stageChange": null,
                        "protectedFields": []
                      }
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Created.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ListRecordWriteResult"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "8d9e0f1a-2b3c-4d4e-9f6a-7b8c9d0e1f2a",
                        "code": "FA-00012",
                        "result": "updated",
                        "stageId": "7c8d9e0f-1a2b-4c3d-8e5f-6a7b8c9d0e1f",
                        "stageChange": null,
                        "protectedFields": []
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "summary": "List webhook subscriptions",
        "description": "Requires the `webhooks:read` permission.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "webhooks:read"
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/WebhookCollection"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "webhooks": [
                          {
                            "id": "9e0f1a2b-3c4d-4e5f-8a7b-8c9d0e1f2a3b",
                            "url": "https://hooks.example.com/eloout",
                            "events": [
                              "opportunity.stage_changed"
                            ],
                            "description": "ERP sync",
                            "status": "active",
                            "disabledAt": null,
                            "disabledReason": null,
                            "createdAt": "2026-11-20T15:04:05.000Z"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "summary": "Create a webhook subscription",
        "description": "Deliveries are signed: see the `webhooks` section of this document. A subscription belongs to the organization, not to the key: revoking the key that created it does not delete it (use `DELETE /webhooks/{id}`).\n\nRequires the `webhooks:write` permission.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "webhooks:write"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookCreateBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created. The answer carries the signing secret once.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/CreatedWebhook"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "9e0f1a2b-3c4d-4e5f-8a7b-8c9d0e1f2a3b",
                        "url": "https://hooks.example.com/eloout",
                        "events": [
                          "opportunity.stage_changed"
                        ],
                        "description": "ERP sync",
                        "status": "active",
                        "disabledAt": null,
                        "disabledReason": null,
                        "createdAt": "2026-11-20T15:04:05.000Z",
                        "secret": "whsec_example_not_a_real_secret"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/webhooks/{id}": {
      "delete": {
        "operationId": "deleteWebhook",
        "summary": "Delete a webhook subscription",
        "description": "Deletes the subscription and its pending deliveries.\n\nRequires the `webhooks:write` permission.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "webhooks:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/DeletedWebhook"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "id": "9e0f1a2b-3c4d-4e5f-8a7b-8c9d0e1f2a3b",
                        "deleted": true
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/webhooks/{id}/test": {
      "post": {
        "operationId": "testWebhook",
        "summary": "Send a test event to a webhook subscription",
        "description": "Only for an active subscription (409 when it is disabled).\n\nRequires the `webhooks:write` permission.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "webhooks:write"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "A `webhook.test` delivery was queued.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/WebhookTestResult"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "deliveryId": "a0f1a2b3-4c5d-4f6a-9b8c-9d0e1f2a3b4c",
                        "eventId": "b1a2b3c4-5d6e-4a7b-8c9d-0e1f2a3b4c5d"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "listWebhookDeliveries",
        "summary": "List a webhook subscription's deliveries",
        "description": "Requires the `webhooks:read` permission.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-eloout-required-scopes": [
          "webhooks:read"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "limit",
            "description": "Page size, 1–100 (default 20).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "cursor",
            "description": "The `nextCursor` of the previous page. Opaque; only valid with the same filters and key's organization.",
            "schema": {
              "type": "string",
              "maxLength": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/WebhookDeliveryPage"
                    }
                  }
                },
                "examples": {
                  "default": {
                    "value": {
                      "ok": true,
                      "data": {
                        "deliveries": [
                          {
                            "id": "a0f1a2b3-4c5d-4f6a-9b8c-9d0e1f2a3b4c",
                            "eventId": "b1a2b3c4-5d6e-4a7b-8c9d-0e1f2a3b4c5d",
                            "eventType": "opportunity.stage_changed",
                            "status": "succeeded",
                            "attempts": 1,
                            "nextAttemptAt": null,
                            "lastAttemptAt": "2026-12-01T10:00:01.000Z",
                            "lastResponseStatus": 200,
                            "lastResponseBody": "ok",
                            "lastError": null,
                            "deliveredAt": "2026-12-01T10:00:01.000Z",
                            "createdAt": "2026-12-01T10:00:00.000Z"
                          }
                        ],
                        "nextCursor": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  },
  "webhooks": {
    "opportunity.created": {
      "post": {
        "summary": "opportunity.created event",
        "description": "Sent to every active subscription listening to `opportunity.created`. Retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h; a subscription is disabled after 5 consecutive failed deliveries.",
        "parameters": [
          {
            "name": "Eloout-Webhook-Id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry. Use it to deduplicate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Eloout-Webhook-Timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Eloout-Webhook-Signature",
            "in": "header",
            "required": true,
            "description": "`v1=` + hex HMAC-SHA256 of `\"{timestamp}.{raw body}\"`, keyed with the subscription secret (UTF-8, `whsec_` included).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "organizationId",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "type": {
                    "const": "opportunity.created"
                  },
                  "occurredAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "organizationId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "data": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer, or none within 10 s, is retried."
          }
        }
      }
    },
    "opportunity.updated": {
      "post": {
        "summary": "opportunity.updated event",
        "description": "Sent to every active subscription listening to `opportunity.updated`. Retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h; a subscription is disabled after 5 consecutive failed deliveries.",
        "parameters": [
          {
            "name": "Eloout-Webhook-Id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry. Use it to deduplicate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Eloout-Webhook-Timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Eloout-Webhook-Signature",
            "in": "header",
            "required": true,
            "description": "`v1=` + hex HMAC-SHA256 of `\"{timestamp}.{raw body}\"`, keyed with the subscription secret (UTF-8, `whsec_` included).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "organizationId",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "type": {
                    "const": "opportunity.updated"
                  },
                  "occurredAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "organizationId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "data": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer, or none within 10 s, is retried."
          }
        }
      }
    },
    "opportunity.stage_changed": {
      "post": {
        "summary": "opportunity.stage_changed event",
        "description": "Sent to every active subscription listening to `opportunity.stage_changed`. Retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h; a subscription is disabled after 5 consecutive failed deliveries.",
        "parameters": [
          {
            "name": "Eloout-Webhook-Id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry. Use it to deduplicate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Eloout-Webhook-Timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Eloout-Webhook-Signature",
            "in": "header",
            "required": true,
            "description": "`v1=` + hex HMAC-SHA256 of `\"{timestamp}.{raw body}\"`, keyed with the subscription secret (UTF-8, `whsec_` included).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "organizationId",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "type": {
                    "const": "opportunity.stage_changed"
                  },
                  "occurredAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "organizationId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "data": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer, or none within 10 s, is retried."
          }
        }
      }
    },
    "list_record.created": {
      "post": {
        "summary": "list_record.created event",
        "description": "Sent to every active subscription listening to `list_record.created`. Retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h; a subscription is disabled after 5 consecutive failed deliveries.",
        "parameters": [
          {
            "name": "Eloout-Webhook-Id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry. Use it to deduplicate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Eloout-Webhook-Timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Eloout-Webhook-Signature",
            "in": "header",
            "required": true,
            "description": "`v1=` + hex HMAC-SHA256 of `\"{timestamp}.{raw body}\"`, keyed with the subscription secret (UTF-8, `whsec_` included).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "organizationId",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "type": {
                    "const": "list_record.created"
                  },
                  "occurredAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "organizationId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "data": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer, or none within 10 s, is retried."
          }
        }
      }
    },
    "list_record.updated": {
      "post": {
        "summary": "list_record.updated event",
        "description": "Sent to every active subscription listening to `list_record.updated`. Retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h; a subscription is disabled after 5 consecutive failed deliveries.",
        "parameters": [
          {
            "name": "Eloout-Webhook-Id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry. Use it to deduplicate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Eloout-Webhook-Timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Eloout-Webhook-Signature",
            "in": "header",
            "required": true,
            "description": "`v1=` + hex HMAC-SHA256 of `\"{timestamp}.{raw body}\"`, keyed with the subscription secret (UTF-8, `whsec_` included).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "organizationId",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "type": {
                    "const": "list_record.updated"
                  },
                  "occurredAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "organizationId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "data": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer, or none within 10 s, is retried."
          }
        }
      }
    },
    "list_record.stage_changed": {
      "post": {
        "summary": "list_record.stage_changed event",
        "description": "Sent to every active subscription listening to `list_record.stage_changed`. Retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h; a subscription is disabled after 5 consecutive failed deliveries.",
        "parameters": [
          {
            "name": "Eloout-Webhook-Id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry. Use it to deduplicate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Eloout-Webhook-Timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Eloout-Webhook-Signature",
            "in": "header",
            "required": true,
            "description": "`v1=` + hex HMAC-SHA256 of `\"{timestamp}.{raw body}\"`, keyed with the subscription secret (UTF-8, `whsec_` included).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "organizationId",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "type": {
                    "const": "list_record.stage_changed"
                  },
                  "occurredAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "organizationId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "data": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer, or none within 10 s, is retried."
          }
        }
      }
    },
    "webhook.test": {
      "post": {
        "summary": "webhook.test event",
        "description": "Sent to every active subscription listening to `webhook.test`. Retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h; a subscription is disabled after 5 consecutive failed deliveries.",
        "parameters": [
          {
            "name": "Eloout-Webhook-Id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry. Use it to deduplicate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Eloout-Webhook-Timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Eloout-Webhook-Signature",
            "in": "header",
            "required": true,
            "description": "`v1=` + hex HMAC-SHA256 of `\"{timestamp}.{raw body}\"`, keyed with the subscription secret (UTF-8, `whsec_` included).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "organizationId",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "type": {
                    "const": "webhook.test"
                  },
                  "occurredAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "organizationId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "data": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer, or none within 10 s, is retried."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An organization API key: `elo_` followed by 43 characters."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "1 to 255 printable ASCII characters without spaces, scoped to the API key. A retry of the same request (method, path, query and body) within 24 h gets the stored answer with `Idempotent-Replayed: true` and does not run again; the same key with another request is 422; while the first runs, 409. Answers of 500 and above are not stored: the key is released and a retry runs the write again. Ignored on a dry run.",
        "schema": {
          "type": "string",
          "maxLength": 255
        }
      },
      "DryRun": {
        "name": "dryRun",
        "in": "query",
        "required": false,
        "description": "`true` plans the write and answers as if done, with `dryRun: true`; nothing is written and no event is sent.",
        "schema": {
          "type": "boolean",
          "default": false
        }
      }
    },
    "headers": {
      "X-RateLimit-Limit": {
        "description": "Requests allowed in the current window.",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Remaining": {
        "description": "Requests left in the current window.",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Reset": {
        "description": "Seconds until the current window resets (at least 1). Not a Unix time.",
        "schema": {
          "type": "integer"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer"
        }
      },
      "WWW-Authenticate": {
        "description": "`Bearer`.",
        "schema": {
          "type": "string"
        }
      },
      "Idempotent-Replayed": {
        "description": "`true` when the answer is a stored replay of an earlier identical request.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Unauthenticated": {
        "description": "Missing, malformed, unknown or revoked key.",
        "headers": {
          "WWW-Authenticate": {
            "$ref": "#/components/headers/WWW-Authenticate"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "default": {
                "value": {
                  "ok": false,
                  "error": {
                    "code": "UNAUTHENTICATED",
                    "message": "Invalid or revoked API key"
                  }
                }
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "`FORBIDDEN` when the key lacks the operation's permission (`details.requiredScope`); `PLAN_READ_ONLY` or `PLAN_LIMIT_REACHED` when the organization's plan refuses a write.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/X-RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "default": {
                "value": {
                  "ok": false,
                  "error": {
                    "code": "FORBIDDEN",
                    "message": "This API key lacks the opportunities:write scope",
                    "details": {
                      "requiredScope": "opportunities:write"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "Not found in the key's organization.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/X-RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "default": {
                "value": {
                  "ok": false,
                  "error": {
                    "code": "NOT_FOUND",
                    "message": "Opportunity not found"
                  }
                }
              }
            }
          }
        }
      },
      "Conflict": {
        "description": "`CONFLICT` or `IDEMPOTENCY_KEY_IN_PROGRESS`.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/X-RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "The body is larger than 1048576 bytes.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/X-RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ValidationError": {
        "description": "`VALIDATION_ERROR` with `details.fieldErrors` by field, or `IDEMPOTENCY_KEY_REUSED`.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/X-RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "default": {
                "value": {
                  "ok": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "The request is not valid",
                    "details": {
                      "fieldErrors": {
                        "limit": [
                          "At most 100"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "Too many requests for the key, its organization, or failed authentications from the client IP. Every 429 has `Retry-After`; the `X-RateLimit-*` headers come only when the key's or the organization's limit refused the request, not on the failed-authentication limit.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/X-RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "default": {
                "value": {
                  "ok": false,
                  "error": {
                    "code": "RATE_LIMITED",
                    "message": "Too many requests for this API key or its organization"
                  }
                }
              }
            }
          }
        }
      },
      "InternalError": {
        "description": "Unexpected failure. The write may or may not have happened, and the answer is not stored for `Idempotency-Key`: a retry runs the write again, so check the resource first.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "CreatedWebhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "opportunity.created",
                "opportunity.updated",
                "opportunity.stage_changed",
                "list_record.created",
                "list_record.updated",
                "list_record.stage_changed"
              ]
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          },
          "disabledAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 date-time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "disabledReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 date-time (UTC)"
          },
          "secret": {
            "type": "string",
            "description": "The signing secret (`whsec_…`). Shown only in this answer: store it now."
          }
        },
        "required": [
          "id",
          "url",
          "events",
          "description",
          "status",
          "disabledAt",
          "disabledReason",
          "createdAt",
          "secret"
        ],
        "additionalProperties": false
      },
      "CustomField": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "long_text",
              "number",
              "currency",
              "date",
              "datetime",
              "boolean",
              "single_select",
              "multi_select",
              "phone",
              "email",
              "url",
              "relation"
            ]
          },
          "entity": {
            "type": "string",
            "const": "opportunity"
          },
          "required": {
            "type": "boolean"
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Allowed values of a select field; empty for other types."
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "entity",
          "required",
          "options"
        ],
        "additionalProperties": false
      },
      "CustomFieldCollection": {
        "type": "object",
        "properties": {
          "customFields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomField"
            }
          }
        },
        "required": [
          "customFields"
        ],
        "additionalProperties": false
      },
      "DeletedWebhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID"
          },
          "deleted": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "id",
          "deleted"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "details": {}
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ok",
          "error"
        ],
        "additionalProperties": false
      },
      "List": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID"
          },
          "name": {
            "type": "string"
          },
          "codePrefix": {
            "type": "string"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "UUID"
                },
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "text",
                    "long_text",
                    "number",
                    "currency",
                    "date",
                    "datetime",
                    "boolean",
                    "single_select",
                    "multi_select",
                    "phone",
                    "email",
                    "url",
                    "relation"
                  ]
                },
                "required": {
                  "type": "boolean"
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "relation": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "listId": {
                          "type": "string",
                          "description": "UUID"
                        },
                        "listName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "multiple": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "listId",
                        "listName",
                        "multiple"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "type",
                "required",
                "options",
                "relation"
              ],
              "additionalProperties": false
            }
          },
          "pipeline": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "UUID"
                  },
                  "name": {
                    "type": "string"
                  },
                  "stages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "UUID"
                        },
                        "name": {
                          "type": "string"
                        },
                        "order": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "OPEN",
                            "WON",
                            "LOST"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "order",
                        "kind"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "id",
                  "name",
                  "stages"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "codePrefix",
          "columns",
          "pipeline"
        ],
        "additionalProperties": false
      },
      "ListCollection": {
        "type": "object",
        "properties": {
          "lists": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/List"
            }
          }
        },
        "required": [
          "lists"
        ],
        "additionalProperties": false
      },
      "ListRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID"
          },
          "listId": {
            "type": "string",
            "description": "UUID"
          },
          "code": {
            "description": "The record's code (`FA-00012`).",
            "type": [
              "string",
              "null"
            ]
          },
          "externalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalKeys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "source": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "externalId": {
                  "type": "string"
                }
              },
              "required": [
                "source",
                "externalId"
              ],
              "additionalProperties": false
            },
            "description": "Deprecated: the same ID as `externalId`, as a one-item list."
          },
          "stage": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "UUID"
                  },
                  "name": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "OPEN",
                      "WON",
                      "LOST"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name",
                  "kind"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "closedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 date-time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "values": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "UUID"
                      },
                      "listId": {
                        "type": "string",
                        "description": "UUID"
                      },
                      "code": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "listId",
                      "code"
                    ],
                    "additionalProperties": false
                  }
                }
              ]
            },
            "description": "By column id; a column without a value is absent. A relation column holds its picked records."
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 date-time (UTC)"
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601 date-time (UTC)"
          }
        },
        "required": [
          "id",
          "listId",
          "code",
          "externalId",
          "externalKeys",
          "stage",
          "closedAt",
          "values",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ListRecordPage": {
        "type": "object",
        "properties": {
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ListRecord"
            }
          },
          "nextCursor": {
            "description": "Pass as `cursor` (with the same filters) for the next page; null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "records",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "ListRecordWriteResult": {
        "type": "object",
        "properties": {
          "id": {
            "anyOf": [
              {
                "type": "string",
                "description": "UUID"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null only on a dry run that would create the record."
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "result": {
            "type": "string",
            "enum": [
              "created",
              "updated",
              "unchanged"
            ]
          },
          "stageId": {
            "anyOf": [
              {
                "type": "string",
                "description": "UUID"
              },
              {
                "type": "null"
              }
            ]
          },
          "stageChange": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "fromStageId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "description": "UUID"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "toStageId": {
                    "type": "string",
                    "description": "UUID"
                  }
                },
                "required": [
                  "fromStageId",
                  "toStageId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Set when an existing item moved stage."
          },
          "protectedFields": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "UUID"
            },
            "description": "Column ids not written because a person owns that value."
          },
          "dryRun": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "id",
          "code",
          "result",
          "stageId",
          "stageChange",
          "protectedFields"
        ],
        "additionalProperties": false
      },
      "Me": {
        "type": "object",
        "properties": {
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "UUID"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "apiKey": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "UUID"
              },
              "name": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Scope"
                },
                "description": "The key's effective permissions."
              },
              "legacy": {
                "type": "boolean",
                "description": "True for a key issued before per-resource permissions (kept its broad access; review and replace it)."
              }
            },
            "required": [
              "id",
              "name",
              "scopes",
              "legacy"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "organization",
          "apiKey"
        ],
        "additionalProperties": false
      },
      "Opportunity": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "value": {
            "description": "Exact decimal as stored (\"1250000.50\"), or null.",
            "type": [
              "string",
              "null"
            ]
          },
          "discount": {
            "description": "Fixed discount of a lines opportunity (exact decimal), or null.",
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "pipeline": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "UUID"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "stage": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "UUID"
                  },
                  "name": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "open",
                      "won",
                      "lost"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name",
                  "kind"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "contact": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "UUID"
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "phone": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name",
                  "phone"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "client": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "UUID"
                  },
                  "name": {
                    "type": "string"
                  },
                  "taxId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name",
                  "taxId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "externalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalKeys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "source": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "externalId": {
                  "type": "string"
                }
              },
              "required": [
                "source",
                "externalId"
              ],
              "additionalProperties": false
            },
            "description": "Deprecated: the same ID as `externalId`, as a one-item list."
          },
          "customFields": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "description": "Values of the organization's live opportunity custom fields, keyed by field id (see GET /custom-fields)."
          },
          "closedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 date-time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 date-time (UTC)"
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601 date-time (UTC)"
          }
        },
        "required": [
          "id",
          "title",
          "value",
          "discount",
          "currency",
          "pipeline",
          "stage",
          "contact",
          "client",
          "externalId",
          "externalKeys",
          "customFields",
          "closedAt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "OpportunityBatchResult": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "status": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "data": {
                      "$ref": "#/components/schemas/OpportunityWriteResult"
                    }
                  },
                  "required": [
                    "ok",
                    "status",
                    "data"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": false
                    },
                    "status": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {}
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "description": "One result per item, in order. Each item is its own transaction: a failing item never rolls back the others."
          }
        },
        "required": [
          "results"
        ],
        "additionalProperties": false
      },
      "OpportunityPage": {
        "type": "object",
        "properties": {
          "opportunities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Opportunity"
            }
          },
          "nextCursor": {
            "description": "Pass as `cursor` (with the same filters) for the next page; null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "opportunities",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "OpportunityWriteResult": {
        "type": "object",
        "properties": {
          "id": {
            "anyOf": [
              {
                "type": "string",
                "description": "UUID"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null only on a dry run that would create the opportunity."
          },
          "result": {
            "type": "string",
            "enum": [
              "created",
              "updated",
              "unchanged",
              "frozen"
            ]
          },
          "stageId": {
            "type": "string",
            "description": "UUID"
          },
          "stageChange": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "fromStageId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "description": "UUID"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "toStageId": {
                    "type": "string",
                    "description": "UUID"
                  }
                },
                "required": [
                  "fromStageId",
                  "toStageId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Set when an existing item moved stage."
          },
          "protectedFields": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "UUID"
            },
            "description": "Custom field ids not written because a person owns that value."
          },
          "dryRun": {
            "description": "Present on a `?dryRun=true` answer: nothing was written.",
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "id",
          "result",
          "stageId",
          "stageChange",
          "protectedFields"
        ],
        "additionalProperties": false
      },
      "Pipeline": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID"
          },
          "name": {
            "type": "string"
          },
          "opportunityType": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "UUID"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "stages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "UUID"
                },
                "name": {
                  "type": "string"
                },
                "order": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "open",
                    "won",
                    "lost"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "order",
                "kind"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "name",
          "opportunityType",
          "stages"
        ],
        "additionalProperties": false
      },
      "PipelineCollection": {
        "type": "object",
        "properties": {
          "pipelines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Pipeline"
            }
          }
        },
        "required": [
          "pipelines"
        ],
        "additionalProperties": false
      },
      "Scope": {
        "type": "string",
        "enum": [
          "opportunities:read",
          "opportunities:write",
          "pipelines:read",
          "custom-fields:read",
          "lists:read",
          "records:read",
          "records:write",
          "webhooks:read",
          "webhooks:write"
        ]
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "opportunity.created",
                "opportunity.updated",
                "opportunity.stage_changed",
                "list_record.created",
                "list_record.updated",
                "list_record.stage_changed"
              ]
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          },
          "disabledAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 date-time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "disabledReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 date-time (UTC)"
          }
        },
        "required": [
          "id",
          "url",
          "events",
          "description",
          "status",
          "disabledAt",
          "disabledReason",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "WebhookCollection": {
        "type": "object",
        "properties": {
          "webhooks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Webhook"
            }
          }
        },
        "required": [
          "webhooks"
        ],
        "additionalProperties": false
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID"
          },
          "eventId": {
            "type": "string",
            "description": "UUID"
          },
          "eventType": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "nextAttemptAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 date-time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastAttemptAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 date-time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastResponseStatus": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "lastResponseBody": {
            "description": "The first bytes (at most 4 KB) of the receiver's last answer.",
            "type": [
              "string",
              "null"
            ]
          },
          "lastError": {
            "type": [
              "string",
              "null"
            ]
          },
          "deliveredAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 date-time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 date-time (UTC)"
          }
        },
        "required": [
          "id",
          "eventId",
          "eventType",
          "status",
          "attempts",
          "nextAttemptAt",
          "lastAttemptAt",
          "lastResponseStatus",
          "lastResponseBody",
          "lastError",
          "deliveredAt",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "WebhookDeliveryPage": {
        "type": "object",
        "properties": {
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookDelivery"
            }
          },
          "nextCursor": {
            "description": "Pass as `cursor` (with the same filters) for the next page; null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "deliveries",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "WebhookTestResult": {
        "type": "object",
        "properties": {
          "deliveryId": {
            "type": "string",
            "description": "UUID"
          },
          "eventId": {
            "type": "string",
            "description": "UUID"
          }
        },
        "required": [
          "deliveryId",
          "eventId"
        ],
        "additionalProperties": false
      },
      "ListRecordStageBody": {
        "type": "object",
        "properties": {
          "stage": {
            "type": "string",
            "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)\\s*$"
          }
        },
        "required": [
          "stage"
        ],
        "additionalProperties": false
      },
      "ListRecordUpsertBody": {
        "type": "object",
        "properties": {
          "values": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "stage": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)\\s*$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "OpportunityBatchBody": {
        "type": "object",
        "properties": {
          "items": {
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "pipelineId": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "stageId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "title": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,498}\\S)?)?\\s*$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "value": {
                  "type": [
                    "number",
                    "string",
                    "null"
                  ]
                },
                "contact": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "phone": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,38}\\S)?)?\\s*$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "name": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)?\\s*$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "client": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "externalId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)?\\s*$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "taxId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,38}\\S)?)?\\s*$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "name": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)?\\s*$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "legalName": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)?\\s*$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "customFields": {
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "applyToClosed": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "lines": {
                  "anyOf": [
                    {
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "sku": {
                            "type": "string",
                            "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)\\s*$"
                          },
                          "name": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,498}\\S)?)?\\s*$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "quantity": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ]
                          },
                          "unitPrice": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ]
                          },
                          "lineTotal": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ]
                          },
                          "externalLineId": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)?\\s*$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "sku"
                        ],
                        "additionalProperties": false
                      }
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "discount": {
                  "type": [
                    "number",
                    "string",
                    "null"
                  ]
                },
                "source": {
                  "description": "Optional and ignored since ELO-8 (at most 120 characters after trimming).",
                  "type": "string",
                  "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,118}\\S)?)?\\s*$"
                },
                "externalId": {
                  "type": "string",
                  "description": "The opportunity's ID in your system: 1–200 characters after trimming.",
                  "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)\\s*$"
                }
              },
              "required": [
                "pipelineId",
                "externalId"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "OpportunityPatchBody": {
        "type": "object",
        "properties": {
          "stageId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,498}\\S)?)?\\s*$"
              },
              {
                "type": "null"
              }
            ]
          },
          "value": {
            "type": [
              "number",
              "string",
              "null"
            ]
          },
          "customFields": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "applyToClosed": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "OpportunityUpsertBody": {
        "type": "object",
        "properties": {
          "pipelineId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "stageId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,498}\\S)?)?\\s*$"
              },
              {
                "type": "null"
              }
            ]
          },
          "value": {
            "type": [
              "number",
              "string",
              "null"
            ]
          },
          "contact": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,38}\\S)?)?\\s*$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "name": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)?\\s*$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "client": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "externalId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)?\\s*$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "taxId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,38}\\S)?)?\\s*$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "name": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)?\\s*$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "legalName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)?\\s*$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "customFields": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "applyToClosed": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "lines": {
            "anyOf": [
              {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "sku": {
                      "type": "string",
                      "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)\\s*$"
                    },
                    "name": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,498}\\S)?)?\\s*$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "quantity": {
                      "type": [
                        "number",
                        "string",
                        "null"
                      ]
                    },
                    "unitPrice": {
                      "type": [
                        "number",
                        "string",
                        "null"
                      ]
                    },
                    "lineTotal": {
                      "type": [
                        "number",
                        "string",
                        "null"
                      ]
                    },
                    "externalLineId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,198}\\S)?)?\\s*$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "sku"
                  ],
                  "additionalProperties": false
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "discount": {
            "type": [
              "number",
              "string",
              "null"
            ]
          }
        },
        "required": [
          "pipelineId"
        ],
        "additionalProperties": false
      },
      "WebhookCreateBody": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,}\\S)?)\\s*$"
          },
          "events": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "opportunity.created",
                "opportunity.updated",
                "opportunity.stage_changed",
                "list_record.created",
                "list_record.updated",
                "list_record.stage_changed"
              ]
            }
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\s*(?:\\S(?:[\\s\\S]{0,498}\\S)?)?\\s*$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "url",
          "events"
        ],
        "additionalProperties": false
      }
    }
  }
}
