{
  "openapi": "3.1.0",
  "info": {
    "title": "Clai Public API",
    "version": "1.0.0",
    "description": "Programmatic access to Clai deals, packages, document uploads, tasks, checklists, and signing submissions via org-scoped REST endpoints. Authenticate with a Bearer API key; optional idempotency and concurrency headers apply on mutating routes as documented per operation.",
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://app.goclai.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "Bearer token using a Clai API key secret (`clai_live_*`)."
      }
    },
    "schemas": {
      "PublicApiErrorEnvelope": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "example": "ERROR_CODE"
              },
              "message": {
                "type": "string",
                "example": "Human-readable error message"
              },
              "details": {
                "type": "object",
                "additionalProperties": {},
                "example": {}
              }
            },
            "required": ["code", "message", "details"]
          }
        },
        "required": ["error"]
      },
      "PublicApiOpenApiDocument": {
        "type": "object",
        "additionalProperties": {},
        "description": "OpenAPI 3.1 document for Public API v1"
      },
      "KeyIntrospectionResponse": {
        "type": "object",
        "properties": {
          "keyId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "environment": {
            "type": "string",
            "enum": ["live", "test"]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1
          },
          "allowedOrgIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1
          }
        },
        "required": [
          "keyId",
          "name",
          "environment",
          "expiresAt",
          "scopes",
          "allowedOrgIds"
        ]
      },
      "ListOrgsResponse": {
        "type": "object",
        "properties": {
          "organizations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": ["string", "null"]
                }
              },
              "required": ["id", "name"]
            }
          }
        },
        "required": ["organizations"]
      },
      "PublicListDealsResponse": {
        "type": "object",
        "properties": {
          "deals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "dealId": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "description": "Deal operational status. Built-in values: `draft`, `in_progress`, `completed`, `flagged`, `review`, `compliance`. Organizations may define additional status keys."
                },
                "createdAt": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string"
                },
                "packageId": {
                  "type": ["string", "null"],
                  "format": "uuid"
                },
                "authorName": {
                  "type": ["string", "null"],
                  "description": "Full name of the user who created the deal. Null when the creator has no name on file."
                },
                "tags": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Catalog labels on the deal, sorted case-insensitively. Empty when the deal has no tags."
                },
                "dealUrl": {
                  "type": "string",
                  "description": "Link to the deal in the Clai portal. Omitted when the server has no public origin configured."
                },
                "templateSource": {
                  "type": "string",
                  "enum": ["personal", "org"],
                  "description": "Present only with isTemplate=true. `org` for org library templates, `personal` otherwise."
                }
              },
              "required": [
                "dealId",
                "name",
                "status",
                "createdAt",
                "updatedAt",
                "packageId",
                "authorName",
                "tags"
              ]
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["deals", "hasMore", "nextCursor"]
      },
      "PublicCreateDealRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Deal name. Required unless templateDealIds is sent."
          },
          "file": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              },
              "size": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 52428800
              },
              "contentType": {
                "type": "string",
                "enum": ["application/pdf"]
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": ["name", "size", "contentType"],
            "additionalProperties": false,
            "description": "Optional PDF to upload after deal creation"
          },
          "description": {
            "type": "string",
            "description": "Deal description"
          },
          "transactionType": {
            "type": "string",
            "enum": ["sale", "lease"],
            "description": "Transaction type: sale or lease"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Deal tags"
          },
          "dataSource": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "enum": [
                  "rentcast",
                  "attom",
                  "idx_broker",
                  "zillow",
                  "redfin",
                  "manual"
                ]
              },
              "propertyId": {
                "type": "string"
              },
              "metadata": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "required": ["name", "propertyId"],
            "additionalProperties": false,
            "description": "Data source from lookup_property. Pass through as-is."
          },
          "formattedAddress": {
            "type": "string",
            "description": "Formatted address string"
          },
          "address": {
            "type": "object",
            "properties": {
              "line1": {
                "type": "string"
              },
              "line2": {
                "type": "string"
              },
              "unitNumber": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "state": {
                "type": "string"
              },
              "zipCode": {
                "type": "string"
              },
              "county": {
                "type": "string"
              },
              "country": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "Property address components"
          },
          "propertyType": {
            "type": "string",
            "description": "Property type (e.g., Single Family, Condo)"
          },
          "bedrooms": {
            "type": "number",
            "description": "Number of bedrooms"
          },
          "bathrooms": {
            "type": "number",
            "description": "Number of bathrooms"
          },
          "squareFootage": {
            "type": "number",
            "description": "Total interior square footage"
          },
          "lotSize": {
            "type": "number",
            "description": "Lot size in square feet"
          },
          "yearBuilt": {
            "type": "number",
            "description": "Year the property was built"
          },
          "owner": {
            "type": "object",
            "properties": {
              "names": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "type": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "Property owner / seller / landlord"
          },
          "counterparty": {
            "type": "object",
            "properties": {
              "names": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "type": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "Buyer or tenant"
          },
          "listingAgent": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "licenseNumber": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "Listing agent"
          },
          "buyerAgent": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "licenseNumber": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "Buyer/tenant agent"
          },
          "amount": {
            "type": "number",
            "description": "Purchase price (sales) or monthly rent (leases)"
          },
          "deposit": {
            "type": "number",
            "description": "Earnest money (sales) or security deposit (leases)"
          },
          "startDate": {
            "type": "string",
            "description": "Closing date (sales) or lease begin date"
          },
          "endDate": {
            "type": "string",
            "description": "Lease end date"
          },
          "leaseTermMonths": {
            "type": "number",
            "description": "Lease term in months"
          },
          "financingType": {
            "type": "string",
            "enum": ["cash", "financing"],
            "description": "Financing type (sales only)"
          },
          "saleType": {
            "type": "string",
            "enum": ["standard", "1031_exchange", "short_sale"],
            "description": "Sale type"
          },
          "features": {
            "type": "object",
            "properties": {
              "pool": {
                "type": "boolean"
              },
              "garage": {
                "type": "boolean"
              },
              "hoaAssociation": {
                "type": "boolean"
              },
              "condoAssociation": {
                "type": "boolean"
              },
              "cddAssociation": {
                "type": "boolean"
              },
              "waterfront": {
                "type": "boolean"
              },
              "customInterior": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "customExterior": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "description": "Property features"
          },
          "listing": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["active", "inactive"]
              },
              "type": {
                "type": "string",
                "enum": ["sale", "rental", "both", "none"]
              }
            },
            "additionalProperties": {},
            "description": "MLS listing data"
          },
          "notes": {
            "type": "string",
            "description": "Additional notes"
          },
          "templateDealIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 10,
            "description": "Template dealIds from list_deals with isTemplate=true. One id copies the template; several merge their documents."
          },
          "isTemplate": {
            "type": "boolean",
            "description": "Set true to create a reusable template instead of a deal. The template is personal to the API key user. Not allowed with templateDealIds."
          }
        },
        "additionalProperties": false
      },
      "PublicCreateDealResponse": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "dealId": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "packageId": {
                "type": "string",
                "format": "uuid"
              },
              "dealUrl": {
                "type": "string",
                "format": "uri"
              },
              "documentsUrl": {
                "type": "string",
                "format": "uri"
              },
              "isTemplate": {
                "type": "boolean",
                "description": "Present and true only when a template was created."
              },
              "prepareUrl": {
                "type": "string",
                "format": "uri",
                "description": "Template only: where fields and signer roles are set up."
              }
            },
            "required": ["dealId", "name", "packageId"]
          },
          {
            "type": "object",
            "properties": {
              "dealId": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "packageId": {
                "type": "string",
                "format": "uuid"
              },
              "dealUrl": {
                "type": "string",
                "format": "uri"
              },
              "documentsUrl": {
                "type": "string",
                "format": "uri"
              },
              "isTemplate": {
                "type": "boolean",
                "description": "Present and true only when a template was created."
              },
              "prepareUrl": {
                "type": "string",
                "format": "uri",
                "description": "Template only: where fields and signer roles are set up."
              },
              "flowId": {
                "type": "string",
                "format": "uuid"
              },
              "documentId": {
                "type": "string",
                "format": "uuid"
              },
              "uploadUrl": {
                "type": "string",
                "format": "uri"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              },
              "fileName": {
                "type": "string"
              },
              "uploadState": {
                "type": "string",
                "enum": ["awaiting_upload", "uploaded", "processing", "failed"]
              }
            },
            "required": [
              "dealId",
              "name",
              "packageId",
              "flowId",
              "documentId",
              "fileName",
              "uploadState"
            ]
          },
          {
            "type": "object",
            "properties": {
              "dealId": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "packageId": {
                "type": "string",
                "format": "uuid"
              },
              "dealUrl": {
                "type": "string",
                "format": "uri"
              },
              "documentsUrl": {
                "type": "string",
                "format": "uri"
              },
              "isTemplate": {
                "type": "boolean",
                "description": "Present and true only when a template was created."
              },
              "prepareUrl": {
                "type": "string",
                "format": "uri",
                "description": "Template only: where fields and signer roles are set up."
              },
              "uploadState": {
                "type": "string",
                "enum": ["upload_unavailable"]
              }
            },
            "required": ["dealId", "name", "packageId", "uploadState"]
          }
        ],
        "description": "Created deal, optionally including a staged document upload"
      },
      "PublicAddTemplatesRequest": {
        "type": "object",
        "properties": {
          "templateDealIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 10,
            "description": "Template dealIds from list_deals with isTemplate=true. One id copies the template; several merge their documents."
          }
        },
        "required": ["templateDealIds"],
        "additionalProperties": false
      },
      "PublicAddTemplatesResponse": {
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid"
          },
          "packageId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": ["dealId", "packageId"]
      },
      "PublicCreateTaskRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "description": {
            "type": "string",
            "maxLength": 5000
          },
          "type": {
            "type": "string",
            "enum": ["general", "checklist"],
            "default": "general",
            "description": "`general` (default) or `checklist`. Use `checklist` for a checklist parent; create line items in separate requests with `parentId`."
          },
          "dealId": {
            "type": "string",
            "format": "uuid"
          },
          "packageId": {
            "type": "string",
            "format": "uuid"
          },
          "submissionId": {
            "type": "string",
            "format": "uuid"
          },
          "parentId": {
            "type": "string",
            "format": "uuid",
            "description": "Parent checklist task for a checklist line item. The parent must have `type` checklist. The item's deal must match the parent's, and both may be unset."
          },
          "dueDate": {
            "type": "string",
            "format": "date-time"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            },
            "maxItems": 1
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            },
            "maxItems": 1
          }
        },
        "required": ["title"],
        "additionalProperties": false
      },
      "PublicCreateTaskResponse": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "type": {
            "type": "string",
            "enum": [
              "general",
              "sign_doc",
              "payment",
              "upload",
              "review",
              "deal_milestone",
              "checklist"
            ]
          },
          "status": {
            "type": "string",
            "description": "Task lifecycle status. Built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`. Organizations may define additional status keys."
          },
          "dealId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "packageId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "submissionId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "parentId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "dueDate": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        },
        "required": [
          "taskId",
          "title",
          "description",
          "type",
          "status",
          "dealId",
          "packageId",
          "submissionId",
          "parentId",
          "dueDate",
          "assignees",
          "approvers",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicCreateDealTaskRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "description": {
            "type": "string",
            "maxLength": 5000
          },
          "type": {
            "type": "string",
            "enum": ["general", "checklist"],
            "default": "general",
            "description": "`general` (default) or `checklist`. Use `checklist` for a checklist parent; create line items in separate requests with `parentId`."
          },
          "packageId": {
            "type": "string",
            "format": "uuid"
          },
          "submissionId": {
            "type": "string",
            "format": "uuid"
          },
          "parentId": {
            "type": "string",
            "format": "uuid",
            "description": "Parent checklist task for a checklist line item. The parent must have `type` checklist. The item's deal must match the parent's, and both may be unset."
          },
          "dueDate": {
            "type": "string",
            "format": "date-time"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            },
            "maxItems": 1
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            },
            "maxItems": 1
          }
        },
        "required": ["title"],
        "additionalProperties": false
      },
      "PublicCreateDealTaskResponse": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "type": {
            "type": "string",
            "enum": [
              "general",
              "sign_doc",
              "payment",
              "upload",
              "review",
              "deal_milestone",
              "checklist"
            ]
          },
          "status": {
            "type": "string",
            "description": "Task lifecycle status. Built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`. Organizations may define additional status keys."
          },
          "dealId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "packageId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "submissionId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "parentId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "dueDate": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        },
        "required": [
          "taskId",
          "title",
          "description",
          "type",
          "status",
          "dealId",
          "packageId",
          "submissionId",
          "parentId",
          "dueDate",
          "assignees",
          "approvers",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicListTasksResponse": {
        "type": "object",
        "properties": {
          "tasks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "taskId": {
                  "type": "string",
                  "format": "uuid"
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": ["string", "null"]
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "general",
                    "sign_doc",
                    "payment",
                    "upload",
                    "review",
                    "deal_milestone",
                    "checklist"
                  ]
                },
                "status": {
                  "type": "string",
                  "description": "Task lifecycle status. Built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`. Organizations may define additional status keys."
                },
                "dealId": {
                  "type": ["string", "null"],
                  "format": "uuid"
                },
                "packageId": {
                  "type": ["string", "null"],
                  "format": "uuid"
                },
                "submissionId": {
                  "type": ["string", "null"],
                  "format": "uuid"
                },
                "parentId": {
                  "type": ["string", "null"],
                  "format": "uuid"
                },
                "dueDate": {
                  "type": ["string", "null"],
                  "format": "date-time"
                },
                "assignees": {
                  "type": "array",
                  "items": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["user"]
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string",
                            "maxLength": 255
                          }
                        },
                        "required": ["type", "id"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["team"]
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string",
                            "maxLength": 255
                          },
                          "boundUser": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": ["user"]
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "name": {
                                "type": "string",
                                "maxLength": 255
                              }
                            },
                            "required": ["type", "id"],
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "id"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["participant"]
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string",
                            "maxLength": 255
                          }
                        },
                        "required": ["type", "id"],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "approvers": {
                  "type": "array",
                  "items": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["user"]
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string",
                            "maxLength": 255
                          }
                        },
                        "required": ["type", "id"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["team"]
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string",
                            "maxLength": 255
                          },
                          "boundUser": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": ["user"]
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "name": {
                                "type": "string",
                                "maxLength": 255
                              }
                            },
                            "required": ["type", "id"],
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "id"],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "deletedAt": {
                  "type": ["string", "null"],
                  "format": "date-time"
                }
              },
              "required": [
                "taskId",
                "title",
                "description",
                "type",
                "status",
                "dealId",
                "packageId",
                "submissionId",
                "parentId",
                "dueDate",
                "assignees",
                "approvers",
                "createdAt",
                "updatedAt"
              ]
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["tasks", "hasMore", "nextCursor"]
      },
      "PublicListAssigneeCandidatesResponse": {
        "type": "object",
        "properties": {
          "candidates": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "email": {
                      "type": ["string", "null"]
                    },
                    "name": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["type", "id", "email", "name"]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": ["type", "id", "name"]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": ["type", "id", "name"]
                }
              ]
            }
          }
        },
        "required": ["candidates"]
      },
      "PublicGetTaskResponse": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "type": {
            "type": "string",
            "enum": [
              "general",
              "sign_doc",
              "payment",
              "upload",
              "review",
              "deal_milestone",
              "checklist"
            ]
          },
          "status": {
            "type": "string",
            "description": "Task lifecycle status. Built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`. Organizations may define additional status keys."
          },
          "dealId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "packageId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "submissionId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "parentId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "dueDate": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        },
        "required": [
          "taskId",
          "title",
          "description",
          "type",
          "status",
          "dealId",
          "packageId",
          "submissionId",
          "parentId",
          "dueDate",
          "assignees",
          "approvers",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicUpdateTaskRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "description": {
            "type": ["string", "null"],
            "maxLength": 5000
          },
          "dueDate": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "dealId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "packageId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "submissionId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            },
            "maxItems": 1
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            },
            "maxItems": 1
          }
        },
        "additionalProperties": false
      },
      "PublicUpdateTaskResponse": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "type": {
            "type": "string",
            "enum": [
              "general",
              "sign_doc",
              "payment",
              "upload",
              "review",
              "deal_milestone",
              "checklist"
            ]
          },
          "status": {
            "type": "string",
            "description": "Task lifecycle status. Built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`. Organizations may define additional status keys."
          },
          "dealId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "packageId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "submissionId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "parentId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "dueDate": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        },
        "required": [
          "taskId",
          "title",
          "description",
          "type",
          "status",
          "dealId",
          "packageId",
          "submissionId",
          "parentId",
          "dueDate",
          "assignees",
          "approvers",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicDeleteTaskResponse": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "type": {
            "type": "string",
            "enum": [
              "general",
              "sign_doc",
              "payment",
              "upload",
              "review",
              "deal_milestone",
              "checklist"
            ]
          },
          "status": {
            "type": "string",
            "description": "Task lifecycle status. Built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`. Organizations may define additional status keys."
          },
          "dealId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "packageId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "submissionId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "parentId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "dueDate": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        },
        "required": [
          "taskId",
          "title",
          "description",
          "type",
          "status",
          "dealId",
          "packageId",
          "submissionId",
          "parentId",
          "dueDate",
          "assignees",
          "approvers",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicTransitionTaskRequest": {
        "type": "object",
        "properties": {
          "targetStatus": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9_]*$"
          },
          "comment": {
            "type": "string",
            "maxLength": 1000
          }
        },
        "required": ["targetStatus"]
      },
      "PublicTransitionTaskResponseTask": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "type": {
            "type": "string",
            "enum": [
              "general",
              "sign_doc",
              "payment",
              "upload",
              "review",
              "deal_milestone",
              "checklist"
            ]
          },
          "status": {
            "type": "string",
            "description": "Task lifecycle status. Built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`. Organizations may define additional status keys."
          },
          "dealId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "packageId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "submissionId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "parentId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "dueDate": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        },
        "required": [
          "taskId",
          "title",
          "description",
          "type",
          "status",
          "dealId",
          "packageId",
          "submissionId",
          "parentId",
          "dueDate",
          "assignees",
          "approvers",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicTransitionTaskResponse": {
        "type": "object",
        "properties": {
          "task": {
            "$ref": "#/components/schemas/PublicTransitionTaskResponseTask"
          }
        },
        "required": ["task"]
      },
      "PublicClaimTaskRequest": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": ["assignee", "approver"]
          },
          "teamId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": ["role", "teamId"]
      },
      "PublicClaimTaskResponseTask": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "type": {
            "type": "string",
            "enum": [
              "general",
              "sign_doc",
              "payment",
              "upload",
              "review",
              "deal_milestone",
              "checklist"
            ]
          },
          "status": {
            "type": "string",
            "description": "Task lifecycle status. Built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`. Organizations may define additional status keys."
          },
          "dealId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "packageId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "submissionId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "parentId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "dueDate": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        },
        "required": [
          "taskId",
          "title",
          "description",
          "type",
          "status",
          "dealId",
          "packageId",
          "submissionId",
          "parentId",
          "dueDate",
          "assignees",
          "approvers",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicClaimTaskResponse": {
        "type": "object",
        "properties": {
          "task": {
            "$ref": "#/components/schemas/PublicClaimTaskResponseTask"
          }
        },
        "required": ["task"]
      },
      "PublicApproveTaskRequest": {
        "type": "object",
        "properties": {
          "comment": {
            "type": "string",
            "maxLength": 2000
          }
        }
      },
      "PublicApproveTaskResponseTask": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "type": {
            "type": "string",
            "enum": [
              "general",
              "sign_doc",
              "payment",
              "upload",
              "review",
              "deal_milestone",
              "checklist"
            ]
          },
          "status": {
            "type": "string",
            "description": "Task lifecycle status. Built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`. Organizations may define additional status keys."
          },
          "dealId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "packageId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "submissionId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "parentId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "dueDate": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        },
        "required": [
          "taskId",
          "title",
          "description",
          "type",
          "status",
          "dealId",
          "packageId",
          "submissionId",
          "parentId",
          "dueDate",
          "assignees",
          "approvers",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicApproveTaskResponse": {
        "type": "object",
        "properties": {
          "allApproved": {
            "type": "boolean"
          },
          "task": {
            "$ref": "#/components/schemas/PublicApproveTaskResponseTask"
          }
        },
        "required": ["allApproved", "task"]
      },
      "PublicRejectTaskRequest": {
        "type": "object",
        "properties": {
          "comment": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          }
        }
      },
      "PublicRejectTaskResponseTask": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "type": {
            "type": "string",
            "enum": [
              "general",
              "sign_doc",
              "payment",
              "upload",
              "review",
              "deal_milestone",
              "checklist"
            ]
          },
          "status": {
            "type": "string",
            "description": "Task lifecycle status. Built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`. Organizations may define additional status keys."
          },
          "dealId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "packageId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "submissionId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "parentId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "dueDate": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "assignees": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["participant"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "approvers": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["user"]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["team"]
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "boundUser": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["user"]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "required": ["type", "id"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["type", "id"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        },
        "required": [
          "taskId",
          "title",
          "description",
          "type",
          "status",
          "dealId",
          "packageId",
          "submissionId",
          "parentId",
          "dueDate",
          "assignees",
          "approvers",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicRejectTaskResponse": {
        "type": "object",
        "properties": {
          "task": {
            "$ref": "#/components/schemas/PublicRejectTaskResponseTask"
          }
        },
        "required": ["task"]
      },
      "PublicListDealTasksResponse": {
        "type": "object",
        "properties": {
          "tasks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "taskId": {
                  "type": "string",
                  "format": "uuid"
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": ["string", "null"]
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "general",
                    "sign_doc",
                    "payment",
                    "upload",
                    "review",
                    "deal_milestone",
                    "checklist"
                  ]
                },
                "status": {
                  "type": "string",
                  "description": "Task lifecycle status. Built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`. Organizations may define additional status keys."
                },
                "dealId": {
                  "type": ["string", "null"],
                  "format": "uuid"
                },
                "packageId": {
                  "type": ["string", "null"],
                  "format": "uuid"
                },
                "submissionId": {
                  "type": ["string", "null"],
                  "format": "uuid"
                },
                "parentId": {
                  "type": ["string", "null"],
                  "format": "uuid"
                },
                "dueDate": {
                  "type": ["string", "null"],
                  "format": "date-time"
                },
                "assignees": {
                  "type": "array",
                  "items": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["user"]
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string",
                            "maxLength": 255
                          }
                        },
                        "required": ["type", "id"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["team"]
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string",
                            "maxLength": 255
                          },
                          "boundUser": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": ["user"]
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "name": {
                                "type": "string",
                                "maxLength": 255
                              }
                            },
                            "required": ["type", "id"],
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "id"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["participant"]
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string",
                            "maxLength": 255
                          }
                        },
                        "required": ["type", "id"],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "approvers": {
                  "type": "array",
                  "items": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["user"]
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string",
                            "maxLength": 255
                          }
                        },
                        "required": ["type", "id"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["team"]
                          },
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string",
                            "maxLength": 255
                          },
                          "boundUser": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": ["user"]
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "name": {
                                "type": "string",
                                "maxLength": 255
                              }
                            },
                            "required": ["type", "id"],
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "id"],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "deletedAt": {
                  "type": ["string", "null"],
                  "format": "date-time"
                }
              },
              "required": [
                "taskId",
                "title",
                "description",
                "type",
                "status",
                "dealId",
                "packageId",
                "submissionId",
                "parentId",
                "dueDate",
                "assignees",
                "approvers",
                "createdAt",
                "updatedAt"
              ]
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["tasks", "hasMore", "nextCursor"]
      },
      "PublicListPackagesResponse": {
        "type": "object",
        "properties": {
          "packages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "packageId": {
                  "type": "string",
                  "format": "uuid"
                },
                "dealId": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "isTemplate": {
                  "type": "boolean",
                  "description": "Present and true only when the deal is a template."
                }
              },
              "required": [
                "packageId",
                "dealId",
                "name",
                "createdAt",
                "updatedAt"
              ]
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["packages", "hasMore", "nextCursor"]
      },
      "PublicCreatePackageRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": ["name"],
        "additionalProperties": false
      },
      "PublicCreatePackageResponse": {
        "type": "object",
        "properties": {
          "packageId": {
            "type": "string",
            "format": "uuid"
          },
          "dealId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "isTemplate": {
            "type": "boolean",
            "description": "Present and true only when the deal is a template."
          }
        },
        "required": ["packageId", "dealId", "name", "createdAt", "updatedAt"]
      },
      "PublicGetPackageResponse": {
        "type": "object",
        "properties": {
          "packageId": {
            "type": "string",
            "format": "uuid"
          },
          "dealId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "isTemplate": {
            "type": "boolean",
            "description": "Present and true only when the deal is a template."
          }
        },
        "required": ["packageId", "dealId", "name", "createdAt", "updatedAt"]
      },
      "PublicListParticipantsResponse": {
        "type": "object",
        "properties": {
          "participants": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "participantId": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "signer",
                    "approver",
                    "assigner",
                    "observer",
                    "filler"
                  ]
                },
                "routingOrder": {
                  "type": "integer"
                },
                "fullName": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "phone": {
                  "type": "string"
                },
                "needsContact": {
                  "type": "boolean"
                },
                "party": {
                  "type": "string",
                  "enum": [
                    "client",
                    "company",
                    "guarantor",
                    "co_signer",
                    "witness",
                    "attorney",
                    "transaction_coordinator",
                    "notary",
                    "trustee",
                    "personal_representative",
                    "attorney_in_fact",
                    "assignee",
                    "other",
                    "buyer",
                    "seller",
                    "buyer_agent",
                    "listing_agent",
                    "buyer_broker",
                    "listing_broker",
                    "broker",
                    "landlord",
                    "tenant",
                    "subtenant",
                    "occupant",
                    "property_manager",
                    "leasing_agent",
                    "owner",
                    "lender",
                    "mortgage_broker",
                    "escrow_agent",
                    "title_company",
                    "closing_agent",
                    "appraiser",
                    "inspector",
                    "association"
                  ],
                  "description": "The party saved on the participant. Absent when none is saved; never guessed from the label."
                }
              },
              "required": [
                "participantId",
                "label",
                "role",
                "fullName",
                "email",
                "phone",
                "needsContact"
              ]
            }
          },
          "readiness": {
            "type": "object",
            "properties": {
              "canSend": {
                "type": "boolean"
              },
              "blockers": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "reason": {
                      "type": "string",
                      "enum": [
                        "missing_email",
                        "missing_name",
                        "unknown_participant",
                        "detection_failed",
                        "no_signature_fields",
                        "no_active_participants"
                      ]
                    },
                    "participantId": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    }
                  },
                  "required": ["reason"]
                }
              }
            },
            "required": ["canSend", "blockers"]
          },
          "fieldCount": {
            "type": "integer"
          },
          "prepareUrl": {
            "type": "string"
          },
          "isTemplate": {
            "type": "boolean",
            "description": "Present and true only when the deal is a template."
          }
        },
        "required": ["participants", "readiness", "fieldCount"]
      },
      "PublicUpdateParticipantContactRequest": {
        "type": "object",
        "properties": {
          "contact": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "fullName": {
                    "type": "string",
                    "minLength": 1
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                },
                "required": ["fullName", "email"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "self": {
                    "type": "boolean",
                    "enum": [true]
                  }
                },
                "required": ["self"],
                "additionalProperties": false
              }
            ]
          },
          "party": {
            "type": "string",
            "enum": [
              "client",
              "company",
              "guarantor",
              "co_signer",
              "witness",
              "attorney",
              "transaction_coordinator",
              "notary",
              "trustee",
              "personal_representative",
              "attorney_in_fact",
              "assignee",
              "other",
              "buyer",
              "seller",
              "buyer_agent",
              "listing_agent",
              "buyer_broker",
              "listing_broker",
              "broker",
              "landlord",
              "tenant",
              "subtenant",
              "occupant",
              "property_manager",
              "leasing_agent",
              "owner",
              "lender",
              "mortgage_broker",
              "escrow_agent",
              "title_company",
              "closing_agent",
              "appraiser",
              "inspector",
              "association"
            ],
            "description": "The person's role in the transaction (buyer, seller, landlord, tenant…), separate from their signing role."
          }
        },
        "required": ["contact"],
        "additionalProperties": false
      },
      "PublicUpdateParticipantContactResponse": {
        "type": "object",
        "properties": {
          "participant": {
            "type": "object",
            "properties": {
              "participantId": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": ["signer", "approver", "assigner", "observer", "filler"]
              },
              "routingOrder": {
                "type": "integer"
              },
              "fullName": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "needsContact": {
                "type": "boolean"
              },
              "party": {
                "type": "string",
                "enum": [
                  "client",
                  "company",
                  "guarantor",
                  "co_signer",
                  "witness",
                  "attorney",
                  "transaction_coordinator",
                  "notary",
                  "trustee",
                  "personal_representative",
                  "attorney_in_fact",
                  "assignee",
                  "other",
                  "buyer",
                  "seller",
                  "buyer_agent",
                  "listing_agent",
                  "buyer_broker",
                  "listing_broker",
                  "broker",
                  "landlord",
                  "tenant",
                  "subtenant",
                  "occupant",
                  "property_manager",
                  "leasing_agent",
                  "owner",
                  "lender",
                  "mortgage_broker",
                  "escrow_agent",
                  "title_company",
                  "closing_agent",
                  "appraiser",
                  "inspector",
                  "association"
                ],
                "description": "The party saved on the participant. Absent when none is saved; never guessed from the label."
              }
            },
            "required": [
              "participantId",
              "label",
              "role",
              "fullName",
              "email",
              "phone",
              "needsContact"
            ]
          },
          "readiness": {
            "type": "object",
            "properties": {
              "canSend": {
                "type": "boolean"
              },
              "blockers": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "reason": {
                      "type": "string",
                      "enum": [
                        "missing_email",
                        "missing_name",
                        "unknown_participant",
                        "detection_failed",
                        "no_signature_fields",
                        "no_active_participants"
                      ]
                    },
                    "participantId": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    }
                  },
                  "required": ["reason"]
                }
              }
            },
            "required": ["canSend", "blockers"]
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["duplicate_email"]
            }
          },
          "isTemplate": {
            "type": "boolean",
            "description": "Present and true only when the deal is a template. A contact saved on a template is copied into every deal created from it."
          }
        },
        "required": ["participant", "readiness", "warnings"]
      },
      "PublicUpdatePackageRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": ["name"],
        "additionalProperties": false
      },
      "PublicUpdatePackageResponse": {
        "type": "object",
        "properties": {
          "packageId": {
            "type": "string",
            "format": "uuid"
          },
          "dealId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "isTemplate": {
            "type": "boolean",
            "description": "Present and true only when the deal is a template."
          }
        },
        "required": ["packageId", "dealId", "name", "createdAt", "updatedAt"]
      },
      "PublicDocumentUploadResponse": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "format": "uuid"
          },
          "flowId": {
            "type": "string",
            "format": "uuid"
          },
          "collectionId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "awaiting_upload",
              "uploaded",
              "processing",
              "ready",
              "failed"
            ]
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "pollAfterMs": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "default": 2000
          },
          "error": {
            "type": "string",
            "enum": ["invalid_pdf", "processing_failed"]
          },
          "errorMessage": {
            "type": "string",
            "minLength": 1,
            "description": "User-facing reason the upload failed. Present only for failures with a known, displayable cause; safe to show end users verbatim."
          },
          "detection": {
            "type": "object",
            "properties": {
              "outcome": {
                "type": "string",
                "enum": ["detected", "no_signature_fields", "failed"]
              },
              "participantCount": {
                "type": "integer",
                "minimum": 0
              },
              "signatureFieldCount": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": ["outcome", "participantCount", "signatureFieldCount"],
            "additionalProperties": false
          },
          "canFindSignatures": {
            "type": "boolean"
          }
        },
        "required": ["documentId", "flowId", "status", "updatedAt"]
      },
      "PublicCompleteDocumentUploadRequest": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "PublicCompleteDocumentUploadResponse": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "format": "uuid"
          },
          "flowId": {
            "type": "string",
            "format": "uuid"
          },
          "collectionId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "awaiting_upload",
              "uploaded",
              "processing",
              "ready",
              "failed"
            ]
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "pollAfterMs": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "default": 2000
          },
          "error": {
            "type": "string",
            "enum": ["invalid_pdf", "processing_failed"]
          },
          "errorMessage": {
            "type": "string",
            "minLength": 1,
            "description": "User-facing reason the upload failed. Present only for failures with a known, displayable cause; safe to show end users verbatim."
          },
          "detection": {
            "type": "object",
            "properties": {
              "outcome": {
                "type": "string",
                "enum": ["detected", "no_signature_fields", "failed"]
              },
              "participantCount": {
                "type": "integer",
                "minimum": 0
              },
              "signatureFieldCount": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": ["outcome", "participantCount", "signatureFieldCount"],
            "additionalProperties": false
          },
          "canFindSignatures": {
            "type": "boolean"
          }
        },
        "required": ["documentId", "flowId", "status", "updatedAt"]
      },
      "PublicFindDocumentSignaturesRequest": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "PublicFindDocumentSignaturesResponse": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "format": "uuid"
          },
          "flowId": {
            "type": "string",
            "format": "uuid"
          },
          "collectionId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "awaiting_upload",
              "uploaded",
              "processing",
              "ready",
              "failed"
            ]
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "pollAfterMs": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "default": 2000
          },
          "error": {
            "type": "string",
            "enum": ["invalid_pdf", "processing_failed"]
          },
          "errorMessage": {
            "type": "string",
            "minLength": 1,
            "description": "User-facing reason the upload failed. Present only for failures with a known, displayable cause; safe to show end users verbatim."
          },
          "detection": {
            "type": "object",
            "properties": {
              "outcome": {
                "type": "string",
                "enum": ["detected", "no_signature_fields", "failed"]
              },
              "participantCount": {
                "type": "integer",
                "minimum": 0
              },
              "signatureFieldCount": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": ["outcome", "participantCount", "signatureFieldCount"],
            "additionalProperties": false
          },
          "canFindSignatures": {
            "type": "boolean"
          }
        },
        "required": ["documentId", "flowId", "status", "updatedAt"]
      },
      "PublicSubmissionResponse": {
        "type": "object",
        "properties": {
          "submissionId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": ["draft", "in_progress", "completed", "voided"]
          },
          "activeParticipantIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "signers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "participantId": {
                  "type": "string"
                },
                "label": {
                  "type": ["string", "null"]
                },
                "fullName": {
                  "type": ["string", "null"]
                },
                "email": {
                  "type": ["string", "null"]
                },
                "routingOrder": {
                  "type": "integer"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "queued",
                    "invited",
                    "pending",
                    "signing",
                    "completed",
                    "skipped"
                  ]
                }
              },
              "required": [
                "participantId",
                "label",
                "fullName",
                "email",
                "routingOrder",
                "status"
              ]
            }
          }
        },
        "required": [
          "submissionId",
          "status",
          "activeParticipantIds",
          "signers"
        ]
      },
      "PublicListSubmissionsResponse": {
        "type": "object",
        "properties": {
          "submissions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "submissionId": {
                  "type": "string",
                  "format": "uuid"
                },
                "status": {
                  "type": "string",
                  "enum": ["draft", "in_progress", "completed", "voided"]
                },
                "activeParticipantIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "signers": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "participantId": {
                        "type": "string"
                      },
                      "label": {
                        "type": ["string", "null"]
                      },
                      "fullName": {
                        "type": ["string", "null"]
                      },
                      "email": {
                        "type": ["string", "null"]
                      },
                      "routingOrder": {
                        "type": "integer"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "queued",
                          "invited",
                          "pending",
                          "signing",
                          "completed",
                          "skipped"
                        ]
                      }
                    },
                    "required": [
                      "participantId",
                      "label",
                      "fullName",
                      "email",
                      "routingOrder",
                      "status"
                    ]
                  }
                }
              },
              "required": [
                "submissionId",
                "status",
                "activeParticipantIds",
                "signers"
              ]
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["submissions", "hasMore", "nextCursor"]
      },
      "PublicCreateSubmissionRequest": {
        "type": "object",
        "properties": {
          "notify": {
            "type": "boolean"
          },
          "participants": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "participantId": {
                  "type": "string",
                  "minLength": 1
                },
                "fullName": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "phone": {
                  "type": "string"
                },
                "routingOrder": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "required": ["participantId"],
              "additionalProperties": false
            },
            "minItems": 1
          }
        },
        "required": ["notify"],
        "additionalProperties": false
      },
      "PublicShareLinkRequest": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "PublicShareLinkResponse": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "mode": {
            "type": "string",
            "enum": ["flow_token"]
          }
        },
        "required": ["url", "mode"],
        "additionalProperties": false
      },
      "PublicResendSubmissionRequest": {
        "type": "object",
        "properties": {
          "participantId": {
            "type": "string",
            "format": "uuid",
            "description": "When set, re-sends signing invitations only to this participant if they are an eligible signer (status queued, invited, or pending) in the active routing order group; returns 400 if the participant is not eligible. When omitted, re-sends to all eligible contactable signers in that group."
          }
        },
        "additionalProperties": false
      },
      "PublicSigningLinkRequest": {
        "type": "object",
        "properties": {
          "participantId": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": ["participantId"],
        "additionalProperties": false
      },
      "PublicSigningLinkResponse": {
        "type": "object",
        "properties": {
          "participantId": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          }
        },
        "required": ["participantId", "url", "expiresAt"]
      },
      "PublicVoidSubmissionRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "PublicListDocumentUploadsResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "documentId": {
                  "type": "string",
                  "format": "uuid"
                },
                "flowId": {
                  "type": "string",
                  "format": "uuid"
                },
                "collectionId": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "awaiting_upload",
                    "uploaded",
                    "processing",
                    "ready",
                    "failed"
                  ]
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "pollAfterMs": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "default": 2000
                },
                "error": {
                  "type": "string",
                  "enum": ["invalid_pdf", "processing_failed"]
                },
                "errorMessage": {
                  "type": "string",
                  "minLength": 1,
                  "description": "User-facing reason the upload failed. Present only for failures with a known, displayable cause; safe to show end users verbatim."
                },
                "detection": {
                  "type": "object",
                  "properties": {
                    "outcome": {
                      "type": "string",
                      "enum": ["detected", "no_signature_fields", "failed"]
                    },
                    "participantCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "signatureFieldCount": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "outcome",
                    "participantCount",
                    "signatureFieldCount"
                  ],
                  "additionalProperties": false
                },
                "canFindSignatures": {
                  "type": "boolean"
                },
                "fileName": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "documentId",
                "flowId",
                "status",
                "updatedAt",
                "fileName"
              ]
            }
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["items", "nextCursor"]
      },
      "PublicDocumentUploadCreateRequest": {
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid"
          },
          "packageId": {
            "type": "string",
            "format": "uuid"
          },
          "file": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              },
              "size": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 52428800
              },
              "contentType": {
                "type": "string",
                "enum": ["application/pdf"]
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": ["name", "size", "contentType"],
            "additionalProperties": false
          }
        },
        "required": ["dealId", "packageId", "file"],
        "additionalProperties": false
      },
      "PublicDocumentUploadCreateResponse": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "format": "uuid"
          },
          "flowId": {
            "type": "string",
            "format": "uuid"
          },
          "fileName": {
            "type": "string",
            "minLength": 1
          },
          "uploadUrl": {
            "type": "string",
            "format": "uri"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": ["documentId", "flowId", "fileName", "uploadUrl"]
      },
      "PublicListInsightDocumentsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "folderId": {
                  "type": ["string", "null"],
                  "format": "uuid"
                },
                "sizeBytes": {
                  "type": "integer",
                  "minimum": 0
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "status": {
                  "type": "string",
                  "enum": ["pending", "processing", "processed", "failed"]
                },
                "stage": {
                  "type": ["string", "null"]
                },
                "failureKind": {
                  "type": ["string", "null"],
                  "enum": ["transient", "permanent", "stalled", null]
                },
                "documentType": {
                  "type": ["string", "null"],
                  "enum": [
                    "Purchase",
                    "Lease",
                    "Listing Agreement",
                    "Addendum",
                    "Amendment",
                    "Disclosure",
                    "Commission Agreement",
                    "Loan",
                    "Insurance",
                    "Inspection",
                    "Escrow",
                    "Closing Statement",
                    "Title",
                    "Power of Attorney",
                    "Rental Application",
                    "Notice",
                    "Association",
                    "Registration",
                    "Trust",
                    "Information",
                    "Licensing",
                    "Compliance",
                    "Legal",
                    "Financial",
                    "Employment",
                    "Corporate",
                    "Government",
                    "Other",
                    null
                  ]
                },
                "contractStatus": {
                  "type": ["string", "null"],
                  "enum": ["draft", "executed", "expired", "unknown", null]
                },
                "extracted": {
                  "type": "object",
                  "properties": {
                    "parties": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "entityType": {
                            "type": "string",
                            "enum": [
                              "individual",
                              "organization",
                              "trust",
                              "unknown"
                            ]
                          },
                          "contactInfo": {
                            "type": "object",
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "phone": {
                                "type": "string"
                              },
                              "address": {
                                "type": "string"
                              }
                            }
                          },
                          "representedBy": {
                            "type": "string"
                          }
                        },
                        "required": ["role", "name"]
                      }
                    },
                    "address": {
                      "type": ["string", "null"]
                    },
                    "keyDates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          }
                        },
                        "required": ["type", "value"]
                      }
                    },
                    "amounts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "period": {
                            "type": "string"
                          }
                        },
                        "required": ["type", "value"]
                      }
                    },
                    "keyTerms": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "parties",
                    "address",
                    "keyDates",
                    "amounts",
                    "keyTerms"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "folderId",
                "sizeBytes",
                "createdAt",
                "status",
                "stage",
                "failureKind",
                "documentType",
                "contractStatus"
              ]
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["data", "hasMore", "nextCursor"]
      },
      "PublicInsightDocumentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "folderId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": ["pending", "processing", "processed", "failed"]
          },
          "stage": {
            "type": ["string", "null"]
          },
          "failureKind": {
            "type": ["string", "null"],
            "enum": ["transient", "permanent", "stalled", null]
          },
          "documentType": {
            "type": ["string", "null"],
            "enum": [
              "Purchase",
              "Lease",
              "Listing Agreement",
              "Addendum",
              "Amendment",
              "Disclosure",
              "Commission Agreement",
              "Loan",
              "Insurance",
              "Inspection",
              "Escrow",
              "Closing Statement",
              "Title",
              "Power of Attorney",
              "Rental Application",
              "Notice",
              "Association",
              "Registration",
              "Trust",
              "Information",
              "Licensing",
              "Compliance",
              "Legal",
              "Financial",
              "Employment",
              "Corporate",
              "Government",
              "Other",
              null
            ]
          },
          "contractStatus": {
            "type": ["string", "null"],
            "enum": ["draft", "executed", "expired", "unknown", null]
          },
          "extracted": {
            "type": "object",
            "properties": {
              "parties": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "entityType": {
                      "type": "string",
                      "enum": ["individual", "organization", "trust", "unknown"]
                    },
                    "contactInfo": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "phone": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        }
                      }
                    },
                    "representedBy": {
                      "type": "string"
                    }
                  },
                  "required": ["role", "name"]
                }
              },
              "address": {
                "type": ["string", "null"]
              },
              "keyDates": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": ["type", "value"]
                }
              },
              "amounts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "period": {
                      "type": "string"
                    }
                  },
                  "required": ["type", "value"]
                }
              },
              "keyTerms": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "parties",
              "address",
              "keyDates",
              "amounts",
              "keyTerms"
            ]
          },
          "pollAfterMs": {
            "type": "integer",
            "exclusiveMinimum": 0
          }
        },
        "required": [
          "id",
          "name",
          "folderId",
          "sizeBytes",
          "createdAt",
          "status",
          "stage",
          "failureKind",
          "documentType",
          "contractStatus"
        ]
      },
      "PublicListInsightFoldersResponse": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid"
            },
            "name": {
              "type": "string"
            },
            "parentId": {
              "type": ["string", "null"],
              "format": "uuid"
            },
            "path": {
              "type": "string"
            }
          },
          "required": ["id", "name", "parentId", "path"]
        }
      },
      "PublicCreateInsightFolderRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "parentId": {
            "type": ["string", "null"],
            "format": "uuid"
          }
        },
        "required": ["name"]
      },
      "PublicInsightFolder": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "parentId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "path": {
            "type": "string"
          }
        },
        "required": ["id", "name", "parentId", "path"]
      },
      "PublicBeginInsightUploadRequest": {
        "type": "object",
        "properties": {
          "fileName": {
            "type": "string",
            "minLength": 1
          },
          "size": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 52428800
          },
          "contentType": {
            "type": "string",
            "enum": ["application/pdf"]
          },
          "folderId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": ["fileName", "size", "contentType"]
      },
      "PublicBeginInsightUploadResponse": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "format": "uuid"
          },
          "uploadUrl": {
            "type": "string",
            "format": "uri"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": ["documentId", "uploadUrl", "expiresAt"]
      },
      "PublicCompleteInsightUploadRequest": {
        "type": "object",
        "properties": {
          "fileName": {
            "type": "string",
            "minLength": 1
          },
          "folderId": {
            "type": ["string", "null"],
            "format": "uuid"
          }
        },
        "required": ["fileName"]
      },
      "PublicCompleteInsightUploadResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "folderId": {
            "type": ["string", "null"],
            "format": "uuid"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": ["pending", "processing", "processed", "failed"]
          },
          "stage": {
            "type": ["string", "null"]
          },
          "failureKind": {
            "type": ["string", "null"],
            "enum": ["transient", "permanent", "stalled", null]
          },
          "documentType": {
            "type": ["string", "null"],
            "enum": [
              "Purchase",
              "Lease",
              "Listing Agreement",
              "Addendum",
              "Amendment",
              "Disclosure",
              "Commission Agreement",
              "Loan",
              "Insurance",
              "Inspection",
              "Escrow",
              "Closing Statement",
              "Title",
              "Power of Attorney",
              "Rental Application",
              "Notice",
              "Association",
              "Registration",
              "Trust",
              "Information",
              "Licensing",
              "Compliance",
              "Legal",
              "Financial",
              "Employment",
              "Corporate",
              "Government",
              "Other",
              null
            ]
          },
          "contractStatus": {
            "type": ["string", "null"],
            "enum": ["draft", "executed", "expired", "unknown", null]
          },
          "extracted": {
            "type": "object",
            "properties": {
              "parties": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "entityType": {
                      "type": "string",
                      "enum": ["individual", "organization", "trust", "unknown"]
                    },
                    "contactInfo": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "phone": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        }
                      }
                    },
                    "representedBy": {
                      "type": "string"
                    }
                  },
                  "required": ["role", "name"]
                }
              },
              "address": {
                "type": ["string", "null"]
              },
              "keyDates": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": ["type", "value"]
                }
              },
              "amounts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "period": {
                      "type": "string"
                    }
                  },
                  "required": ["type", "value"]
                }
              },
              "keyTerms": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "parties",
              "address",
              "keyDates",
              "amounts",
              "keyTerms"
            ]
          },
          "pollAfterMs": {
            "type": "integer",
            "exclusiveMinimum": 0
          }
        },
        "required": [
          "id",
          "name",
          "folderId",
          "sizeBytes",
          "createdAt",
          "status",
          "stage",
          "failureKind",
          "documentType",
          "contractStatus"
        ]
      },
      "PublicListContactsResponse": {
        "type": "object",
        "properties": {
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicContact"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["contacts", "hasMore", "nextCursor"]
      },
      "PublicContact": {
        "type": "object",
        "properties": {
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "fullName": {
            "type": "string"
          },
          "email": {
            "type": ["string", "null"]
          },
          "phone": {
            "type": ["string", "null"]
          },
          "emails": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "phones": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "addresses": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "placeId": {
                  "type": ["string", "null"]
                },
                "formatted": {
                  "type": "string"
                },
                "components": {
                  "type": "object",
                  "properties": {
                    "line1": {
                      "type": "string"
                    },
                    "line2": {
                      "type": "string"
                    },
                    "city": {
                      "type": "string"
                    },
                    "region": {
                      "type": "string"
                    },
                    "postalCode": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "line1",
                    "line2",
                    "city",
                    "region",
                    "postalCode",
                    "country"
                  ]
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["placeId", "formatted", "components", "label"]
            }
          },
          "companies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "The company this contact is linked to."
                },
                "name": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "description": "The contact's title at this company."
                }
              },
              "required": ["id", "name"]
            },
            "description": "The contact's companies, default first. Writing `companies` replaces the whole list; its first entry becomes the default."
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dealActivity": {
            "type": "string",
            "enum": ["active", "archived", "none"]
          },
          "dealsCount": {
            "type": "integer"
          },
          "lastActivityAt": {
            "type": ["string", "null"]
          },
          "firstSeenAt": {
            "type": ["string", "null"]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "linked": {
            "type": "boolean"
          },
          "contactUrl": {
            "type": "string"
          }
        },
        "required": [
          "contactId",
          "fullName",
          "email",
          "phone",
          "emails",
          "phones",
          "addresses",
          "companies",
          "links",
          "tags",
          "dealActivity",
          "dealsCount",
          "lastActivityAt",
          "firstSeenAt",
          "createdAt",
          "updatedAt",
          "linked",
          "contactUrl"
        ]
      },
      "PublicGetContactResponse": {
        "type": "object",
        "properties": {
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "fullName": {
            "type": "string"
          },
          "email": {
            "type": ["string", "null"]
          },
          "phone": {
            "type": ["string", "null"]
          },
          "emails": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "phones": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "addresses": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "placeId": {
                  "type": ["string", "null"]
                },
                "formatted": {
                  "type": "string"
                },
                "components": {
                  "type": "object",
                  "properties": {
                    "line1": {
                      "type": "string"
                    },
                    "line2": {
                      "type": "string"
                    },
                    "city": {
                      "type": "string"
                    },
                    "region": {
                      "type": "string"
                    },
                    "postalCode": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "line1",
                    "line2",
                    "city",
                    "region",
                    "postalCode",
                    "country"
                  ]
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["placeId", "formatted", "components", "label"]
            }
          },
          "companies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "The company this contact is linked to."
                },
                "name": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "description": "The contact's title at this company."
                }
              },
              "required": ["id", "name"]
            },
            "description": "The contact's companies, default first. Writing `companies` replaces the whole list; its first entry becomes the default."
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dealActivity": {
            "type": "string",
            "enum": ["active", "archived", "none"]
          },
          "dealsCount": {
            "type": "integer"
          },
          "lastActivityAt": {
            "type": ["string", "null"]
          },
          "firstSeenAt": {
            "type": ["string", "null"]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "linked": {
            "type": "boolean"
          },
          "contactUrl": {
            "type": "string"
          }
        },
        "required": [
          "contactId",
          "fullName",
          "email",
          "phone",
          "emails",
          "phones",
          "addresses",
          "companies",
          "links",
          "tags",
          "dealActivity",
          "dealsCount",
          "lastActivityAt",
          "firstSeenAt",
          "createdAt",
          "updatedAt",
          "linked",
          "contactUrl"
        ]
      },
      "PublicCreateContactRequest": {
        "type": "object",
        "properties": {
          "fullName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "emails": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value"]
            },
            "default": []
          },
          "phones": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value"]
            },
            "default": []
          },
          "addresses": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "placeId": {
                  "type": ["string", "null"],
                  "minLength": 1,
                  "default": null
                },
                "formatted": {
                  "type": "string",
                  "maxLength": 500,
                  "default": ""
                },
                "components": {
                  "type": "object",
                  "properties": {
                    "line1": {
                      "type": "string",
                      "maxLength": 200,
                      "default": ""
                    },
                    "line2": {
                      "type": "string",
                      "maxLength": 200,
                      "default": ""
                    },
                    "city": {
                      "type": "string",
                      "maxLength": 120,
                      "default": ""
                    },
                    "region": {
                      "type": "string",
                      "maxLength": 120,
                      "default": ""
                    },
                    "postalCode": {
                      "type": "string",
                      "maxLength": 40,
                      "default": ""
                    },
                    "country": {
                      "type": "string",
                      "maxLength": 120,
                      "default": ""
                    }
                  },
                  "default": {
                    "line1": "",
                    "line2": "",
                    "city": "",
                    "region": "",
                    "postalCode": "",
                    "country": ""
                  }
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              }
            },
            "default": []
          },
          "companies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "role": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                }
              },
              "required": ["name"]
            },
            "default": []
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string",
                  "minLength": 1
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value"]
            },
            "default": []
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            },
            "maxItems": 20
          }
        },
        "required": ["fullName"]
      },
      "PublicCreateContactResponse": {
        "type": "object",
        "properties": {
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "fullName": {
            "type": "string"
          },
          "email": {
            "type": ["string", "null"]
          },
          "phone": {
            "type": ["string", "null"]
          },
          "emails": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "phones": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "addresses": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "placeId": {
                  "type": ["string", "null"]
                },
                "formatted": {
                  "type": "string"
                },
                "components": {
                  "type": "object",
                  "properties": {
                    "line1": {
                      "type": "string"
                    },
                    "line2": {
                      "type": "string"
                    },
                    "city": {
                      "type": "string"
                    },
                    "region": {
                      "type": "string"
                    },
                    "postalCode": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "line1",
                    "line2",
                    "city",
                    "region",
                    "postalCode",
                    "country"
                  ]
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["placeId", "formatted", "components", "label"]
            }
          },
          "companies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "The company this contact is linked to."
                },
                "name": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "description": "The contact's title at this company."
                }
              },
              "required": ["id", "name"]
            },
            "description": "The contact's companies, default first. Writing `companies` replaces the whole list; its first entry becomes the default."
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dealActivity": {
            "type": "string",
            "enum": ["active", "archived", "none"]
          },
          "dealsCount": {
            "type": "integer"
          },
          "lastActivityAt": {
            "type": ["string", "null"]
          },
          "firstSeenAt": {
            "type": ["string", "null"]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "linked": {
            "type": "boolean"
          },
          "contactUrl": {
            "type": "string"
          }
        },
        "required": [
          "contactId",
          "fullName",
          "email",
          "phone",
          "emails",
          "phones",
          "addresses",
          "companies",
          "links",
          "tags",
          "dealActivity",
          "dealsCount",
          "lastActivityAt",
          "firstSeenAt",
          "createdAt",
          "updatedAt",
          "linked",
          "contactUrl"
        ]
      },
      "PublicUpdateContactRequest": {
        "type": "object",
        "properties": {
          "fullName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "emails": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value"]
            }
          },
          "phones": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value"]
            }
          },
          "addresses": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "placeId": {
                  "type": ["string", "null"],
                  "minLength": 1,
                  "default": null
                },
                "formatted": {
                  "type": "string",
                  "maxLength": 500,
                  "default": ""
                },
                "components": {
                  "type": "object",
                  "properties": {
                    "line1": {
                      "type": "string",
                      "maxLength": 200,
                      "default": ""
                    },
                    "line2": {
                      "type": "string",
                      "maxLength": 200,
                      "default": ""
                    },
                    "city": {
                      "type": "string",
                      "maxLength": 120,
                      "default": ""
                    },
                    "region": {
                      "type": "string",
                      "maxLength": 120,
                      "default": ""
                    },
                    "postalCode": {
                      "type": "string",
                      "maxLength": 40,
                      "default": ""
                    },
                    "country": {
                      "type": "string",
                      "maxLength": 120,
                      "default": ""
                    }
                  },
                  "default": {
                    "line1": "",
                    "line2": "",
                    "city": "",
                    "region": "",
                    "postalCode": "",
                    "country": ""
                  }
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              }
            }
          },
          "companies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "role": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                }
              },
              "required": ["name"]
            }
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string",
                  "minLength": 1
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value"]
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            },
            "maxItems": 20
          }
        }
      },
      "PublicUpdateContactResponse": {
        "type": "object",
        "properties": {
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "fullName": {
            "type": "string"
          },
          "email": {
            "type": ["string", "null"]
          },
          "phone": {
            "type": ["string", "null"]
          },
          "emails": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "phones": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "addresses": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "placeId": {
                  "type": ["string", "null"]
                },
                "formatted": {
                  "type": "string"
                },
                "components": {
                  "type": "object",
                  "properties": {
                    "line1": {
                      "type": "string"
                    },
                    "line2": {
                      "type": "string"
                    },
                    "city": {
                      "type": "string"
                    },
                    "region": {
                      "type": "string"
                    },
                    "postalCode": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "line1",
                    "line2",
                    "city",
                    "region",
                    "postalCode",
                    "country"
                  ]
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["placeId", "formatted", "components", "label"]
            }
          },
          "companies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "The company this contact is linked to."
                },
                "name": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "description": "The contact's title at this company."
                }
              },
              "required": ["id", "name"]
            },
            "description": "The contact's companies, default first. Writing `companies` replaces the whole list; its first entry becomes the default."
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "enum": ["personal", "work"]
                }
              },
              "required": ["value", "label"]
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dealActivity": {
            "type": "string",
            "enum": ["active", "archived", "none"]
          },
          "dealsCount": {
            "type": "integer"
          },
          "lastActivityAt": {
            "type": ["string", "null"]
          },
          "firstSeenAt": {
            "type": ["string", "null"]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "linked": {
            "type": "boolean"
          },
          "contactUrl": {
            "type": "string"
          }
        },
        "required": [
          "contactId",
          "fullName",
          "email",
          "phone",
          "emails",
          "phones",
          "addresses",
          "companies",
          "links",
          "tags",
          "dealActivity",
          "dealsCount",
          "lastActivityAt",
          "firstSeenAt",
          "createdAt",
          "updatedAt",
          "linked",
          "contactUrl"
        ]
      },
      "PublicListDealWizardsResponse": {
        "type": "object",
        "properties": {
          "wizards": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "wizardId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": ["string", "null"]
                },
                "questionCount": {
                  "type": "integer"
                },
                "definitionVersion": {
                  "type": "string",
                  "description": "Send back on next and submit to detect a wizard edited mid-run"
                }
              },
              "required": [
                "wizardId",
                "name",
                "description",
                "questionCount",
                "definitionVersion"
              ]
            }
          }
        },
        "required": ["wizards"]
      },
      "PublicMatchDealWizardRequest": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "minLength": 2,
            "maxLength": 500,
            "description": "What the user wants to create, in their words, e.g. \"Florida commercial lease\""
          }
        },
        "required": ["description"]
      },
      "PublicMatchDealWizardResponse": {
        "type": "object",
        "properties": {
          "match": {
            "type": ["object", "null"],
            "properties": {
              "wizard": {
                "type": "object",
                "properties": {
                  "wizardId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": ["string", "null"]
                  },
                  "questionCount": {
                    "type": "integer"
                  },
                  "definitionVersion": {
                    "type": "string",
                    "description": "Send back on next and submit to detect a wizard edited mid-run"
                  }
                },
                "required": [
                  "wizardId",
                  "name",
                  "description",
                  "questionCount",
                  "definitionVersion"
                ]
              },
              "matchedOn": {
                "type": "string",
                "enum": ["type_word", "deal_noun", "catalog_term", "fallback"]
              },
              "score": {
                "type": ["number", "null"]
              }
            },
            "required": ["wizard", "matchedOn", "score"]
          },
          "alternatives": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "wizardId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": ["string", "null"]
                },
                "questionCount": {
                  "type": "integer"
                },
                "definitionVersion": {
                  "type": "string",
                  "description": "Send back on next and submit to detect a wizard edited mid-run"
                }
              },
              "required": [
                "wizardId",
                "name",
                "description",
                "questionCount",
                "definitionVersion"
              ]
            }
          },
          "templateAlternatives": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "templateDealId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "score": {
                  "type": "number"
                }
              },
              "required": ["templateDealId", "name", "score"]
            }
          },
          "question": {
            "type": ["object", "null"],
            "properties": {
              "id": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "helpText": {
                "type": ["string", "null"]
              },
              "kind": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "answerFormat": {
                "type": "string"
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    }
                  },
                  "required": ["value", "label"]
                }
              },
              "min": {
                "type": "number"
              },
              "max": {
                "type": "number"
              },
              "suffix": {
                "type": "string"
              },
              "placeholder": {
                "type": "string"
              },
              "base": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "questionId": {
                        "type": "string"
                      }
                    },
                    "required": ["questionId"]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "dataSource": {
                        "type": "object",
                        "properties": {
                          "service": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          }
                        },
                        "required": ["service", "path"]
                      }
                    },
                    "required": ["dataSource"]
                  }
                ]
              },
              "propertyLookup": {
                "type": "boolean"
              },
              "folderTypeKey": {
                "type": "string"
              },
              "withinQuestionId": {
                "type": "string"
              },
              "groupId": {
                "type": "string"
              },
              "groupLabel": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "label",
              "helpText",
              "kind",
              "required",
              "answerFormat"
            ]
          }
        },
        "required": [
          "match",
          "alternatives",
          "templateAlternatives",
          "question"
        ]
      },
      "PublicWizardAnswersRequest": {
        "type": "object",
        "properties": {
          "answers": {
            "type": "object",
            "additionalProperties": {},
            "description": "Every answer so far, keyed by question id. Send null to skip an optional question. See each question answerFormat."
          },
          "definitionVersion": {
            "type": "string"
          }
        },
        "required": ["answers"]
      },
      "PublicNextWizardQuestionResponse": {
        "type": "object",
        "properties": {
          "definitionVersion": {
            "type": "string"
          },
          "wizardName": {
            "type": "string"
          },
          "complete": {
            "type": "boolean",
            "description": "True when every visible question is answered or skipped"
          },
          "question": {
            "type": ["object", "null"],
            "properties": {
              "id": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "helpText": {
                "type": ["string", "null"]
              },
              "kind": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "answerFormat": {
                "type": "string"
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    }
                  },
                  "required": ["value", "label"]
                }
              },
              "min": {
                "type": "number"
              },
              "max": {
                "type": "number"
              },
              "suffix": {
                "type": "string"
              },
              "placeholder": {
                "type": "string"
              },
              "base": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "questionId": {
                        "type": "string"
                      }
                    },
                    "required": ["questionId"]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "dataSource": {
                        "type": "object",
                        "properties": {
                          "service": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          }
                        },
                        "required": ["service", "path"]
                      }
                    },
                    "required": ["dataSource"]
                  }
                ]
              },
              "propertyLookup": {
                "type": "boolean"
              },
              "folderTypeKey": {
                "type": "string"
              },
              "withinQuestionId": {
                "type": "string"
              },
              "groupId": {
                "type": "string"
              },
              "groupLabel": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "label",
              "helpText",
              "kind",
              "required",
              "answerFormat"
            ]
          },
          "prefill": {
            "type": "object",
            "additionalProperties": {},
            "description": "Answers the property lookup filled in; confirm them with the user"
          },
          "lookup": {
            "type": "string",
            "enum": [
              "not_needed",
              "skipped_no_permission",
              "found",
              "not_found",
              "provider_error"
            ]
          },
          "progress": {
            "type": ["object", "null"],
            "properties": {
              "position": {
                "type": "integer",
                "minimum": 1
              },
              "total": {
                "type": "integer",
                "minimum": 1
              }
            },
            "required": ["position", "total"],
            "description": "Place of the returned question among the questions that apply to the current answers; null when complete. The total can change as answers open or close branches."
          }
        },
        "required": [
          "definitionVersion",
          "wizardName",
          "complete",
          "question",
          "prefill",
          "lookup"
        ]
      },
      "PublicCreateDealFromWizardResponse": {
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "packageId": {
            "type": "string",
            "format": "uuid"
          },
          "dealUrl": {
            "type": "string",
            "format": "uri"
          },
          "documentsUrl": {
            "type": "string",
            "format": "uri"
          },
          "isTemplate": {
            "type": "boolean",
            "description": "Present and true only when a template was created."
          },
          "prepareUrl": {
            "type": "string",
            "format": "uri",
            "description": "Template only: where fields and signer roles are set up."
          },
          "suggestedTemplates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "templateDealId": {
                  "type": ["string", "null"]
                },
                "required": {
                  "type": "boolean"
                },
                "reason": {
                  "type": "string"
                }
              },
              "required": ["name", "templateDealId", "required", "reason"]
            },
            "description": "Not attached. Attach with addTemplatesToPackage using templateDealId."
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "step": {
                  "type": "string",
                  "enum": [
                    "property_lookup",
                    "template_suggestions",
                    "listing_filing"
                  ]
                },
                "message": {
                  "type": "string"
                }
              },
              "required": ["step", "message"]
            }
          }
        },
        "required": [
          "dealId",
          "name",
          "packageId",
          "suggestedTemplates",
          "warnings"
        ]
      },
      "PublicCreateDealTemplateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Name for the new template. Confirm it with the user before calling."
          }
        },
        "required": ["name"],
        "additionalProperties": false
      },
      "PublicDealTemplateResponse": {
        "type": "object",
        "properties": {
          "templateDealId": {
            "type": "string",
            "format": "uuid",
            "description": "The new template. It is a separate copy of the deal."
          },
          "name": {
            "type": "string"
          },
          "packageId": {
            "type": ["string", "null"],
            "format": "uuid",
            "description": "First package of the template; null when the deal had none."
          },
          "sourceDealId": {
            "type": "string",
            "format": "uuid",
            "description": "The deal that was copied. It still exists, unchanged."
          },
          "prepareUrl": {
            "type": "string",
            "description": "Builder link for placing fields on the template."
          },
          "sourceDealUrl": {
            "type": "string",
            "description": "Link to the original deal."
          }
        },
        "required": ["templateDealId", "name", "packageId", "sourceDealId"]
      }
    },
    "parameters": {}
  },
  "paths": {
    "/api/v1/openapi.json": {
      "get": {
        "operationId": "getOpenApiDocument",
        "summary": "Get the Public API OpenAPI document",
        "description": "Returns the committed OpenAPI 3.1 specification for Public API v1. No authentication required.",
        "tags": ["OpenAPI"],
        "security": [],
        "responses": {
          "200": {
            "description": "OpenAPI 3.1 JSON document",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Short-lived or no-cache to avoid stale CDN spec"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiOpenApiDocument"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/key": {
      "get": {
        "operationId": "getApiKey",
        "summary": "Introspect the authenticated API key",
        "description": "Returns metadata for the Bearer-authenticated API key, including scopes and allowed organizations.",
        "tags": ["API keys"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Key metadata for the authenticated Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyIntrospectionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs": {
      "get": {
        "operationId": "listOrgs",
        "summary": "List organizations the API key may call",
        "description": "Returns id and name for each organization on the authenticated API key allowlist. Omits organizations the bound user has left. Name is null when the organization row is missing or deleted.",
        "tags": ["API keys"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Allowed organizations for the authenticated Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListOrgsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/deals": {
      "get": {
        "operationId": "listDeals",
        "summary": "List deals",
        "description": "Returns a cursor-paginated list of deals for the API key bound user in the specified organization. Optionally filter by name or address with the search query parameter, or by catalog tag labels with the tags query parameter. Pass isTemplate=true to list deal templates; each item then carries templateSource.\n\nRequires one of `api_deals_list` or `api_deals_create`.",
        "tags": ["Deals"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Optional name/address filter. Non-empty values match deal name and property address; blank or whitespace-only values use the recents list. Without cursor, non-empty values try relevance ranking first: up to limit top matches (hasMore false, nextCursor null). If ranking finds nothing, falls back to substring matching with normal cursor pagination."
            },
            "required": false,
            "description": "Optional name/address filter. Non-empty values match deal name and property address; blank or whitespace-only values use the recents list. Without cursor, non-empty values try relevance ranking first: up to limit top matches (hasMore false, nextCursor null). If ranking finds nothing, falls back to substring matching with normal cursor pagination.",
            "name": "search",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["created_at", "updated_at"],
              "description": "Sort column for the deal list",
              "example": "created_at"
            },
            "required": false,
            "description": "Sort column for the deal list",
            "name": "orderBy",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["true", "false"],
              "description": "When true, sort ascending instead of descending",
              "example": "false"
            },
            "required": false,
            "description": "When true, sort ascending instead of descending",
            "name": "ascending",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Maximum number of deals to return (1-100)",
              "example": 50
            },
            "required": false,
            "description": "Maximum number of deals to return (1-100)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Opaque pagination cursor from a previous response. With search, bypasses relevance ranking and paginates substring matches ordered by orderBy instead."
            },
            "required": false,
            "description": "Opaque pagination cursor from a previous response. With search, bypasses relevance ranking and paginates substring matches ordered by orderBy instead.",
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated catalog labels, up to 20. A deal matches when its tags array contains any of them. Labels match the stored casing exactly.",
              "example": "priority,listing"
            },
            "required": false,
            "description": "Comma-separated catalog labels, up to 20. A deal matches when its tags array contains any of them. Labels match the stored casing exactly.",
            "name": "tags",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["true", "false"],
              "description": "When true, list the org's deal templates (yours and the org library) instead of deals. Global templates are not included.",
              "example": "false"
            },
            "required": false,
            "description": "When true, list the org's deal templates (yours and the org library) instead of deals. Global templates are not included.",
            "name": "isTemplate",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Deal page for the authenticated API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListDealsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createDeal",
        "summary": "Create a deal",
        "description": "Creates a deal in the specified organization for the API key bound user. Send deal fields with name, or templateDealIds alone (from listDeals with isTemplate=true): one id copies the template, several merge their documents into one package. Send isTemplate=true with name to create a reusable template instead of a deal; the template is personal to the bound user, needs a plan that includes templates, and the response adds isTemplate and prepareUrl. isTemplate cannot be combined with templateDealIds. Set sale vs lease and pricing on the deal here (`transactionType`, `amount`, `deposit`, `startDate`, `financingType`); updatePackage only renames a package (`name`). Denied fields such as teamId and templateDealId are rejected before Zod validation. Idempotency-Key is required and enforced server-side for safe retries.\n\nRequires the `api_deals_create` scope.",
        "tags": ["Deals"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Client-supplied idempotency key; reuse the same value when retrying after a lost response so the server does not create a duplicate deal",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Client-supplied idempotency key; reuse the same value when retrying after a lost response so the server does not create a duplicate deal",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicCreateDealRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Deal created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCreateDealResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `IDEMPOTENCY_HASH_MISMATCH` when the same Idempotency-Key is reused with a different request body; retries with the same body replay the original success response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/deals/{dealId}/packages/{packageId}/templates": {
      "post": {
        "operationId": "addTemplatesToPackage",
        "summary": "Add templates to a package",
        "description": "Merges the document flows of one or more deal templates (from listDeals with isTemplate=true) into an existing package. Requires the `api_deals_create` scope and the bound user's edit access to the deal. Idempotency-Key is required and enforced server-side for safe retries.",
        "tags": ["Deals"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the package",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the package",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Package ID",
              "example": "550e8400-e29b-41d4-a716-446655440011"
            },
            "required": true,
            "description": "Package ID",
            "name": "packageId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe add-templates retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe add-templates retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicAddTemplatesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Templates merged into the package",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAddTemplatesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `IDEMPOTENCY_HASH_MISMATCH` when the same Idempotency-Key is reused with a different request body; retries with the same body replay the original success response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/tasks": {
      "post": {
        "operationId": "createTask",
        "summary": "Create a task",
        "description": "Creates a task in the organization. `dealId` is optional; `packageId` and `submissionId` require a deal.\n\nRequires the `api_tasks_create` scope and an `Idempotency-Key` header for safe retries.\n\n## Checklists\n\nA checklist is a task with `type: \"checklist\"`. Its items are tasks with `parentId` set to the `taskId` of the checklist.\n\n1. Create the checklist. `dealId` is optional:\n\n   ```json\n   { \"title\": \"Closing checklist\", \"type\": \"checklist\" }\n   ```\n\n2. Create each item with the `taskId` from step 1:\n\n   ```json\n   { \"title\": \"Order title search\", \"parentId\": \"<checklist taskId>\" }\n   ```\n\n`parentId` must point to a checklist (`422 PARENT_NOT_CHECKLIST`) whose deal matches, including when both are unset (`400 ASSOCIATION_MISMATCH`).\n\nA template deal accepts `dealId` and `packageId` (not `submissionId`). Its tasks are copied into deals created from the template and never notify assignees.",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe create-task retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe create-task retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicCreateTaskRequest"
              },
              "examples": {
                "generalTask": {
                  "summary": "General task",
                  "value": {
                    "title": "Order title search",
                    "type": "general",
                    "dueDate": "2026-09-15T17:00:00-04:00"
                  }
                },
                "checklistParent": {
                  "summary": "Checklist",
                  "description": "A checklist may omit `dealId`. Its items omit it too.",
                  "value": {
                    "title": "Closing checklist",
                    "type": "checklist",
                    "dealId": "550e8400-e29b-41d4-a716-446655440010"
                  }
                },
                "checklistItem": {
                  "summary": "Checklist item",
                  "description": "Set `parentId` to the `taskId` of the checklist.",
                  "value": {
                    "title": "Order title search",
                    "parentId": "550e8400-e29b-41d4-a716-446655440020"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Task created (or replayed for a matching Idempotency-Key)",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque task version for If-Match on PATCH"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCreateTaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `IDEMPOTENCY_HASH_MISMATCH` when the same Idempotency-Key is reused with a different request body; retries with the same body replay the original success response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listTasks",
        "summary": "List tasks",
        "description": "Returns a cursor-paginated list of tasks visible to the API key in the organization. Poll with `updatedSince` and `cursor` for CRM sync. Canceled tasks are not deleted; only `deletedAt` marks a tombstone when `includeDeleted=true`.\n\n## Checklists\n\nChecklists are left out of results by default; their items are included.\n\n- `type=checklist` returns only checklists.\n- `parentId=<checklist taskId>` returns the items of one checklist.\n\nTasks on template deals are returned only when `dealId` names that template.\n\nRequires the `api_tasks_list` scope.",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Filter tasks anchored to a deal"
            },
            "required": false,
            "description": "Filter tasks anchored to a deal",
            "name": "dealId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Filter tasks anchored to a package"
            },
            "required": false,
            "description": "Filter tasks anchored to a package",
            "name": "packageId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Filter tasks anchored to a submission"
            },
            "required": false,
            "description": "Filter tasks anchored to a submission",
            "name": "submissionId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Filter checklist child tasks for a parent checklist"
            },
            "required": false,
            "description": "Filter checklist child tasks for a parent checklist",
            "name": "parentId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Filter by current task status (exact match on any non-empty string). Common built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`."
            },
            "required": false,
            "description": "Filter by current task status (exact match on any non-empty string). Common built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`.",
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["general", "checklist"],
              "description": "When checklist, returns checklist parents; otherwise checklist parents are excluded"
            },
            "required": false,
            "description": "When checklist, returns checklist parents; otherwise checklist parents are excluded",
            "name": "type",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "RFC 3339 UTC watermark (inclusive) for CRM sync polling on updated_at"
            },
            "required": false,
            "description": "RFC 3339 UTC watermark (inclusive) for CRM sync polling on updated_at",
            "name": "updatedSince",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["true", "false"],
              "description": "When true, include hard-deleted tombstones (deletedAt set). Canceled tasks remain visible by default."
            },
            "required": false,
            "description": "When true, include hard-deleted tombstones (deletedAt set). Canceled tasks remain visible by default.",
            "name": "includeDeleted",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Maximum tasks to return (1-100)",
              "example": 50
            },
            "required": false,
            "description": "Maximum tasks to return (1-100)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Opaque pagination cursor from a previous response"
            },
            "required": false,
            "description": "Opaque pagination cursor from a previous response",
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Task page for the authenticated API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListTasksResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/deals/{dealId}/tasks": {
      "post": {
        "operationId": "createDealTask",
        "summary": "Create a task on a deal",
        "description": "Deal-scoped alias for createTask. The path `dealId` anchors the task; `packageId` and `submissionId` remain optional body fields.\n\nRequires the `api_tasks_create` scope and an `Idempotency-Key` header for safe retries.\n\n## Checklists\n\nA checklist is a task with `type: \"checklist\"`. Its items are tasks with `parentId` set to the `taskId` of the checklist.\n\n1. Create the checklist:\n\n   ```json\n   { \"title\": \"Closing checklist\", \"type\": \"checklist\" }\n   ```\n\n2. Create each item with the `taskId` from step 1:\n\n   ```json\n   { \"title\": \"Order title search\", \"parentId\": \"<checklist taskId>\" }\n   ```\n\n`parentId` must point to a checklist (`422 PARENT_NOT_CHECKLIST`) on this deal (`400 ASSOCIATION_MISMATCH`).",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe create-task retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe create-task retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicCreateDealTaskRequest"
              },
              "examples": {
                "generalTask": {
                  "summary": "General task",
                  "value": {
                    "title": "Order title search",
                    "type": "general",
                    "dueDate": "2026-09-15T17:00:00-04:00"
                  }
                },
                "checklistParent": {
                  "summary": "Checklist",
                  "value": {
                    "title": "Closing checklist",
                    "type": "checklist"
                  }
                },
                "checklistItem": {
                  "summary": "Checklist item",
                  "description": "Set `parentId` to the `taskId` of the checklist.",
                  "value": {
                    "title": "Order title search",
                    "parentId": "550e8400-e29b-41d4-a716-446655440020"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Task created (or replayed for a matching Idempotency-Key)",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque task version for If-Match on PATCH"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCreateDealTaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `IDEMPOTENCY_HASH_MISMATCH` when the same Idempotency-Key is reused with a different request body; retries with the same body replay the original success response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listDealTasks",
        "summary": "List tasks for a deal",
        "description": "Deal-scoped alias for listTasks. The path `dealId` is applied as a filter; a conflicting `dealId` query param returns `400` (`ASSOCIATION_MISMATCH`).\n\n## Checklists\n\nChecklists are left out of results by default; their items are included.\n\n- `type=checklist` returns only checklists.\n- `parentId=<checklist taskId>` returns the items of one checklist.\n\nRequires the `api_tasks_list` scope.",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Filter tasks anchored to a package in the deal identified by the dealId path parameter"
            },
            "required": false,
            "description": "Filter tasks anchored to a package in the deal identified by the dealId path parameter",
            "name": "packageId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Filter tasks anchored to a submission in the deal identified by the dealId path parameter"
            },
            "required": false,
            "description": "Filter tasks anchored to a submission in the deal identified by the dealId path parameter",
            "name": "submissionId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Filter checklist child tasks for a parent checklist"
            },
            "required": false,
            "description": "Filter checklist child tasks for a parent checklist",
            "name": "parentId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Filter by current task status (exact match on any non-empty string). Common built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`."
            },
            "required": false,
            "description": "Filter by current task status (exact match on any non-empty string). Common built-in values: `pending`, `in_progress`, `awaiting_approval`, `complete`, `canceled`.",
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["general", "checklist"],
              "description": "When checklist, returns checklist parents; otherwise checklist parents are excluded"
            },
            "required": false,
            "description": "When checklist, returns checklist parents; otherwise checklist parents are excluded",
            "name": "type",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "RFC 3339 UTC watermark (inclusive) for CRM sync polling on updated_at"
            },
            "required": false,
            "description": "RFC 3339 UTC watermark (inclusive) for CRM sync polling on updated_at",
            "name": "updatedSince",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["true", "false"],
              "description": "When true, include hard-deleted tombstones (deletedAt set). Canceled tasks remain visible by default."
            },
            "required": false,
            "description": "When true, include hard-deleted tombstones (deletedAt set). Canceled tasks remain visible by default.",
            "name": "includeDeleted",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Maximum tasks to return (1-100)",
              "example": 50
            },
            "required": false,
            "description": "Maximum tasks to return (1-100)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Opaque pagination cursor from a previous response"
            },
            "required": false,
            "description": "Opaque pagination cursor from a previous response",
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Task page for the authenticated API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListDealTasksResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/tasks/assignee-candidates": {
      "get": {
        "operationId": "listAssigneeCandidates",
        "summary": "List task assignee candidates",
        "description": "Preparatory lookup before v1 task create or PATCH assignee fields. Returns org members, teams, and optional deal or package flow participants. Pass dealId (and optionally packageId) to include participant placeholders. Does not assign anyone. A top-level `teamId` field is not supported on create/update bodies; set team assignees via `assignees`/`approvers` (for example `{ \"type\": \"team\", \"id\": \"<teamId>\" }`) or claim a team slot with `POST .../claim`. Requires `api_tasks_create` or `api_tasks_update`.",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "When set, include document-flow participants for this deal"
            },
            "required": false,
            "description": "When set, include document-flow participants for this deal",
            "name": "dealId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "When set with dealId, limit participants to this package's flows"
            },
            "required": false,
            "description": "When set with dealId, limit participants to this package's flows",
            "name": "packageId",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Assignee candidates for the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListAssigneeCandidatesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/tasks/{taskId}": {
      "get": {
        "operationId": "getTask",
        "summary": "Get a task",
        "description": "Returns a single task in the specified organization. Requires the `api_tasks_list` scope.\n\n## Checklists\n\nChecklists and their items return like any other task. A checklist has `type: \"checklist\"`; an item has `parentId` set to the `taskId` of its checklist. To get every item of a checklist, list tasks with `parentId`.",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Task ID",
              "example": "550e8400-e29b-41d4-a716-446655440020"
            },
            "required": true,
            "description": "Task ID",
            "name": "taskId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Task details",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque task version for If-Match on PATCH"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicGetTaskResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Task not found. Error code `TASK_NOT_FOUND`. Returned when `taskId` is not a UUID, no task row exists with that id (including hard-deleted tasks), the task belongs to a different organization than the path `orgId`, or the task is a template.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateTask",
        "summary": "Update a task",
        "description": "Updates mutable task fields, including optional assignees and approvers (max one each; send empty arrays to clear). Requires the `api_tasks_update` scope, and `If-Match` with the ETag from a prior GET or create. Status changes use `POST .../transition`.\n\n## Checklists\n\n`type` and `parentId` cannot be changed (`422 UNSUPPORTED_FIELD`), so a task cannot become a checklist and an item cannot move to another checklist. An item stays on the deal of its checklist; a different `dealId` returns `400 ASSOCIATION_MISMATCH`.",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Task ID",
              "example": "550e8400-e29b-41d4-a716-446655440020"
            },
            "required": true,
            "description": "Task ID",
            "name": "taskId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required ETag from the latest GET or create response for this task",
              "example": "\"2026-01-02T00:00:00.000Z:550e8400-e29b-41d4-a716-446655440020\""
            },
            "required": true,
            "description": "Required ETag from the latest GET or create response for this task",
            "name": "If-Match",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicUpdateTaskRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task updated",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque task version for subsequent If-Match"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicUpdateTaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `AMBIGUOUS_PARTICIPANT` when assignee or approver resolution matches multiple deal participants.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "412": {
            "description": "If-Match precondition failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteTask",
        "summary": "Cancel or delete a task",
        "description": "Default cancels the task (status `canceled`). Pass `?action=delete` for a hard delete (`deletedAt` set).\n\n## Checklists\n\nA checklist cannot be canceled or deleted while it has items, including canceled ones (`409 CHECKLIST_HAS_CHILDREN`). Delete each item with `?action=delete` first.\n\nRequires the `api_tasks_delete` scope.",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Task ID",
              "example": "550e8400-e29b-41d4-a716-446655440020"
            },
            "required": true,
            "description": "Task ID",
            "name": "taskId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["cancel", "delete"]
            },
            "required": false,
            "name": "action",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Task canceled or deleted",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Task version after the delete operation"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicDeleteTaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Checklist still has child tasks (CHECKLIST_HAS_CHILDREN)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/tasks/{taskId}/transition": {
      "post": {
        "operationId": "transitionTask",
        "summary": "Transition a task status",
        "description": "Changes task status via role-aware transition rules. Requires `api_tasks_update` and a required `Idempotency-Key` header.",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Task ID",
              "example": "550e8400-e29b-41d4-a716-446655440020"
            },
            "required": true,
            "description": "Task ID",
            "name": "taskId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe transition retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe transition retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicTransitionTaskRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lifecycle operation applied (or replayed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicTransitionTaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `IDEMPOTENCY_HASH_MISMATCH` when the same Idempotency-Key is reused with a different request body; retries with the same body replay the original success response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/tasks/{taskId}/claim": {
      "post": {
        "operationId": "claimTask",
        "summary": "Claim a team task slot",
        "description": "Binds the API key bound user onto a team assignee or approver slot (`boundUser`). Requires `api_tasks_update` and a required `Idempotency-Key` header. Clients send `role` and `teamId` only — the caller cannot claim for another user. Team-unclaimed tasks outside the key readable set still return 404.",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Task ID",
              "example": "550e8400-e29b-41d4-a716-446655440020"
            },
            "required": true,
            "description": "Task ID",
            "name": "taskId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe claim retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe claim retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicClaimTaskRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Slot claimed or idempotent self-reclaim / key replay",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque task version for If-Match on PATCH"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicClaimTaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `IDEMPOTENCY_HASH_MISMATCH` when the Idempotency-Key is reused with a different request body; `TEAM_TASK_ALREADY_CLAIMED` when another member already claimed the team slot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/tasks/{taskId}/approve": {
      "post": {
        "operationId": "approveTask",
        "summary": "Approve a task execution",
        "description": "Records an approval for the active execution. Requires `api_tasks_approve` and a required `Idempotency-Key` header.",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Task ID",
              "example": "550e8400-e29b-41d4-a716-446655440020"
            },
            "required": true,
            "description": "Task ID",
            "name": "taskId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe approve retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe approve retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicApproveTaskRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lifecycle operation applied (or replayed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApproveTaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `IDEMPOTENCY_HASH_MISMATCH` when the same Idempotency-Key is reused with a different request body; retries with the same body replay the original success response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/tasks/{taskId}/reject": {
      "post": {
        "operationId": "rejectTask",
        "summary": "Reject a task execution",
        "description": "Records a rejection and opens a new execution for rework. Requires `api_tasks_approve` and a required `Idempotency-Key` header.",
        "tags": ["Tasks"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Task ID",
              "example": "550e8400-e29b-41d4-a716-446655440020"
            },
            "required": true,
            "description": "Task ID",
            "name": "taskId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe reject retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe reject retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicRejectTaskRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lifecycle operation applied (or replayed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicRejectTaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `IDEMPOTENCY_HASH_MISMATCH` when the same Idempotency-Key is reused with a different request body; retries with the same body replay the original success response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/deals/{dealId}/packages": {
      "get": {
        "operationId": "listPackages",
        "summary": "List packages on a deal",
        "description": "Returns a cursor-paginated list of packages for a deal in the specified organization. Works on a template deal as well as a live deal; when the deal is a template, each package in packages includes isTemplate=true (an empty page has no isTemplate fields).\n\nRequires one of `api_deals_list` or `api_deals_create`.",
        "tags": ["Packages"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the packages",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the packages",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["created_at", "updated_at", "name"],
              "default": "created_at"
            },
            "required": false,
            "name": "orderBy",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["true", "false"],
              "default": "false"
            },
            "required": false,
            "name": "ascending",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Package page for the deal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListPackagesResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createPackage",
        "summary": "Create a package on a deal",
        "description": "Creates a new package on an existing deal for the API key bound user. Works on a template deal as well as a live deal; the response then includes isTemplate=true.\n\nRequires the `api_deals_create` scope.",
        "tags": ["Packages"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the packages",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the packages",
            "name": "dealId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicCreatePackageRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Package created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCreatePackageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/deals/{dealId}/packages/{packageId}": {
      "get": {
        "operationId": "getPackage",
        "summary": "Get a package",
        "description": "Returns a single package on a deal, including its name and soft-delete metadata. Works on a template deal as well as a live deal; the response then includes isTemplate=true.\n\nRequires one of `api_deals_list` or `api_deals_create`.",
        "tags": ["Packages"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the package",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the package",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Package ID",
              "example": "550e8400-e29b-41d4-a716-446655440011"
            },
            "required": true,
            "description": "Package ID",
            "name": "packageId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Package details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicGetPackageResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updatePackage",
        "summary": "Update a package",
        "description": "Updates package fields (name only in v1). Set deal-level fields such as transactionType or amount when creating the deal with createDeal; updatePackage does not change them. Works on a template deal as well as a live deal; the response then includes isTemplate=true.\n\nRequires the `api_deals_create` scope.",
        "tags": ["Packages"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the package",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the package",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Package ID",
              "example": "550e8400-e29b-41d4-a716-446655440011"
            },
            "required": true,
            "description": "Package ID",
            "name": "packageId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicUpdatePackageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Package updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicUpdatePackageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deletePackage",
        "summary": "Delete a package",
        "description": "Soft-deletes a package on a deal. Works on a template deal as well as a live deal.\n\nRequires the `api_deals_create` scope.",
        "tags": ["Packages"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the package",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the package",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Package ID",
              "example": "550e8400-e29b-41d4-a716-446655440011"
            },
            "required": true,
            "description": "Package ID",
            "name": "packageId",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Package deleted"
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/deals/{dealId}/packages/{packageId}/participants": {
      "get": {
        "operationId": "listParticipants",
        "summary": "List package participants",
        "description": "Returns the roster, send readiness, fieldCount, and prepareUrl. Each item includes needsContact when contact details are still required. Works on a template deal as well as a live deal; the response then includes isTemplate=true.\n\nRequires one of `api_deals_list` or `api_deals_create` or `api_deals_send`.",
        "tags": ["Packages"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the package",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the package",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Package ID",
              "example": "550e8400-e29b-41d4-a716-446655440011"
            },
            "required": true,
            "description": "Package ID",
            "name": "packageId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Package participants and send readiness",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListParticipantsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/deals/{dealId}/packages/{packageId}/participants/{participantId}/contact": {
      "post": {
        "operationId": "createParticipantContact",
        "summary": "Save a participant contact",
        "description": "Saves a name and email, or the signed-in user with self: true, onto one participant. Works on a template deal: the response then includes isTemplate=true, and the saved contact is copied into every deal created from that template.\n\nRequires the `api_deals_send` scope.",
        "tags": ["Packages"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the package",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the package",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Package ID",
              "example": "550e8400-e29b-41d4-a716-446655440011"
            },
            "required": true,
            "description": "Package ID",
            "name": "packageId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "participantId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicUpdateParticipantContactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved participant and send readiness",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicUpdateParticipantContactResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). Error code depends on the operation (for example `IDEMPOTENCY_HASH_MISMATCH` when an Idempotency-Key is reused with a different request body).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/deals/{dealId}/packages/{packageId}/participants/{participantId}": {
      "delete": {
        "operationId": "removeParticipant",
        "summary": "Remove a participant",
        "description": "Removes one signer from a package that has not been sent, along with the fields only that signer owns. Fields shared with another signer stay. Observers and approvers are managed in Clai. Works on a template deal. Returns the remaining participants and send readiness.\n\nRequires the `api_deals_send` scope.",
        "tags": ["Packages"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the package",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the package",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Package ID",
              "example": "550e8400-e29b-41d4-a716-446655440011"
            },
            "required": true,
            "description": "Package ID",
            "name": "packageId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "participantId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Remaining participants and send readiness",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListParticipantsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `DEAL_ALREADY_SENT` when the deal was already sent; `SIGNING_LOCKED` when someone has started signing; `PARTIAL_REMOVE` when some documents in the package were not updated (finish in Clai).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/document-uploads/{documentId}": {
      "get": {
        "operationId": "getDocumentUploadStatus",
        "summary": "Get staged document upload status",
        "description": "Polls processing status for a staged PDF upload after complete has been called. Poll until status is ready or failed; when finished, the response includes detection with outcome, participantCount, and signatureFieldCount. Returns pollAfterMs as a suggested client backoff.\n\nRequires the `api_deals_create` scope.",
        "tags": ["Documents"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Staged document ID returned from create-deal",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Staged document ID returned from create-deal",
            "name": "documentId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Current upload status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicDocumentUploadResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/document-uploads/{documentId}/complete": {
      "post": {
        "operationId": "completeDocumentUpload",
        "summary": "Complete a staged document upload",
        "description": "Accepts a PDF previously PUT to the signed uploadUrl from create-deal and enqueues document processing. Idempotency-Key is required and enforced server-side for safe retries. When object storage reports a file size, uploads over the limit return `413` with error code `UPLOAD_ERROR`; if size metadata is unavailable the check is skipped. When the pending document recorded a declared size and storage reports a size, a different size returns `409` `UPLOAD_MISMATCH` and the upload is not claimed. When the pending document recorded a sha256, the staged bytes are hashed and must match that digest before the upload is claimed. The object is not downloaded when no sha256 was declared.\n\nRequires the `api_deals_create` scope.",
        "tags": ["Documents"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Staged document ID returned from create-deal",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Staged document ID returned from create-deal",
            "name": "documentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe complete-upload retries",
              "example": "550e8400-e29b-41d4-a716-446655440001"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe complete-upload retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicCompleteDocumentUploadRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Upload accepted for processing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCompleteDocumentUploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `UPLOAD_ALREADY_COMPLETED` when processing already finished; `UPLOAD_NOT_FOUND` when nothing was PUT to the signed upload URL; `UPLOAD_MISMATCH` when storage reports a size that differs from the size declared at begin, or the staged bytes do not match a declared sha256; `IDEMPOTENCY_KEY_REUSED` when the key was already used for a different document (the request body is always `{}`, so body-hash mismatch does not apply).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Payload too large (`413`). Error code `UPLOAD_ERROR` when staged upload object size exceeds the limit (skipped when storage returns no size metadata).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/document-uploads/{documentId}/find-signatures": {
      "post": {
        "operationId": "findDocumentSignatures",
        "summary": "Find where people sign on an uploaded document",
        "description": "Scans a ready upload for signers and signature fields. Runs only when upload status reports `canFindSignatures: true`. Detected signers and fields land on the document directly. Returns the upload status; poll the upload status until it is `ready` or `failed`. Idempotency-Key is required.\n\nRequires the `api_deals_create` scope.",
        "tags": ["Documents"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Staged document ID returned from create-deal",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Staged document ID returned from create-deal",
            "name": "documentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe find-signatures retries",
              "example": "550e8400-e29b-41d4-a716-446655440002"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe find-signatures retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicFindDocumentSignaturesRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Scan started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicFindDocumentSignaturesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `HAS_BUILDER_EDITS` when edits made in Clai would be lost; `NEEDS_REUPLOAD` when the uploaded file is no longer stored; `CONFLICT` when the document is not detectable (already scanned, fields placed, or from a template), detection on request is off for this user or organization, or a scan is already running; `IDEMPOTENCY_KEY_REUSED` when the key was already used for a different document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/submissions/{submissionId}": {
      "get": {
        "operationId": "getSubmission",
        "summary": "Get a submission",
        "description": "Returns one submission owned by the API key's bound user. Requires api_deals_list or api_deals_create. The body never includes signing links. activeParticipantIds lists the current signing group; later groups stay queued until that group finishes.\n\nRequires one of `api_deals_list` or `api_deals_create`.",
        "tags": ["Submissions"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "submissionId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Resource found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicSubmissionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/deals/{dealId}/packages/{packageId}/submissions": {
      "get": {
        "operationId": "listSubmissions",
        "summary": "List package submissions",
        "description": "Returns a cursor-paginated list of submissions for one package, newest first. Requires `api_deals_list` or `api_deals_create`. The page never includes signing links.",
        "tags": ["Submissions"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the package",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the package",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Package ID",
              "example": "550e8400-e29b-41d4-a716-446655440011"
            },
            "required": true,
            "description": "Package ID",
            "name": "packageId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["created_at", "updated_at"],
              "description": "Sort column. Defaults to created_at, newest first.",
              "example": "created_at"
            },
            "required": false,
            "description": "Sort column. Defaults to created_at, newest first.",
            "name": "orderBy",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["true", "false"],
              "description": "When true, sort ascending instead of descending.",
              "example": "false"
            },
            "required": false,
            "description": "When true, sort ascending instead of descending.",
            "name": "ascending",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Maximum number of submissions to return (1-100).",
              "example": 50
            },
            "required": false,
            "description": "Maximum number of submissions to return (1-100).",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Opaque pagination cursor from a previous response."
            },
            "required": false,
            "description": "Opaque pagination cursor from a previous response.",
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Submission page for the authenticated API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListSubmissionsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createSubmission",
        "summary": "Send a package",
        "description": "Creates a submission for the package. Requires the `api_deals_send` scope and an Idempotency-Key header.",
        "tags": ["Submissions"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the package",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the package",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Package ID",
              "example": "550e8400-e29b-41d4-a716-446655440011"
            },
            "required": true,
            "description": "Package ID",
            "name": "packageId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicCreateSubmissionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicSubmissionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `IDEMPOTENCY_HASH_MISMATCH` on idempotency body mismatch; `DOCUMENT_NOT_PREPARED` when the document is not ready to send; `LINK_UNAVAILABLE` when `notify` is false and signing links are not available; `FLOW_ALREADY_SIGNED` when the flow already has an active submission.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/deals/{dealId}/packages/{packageId}/share-link": {
      "post": {
        "operationId": "createShareLink",
        "summary": "Get a pre-send share link",
        "description": "Mints a fresh anonymous flow-token link. Requires the `api_deals_send` scope. Valid only before a live submission exists and when the first signer is a single unknown participant.",
        "tags": ["Submissions"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal ID that owns the package",
              "example": "550e8400-e29b-41d4-a716-446655440010"
            },
            "required": true,
            "description": "Deal ID that owns the package",
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Package ID",
              "example": "550e8400-e29b-41d4-a716-446655440011"
            },
            "required": true,
            "description": "Package ID",
            "name": "packageId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicShareLinkRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Share link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicShareLinkResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `LINK_UNAVAILABLE` when a live submission already exists, the document is not ready, the roster is ineligible, or the first signer is not a single unknown participant (see `details.reason`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/submissions/{submissionId}/resend": {
      "post": {
        "operationId": "resendSubmission",
        "summary": "Resend a submission",
        "description": "Re-sends invitations for the active signing group. Requires the `api_deals_send` scope and an Idempotency-Key header. The response never includes a signing link.",
        "tags": ["Submissions"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "submissionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicResendSubmissionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Submission after resend",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicSubmissionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `NOTHING_TO_RESEND` when there is no active signing group to resend; `IDEMPOTENCY_HASH_MISMATCH` when the Idempotency-Key is reused with a different request body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/submissions/{submissionId}/signing-links": {
      "post": {
        "operationId": "getSigningLink",
        "summary": "Get a signing link",
        "description": "Mints a fresh shortened bearer link for one active signer. Not idempotent. The link is a secret for that signer.\n\nRequires the `api_deals_send` scope.",
        "tags": ["Submissions"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "submissionId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicSigningLinkRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signing link issued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicSigningLinkResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `SUBMISSION_CLOSED` when the submission is completed or voided; `PARTICIPANT_NOT_ACTIVE` when the participant is not in the active signing group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/submissions/{submissionId}/void": {
      "post": {
        "operationId": "voidSubmission",
        "summary": "Void a submission",
        "description": "Voids one submission owned by the API key's bound user. Requires an `Idempotency-Key` header. A completed submission returns `409` with `SUBMISSION_NOT_VOIDABLE`. Voiding an already voided submission returns its current state. The body never includes signing links.\n\nRequires the `api_deals_send` scope.",
        "tags": ["Submissions"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "submissionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicVoidSubmissionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Submission voided",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicSubmissionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `SUBMISSION_NOT_VOIDABLE` when the submission cannot be voided (for example already completed); `IDEMPOTENCY_KEY_REUSED` when the Idempotency-Key was already used for a different submission; `IDEMPOTENCY_HASH_MISMATCH` when the same key is reused with a different request body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/document-uploads": {
      "get": {
        "operationId": "listDocumentUploads",
        "summary": "List package document uploads",
        "description": "Lists a package's document uploads, newest first. Each item includes the poll status fields plus fileName.\n\nRequires the `api_deals_create` scope.",
        "tags": ["Documents"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Deal that owns the package."
            },
            "required": true,
            "description": "Deal that owns the package.",
            "name": "dealId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Package whose document uploads to list."
            },
            "required": true,
            "description": "Package whose document uploads to list.",
            "name": "packageId",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "List response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListDocumentUploadsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createDocumentUpload",
        "summary": "Begin a document upload",
        "description": "Starts an upload on an existing deal package, or reuses its pending upload. No Idempotency-Key is required. Returns 201 when a new pending document row is created and 200 when an existing awaiting_upload row is reused with a freshly minted signed URL.\n\nRequires the `api_deals_create` scope.",
        "tags": ["Documents"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicDocumentUploadCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing awaiting_upload row reused with a freshly minted signed URL",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicDocumentUploadCreateResponse"
                }
              }
            }
          },
          "201": {
            "description": "New pending document row created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicDocumentUploadCreateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/insights/documents": {
      "get": {
        "operationId": "listInsightDocuments",
        "summary": "List insight documents",
        "description": "Lists live insight documents in the organization.\n\nRequires the `api_insights_list` scope.",
        "tags": ["Insights"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": ["array", "null"],
              "items": {
                "type": "string",
                "enum": [
                  "Purchase",
                  "Lease",
                  "Listing Agreement",
                  "Addendum",
                  "Amendment",
                  "Disclosure",
                  "Commission Agreement",
                  "Loan",
                  "Insurance",
                  "Inspection",
                  "Escrow",
                  "Closing Statement",
                  "Title",
                  "Power of Attorney",
                  "Rental Application",
                  "Notice",
                  "Association",
                  "Registration",
                  "Trust",
                  "Information",
                  "Licensing",
                  "Compliance",
                  "Legal",
                  "Financial",
                  "Employment",
                  "Corporate",
                  "Government",
                  "Other"
                ]
              },
              "default": []
            },
            "required": false,
            "name": "types",
            "in": "query"
          },
          {
            "schema": {
              "type": ["array", "null"],
              "items": {
                "type": "string",
                "enum": ["draft", "executed", "expired", "unknown"]
              },
              "default": []
            },
            "required": false,
            "name": "contractStatuses",
            "in": "query"
          },
          {
            "schema": {
              "type": ["array", "null"],
              "items": {
                "type": "string",
                "enum": ["pending", "processing", "processed", "failed"]
              },
              "default": []
            },
            "required": false,
            "name": "statuses",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "search",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": false,
            "name": "folderId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["true", "false"],
              "default": "false"
            },
            "required": false,
            "name": "includeSubfolders",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["createdAt", "name"],
              "default": "createdAt"
            },
            "required": false,
            "name": "orderBy",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["true", "false"],
              "default": "false"
            },
            "required": false,
            "name": "ascending",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "List response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListInsightDocumentsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Insight workspace is still being provisioned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/insights/documents/{documentId}": {
      "get": {
        "operationId": "getInsightDocument",
        "summary": "Get an insight document",
        "description": "Returns one insight document with processing status. Includes pollAfterMs while status is not processed or failed.\n\nRequires the `api_insights_list` scope.",
        "tags": ["Insights"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "documentId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Resource found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicInsightDocumentResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Insight workspace is still being provisioned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/insights/folders": {
      "get": {
        "operationId": "listInsightFolders",
        "summary": "List insight folders",
        "description": "Lists insight folders as a flat tree with paths.\n\nRequires the `api_insights_list` scope.",
        "tags": ["Insights"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "List response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListInsightFoldersResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Insight workspace is still being provisioned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createInsightFolder",
        "summary": "Create an insight folder",
        "description": "Creates a folder in the Insights workspace. Returns 201 for a new folder and 200 when a folder with the same name already exists under the parent.\n\nRequires the `api_insights_create` scope.",
        "tags": ["Insights"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe create-folder retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe create-folder retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicCreateInsightFolderRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A folder with this name already exists under the parent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicInsightFolder"
                }
              }
            }
          },
          "201": {
            "description": "Folder created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicInsightFolder"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `IDEMPOTENCY_HASH_MISMATCH` when the same Idempotency-Key is reused with a different request body; retries with the same body replay the original success response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Insight workspace is still being provisioned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/insights/document-uploads": {
      "post": {
        "operationId": "createInsightDocumentUpload",
        "summary": "Begin an insight document upload",
        "description": "Mints a document id and a signed URL. PUT the raw bytes to uploadUrl. Do not send file bytes to this endpoint. No Idempotency-Key is required (completeInsightDocumentUpload requires Idempotency-Key).\n\nRequires the `api_insights_create` scope.",
        "tags": ["Insights"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicBeginInsightUploadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed upload URL minted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBeginInsightUploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Payload too large (`413`). Error code `UPLOAD_ERROR` when staged upload object size exceeds the limit (skipped when storage returns no size metadata).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Insight workspace is still being provisioned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/insights/document-uploads/{documentId}/complete": {
      "post": {
        "operationId": "completeInsightDocumentUpload",
        "summary": "Complete an insight document upload",
        "description": "Commits the uploaded bytes after PUT to uploadUrl. Poll GET on the document until status is processed or failed.\n\nRequires the `api_insights_create` scope.",
        "tags": ["Insights"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "documentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe complete-upload retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe complete-upload retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicCompleteInsightUploadRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Upload accepted for processing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCompleteInsightUploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `insight_document_duplicate` when the organization already holds a document with the same bytes: the upload is discarded and `details.duplicateOf` carries that document's `documentId` and `name`; `UPLOAD_NOT_FOUND` when nothing was PUT to the signed upload URL; `IDEMPOTENCY_KEY_REUSED` when the key was already used for a different document; `IDEMPOTENCY_HASH_MISMATCH` when the same key is reused with a different request body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Payload too large (`413`). Error code `UPLOAD_ERROR` when staged upload object size exceeds the limit (skipped when storage returns no size metadata).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Insight workspace is still being provisioned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/contacts": {
      "get": {
        "operationId": "listContacts",
        "summary": "List contacts",
        "description": "Returns a cursor-paginated list of contacts the API key user can see in the organization: contacts they created and contacts on deals they can read. Filter with search and status; sort with sort and dir.\n\nRequires the `api_contacts_list` scope.",
        "tags": ["Contacts"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200,
              "description": "Matches name, email, or phone."
            },
            "required": false,
            "description": "Matches name, email, or phone.",
            "name": "search",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["all", "active", "archived"],
              "default": "all",
              "description": "Deal activity filter."
            },
            "required": false,
            "description": "Deal activity filter.",
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "name",
                "email",
                "phone",
                "dealsCount",
                "lastActivityAt",
                "firstSeenAt"
              ],
              "default": "lastActivityAt"
            },
            "required": false,
            "name": "sort",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["asc", "desc"],
              "default": "desc"
            },
            "required": false,
            "name": "dir",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "description": "Page size (1-100)."
            },
            "required": false,
            "description": "Page size (1-100).",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Opaque cursor from a previous response."
            },
            "required": false,
            "description": "Opaque cursor from a previous response.",
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListContactsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createContact",
        "summary": "Create a contact",
        "description": "Creates a contact. Requires at least one email or phone. Phones must be E.164.\n\nAn email or phone already used by another contact in the organization returns `409` with `details.existingContactId`; get or update that contact instead.\n\n`tags` are labels, created in the organization catalog when missing. If tagging fails after the contact is saved, the request returns `500` and the contact exists without those tags; retrying the create returns the `409` above, then set tags with `PATCH`.\n\nRequires the `api_contacts_create` scope.",
        "tags": ["Contacts"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required. Replays return the created contact.",
              "example": "b9a4d3c2-2f1e-4c5a-8e7d-1a2b3c4d5e6f"
            },
            "required": true,
            "description": "Required. Replays return the created contact.",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicCreateContactRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Contact created",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque contact version for If-Match"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCreateContactResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). Error code depends on the operation (for example `IDEMPOTENCY_HASH_MISMATCH` when an Idempotency-Key is reused with a different request body).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/contacts/{contactId}": {
      "get": {
        "operationId": "getContact",
        "summary": "Get a contact",
        "description": "Returns one contact. The ETag header is the version to send as If-Match on update or delete.\n\nRequires the `api_contacts_list` scope.",
        "tags": ["Contacts"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Contact ID",
              "example": "550e8400-e29b-41d4-a716-446655440030"
            },
            "required": true,
            "description": "Contact ID",
            "name": "contactId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque contact version for If-Match"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicGetContactResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateContact",
        "summary": "Update a contact",
        "description": "Updates a contact. Optional `If-Match` with the ETag from the latest GET, create, or update; a stale value returns `412` (unlike updateTask, If-Match is not required).\n\nEach array you send replaces that array; omitted fields are unchanged. At least one email or phone must remain.\n\n`tags` replaces the full label set. Contacts on deals shared with you are read-only; updating them returns `404`.\n\nRequires the `api_contacts_update` scope.",
        "tags": ["Contacts"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Contact ID",
              "example": "550e8400-e29b-41d4-a716-446655440030"
            },
            "required": true,
            "description": "Contact ID",
            "name": "contactId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Optional ETag from the latest GET, create, or update. A stale value returns 412.",
              "example": "\"2026-01-02T00:00:00.000Z:550e8400-e29b-41d4-a716-446655440030\""
            },
            "required": false,
            "description": "Optional ETag from the latest GET, create, or update. A stale value returns 412.",
            "name": "If-Match",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicUpdateContactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact updated",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque contact version for If-Match"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicUpdateContactResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). Error code depends on the operation (for example `IDEMPOTENCY_HASH_MISMATCH` when an Idempotency-Key is reused with a different request body).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "412": {
            "description": "If-Match precondition failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteContact",
        "summary": "Delete a contact",
        "description": "Soft-deletes a contact. Contacts linked to a Clai user account cannot be deleted (`409 CONTACT_LINKED`).\n\nRequires the `api_contacts_delete` scope.",
        "tags": ["Contacts"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Contact ID",
              "example": "550e8400-e29b-41d4-a716-446655440030"
            },
            "required": true,
            "description": "Contact ID",
            "name": "contactId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Optional ETag from the latest GET, create, or update. A stale value returns 412.",
              "example": "\"2026-01-02T00:00:00.000Z:550e8400-e29b-41d4-a716-446655440030\""
            },
            "required": false,
            "description": "Optional ETag from the latest GET, create, or update. A stale value returns 412.",
            "name": "If-Match",
            "in": "header"
          }
        ],
        "responses": {
          "204": {
            "description": "Contact deleted"
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). Error code depends on the operation (for example `IDEMPOTENCY_HASH_MISMATCH` when an Idempotency-Key is reused with a different request body).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "412": {
            "description": "If-Match precondition failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/wizards": {
      "get": {
        "operationId": "listDealWizards",
        "summary": "List deal wizards",
        "description": "Lists the organization's offered deal wizards. Listing wizards are excluded. Use matchDealWizard to pick one from a description, then getNextWizardQuestion to walk it.\n\nRequires one of `api_deals_list` or `api_deals_create`.",
        "tags": ["Wizards"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Offered deal wizards",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicListDealWizardsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/wizards/match": {
      "post": {
        "operationId": "matchDealWizard",
        "summary": "Match a deal wizard",
        "description": "Picks the org's deal wizard that best fits a description, using the same matcher as the in-app search bar. Returns the match with its first question, up to two other wizards, and matching deal templates. Falls back to the real-estate starter wizard when nothing matches. Does not create anything.\n\nRequires one of `api_deals_list` or `api_deals_create`.",
        "tags": ["Wizards"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicMatchDealWizardRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Best wizard match",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicMatchDealWizardResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/wizards/{wizardId}/next": {
      "post": {
        "operationId": "getNextWizardQuestion",
        "summary": "Get the next wizard question",
        "description": "Validates the answers so far and returns the next question to ask, required or optional. Send every answer on every call; the server keeps no run state. Answer null to skip an optional question. When the wizard binds to property data and the key holds api_deals_create, a complete address triggers a property lookup whose values come back in prefill.\n\nRequires one of `api_deals_list` or `api_deals_create`.",
        "tags": ["Wizards"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Wizard ID from listDealWizards or matchDealWizard",
              "example": "starter-real-estate-deal"
            },
            "required": true,
            "description": "Wizard ID from listDealWizards or matchDealWizard",
            "name": "wizardId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicWizardAnswersRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Next question, or complete",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicNextWizardQuestionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). Error code depends on the operation (for example `IDEMPOTENCY_HASH_MISMATCH` when an Idempotency-Key is reused with a different request body).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/wizards/{wizardId}/submit": {
      "post": {
        "operationId": "createDealFromWizard",
        "summary": "Submit a deal wizard",
        "description": "Creates a deal from a completed wizard run, the same deal the in-app wizard would create. Send every answer. Returns template suggestions from the wizard's rules without attaching them; attach with addTemplatesToPackage. Idempotency-Key is required.\n\nRequires the `api_deals_create` scope.",
        "tags": ["Wizards"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Wizard ID from listDealWizards or matchDealWizard",
              "example": "starter-real-estate-deal"
            },
            "required": true,
            "description": "Wizard ID from listDealWizards or matchDealWizard",
            "name": "wizardId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicWizardAnswersRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Deal created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCreateDealFromWizardResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `DEFINITION_CHANGED` when the wizard was edited after `definitionVersion` was issued (`details.definitionVersion` carries the current one; restart the run); `IDEMPOTENCY_HASH_MISMATCH` when the same Idempotency-Key is reused with a different request body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/deals/{dealId}/templates": {
      "post": {
        "operationId": "createDealTemplate",
        "summary": "Save a deal as a template",
        "description": "Saves an existing deal as a new template. The template is a separate copy: documents, fields, packages and tasks are copied, signers become role-only slots, and submissions and signer contact details are not copied. The source deal is kept unchanged and later edits to it do not update the template; calling again creates another template. Requires the `api_deals_create` scope, the bound user's edit access to the deal, and a plan that includes templates. Idempotency-Key is required and enforced server-side for safe retries.",
        "tags": ["Deals"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Organization ID the key is operating in",
              "example": "org_2abc123"
            },
            "required": true,
            "description": "Organization ID the key is operating in",
            "name": "orgId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "dealId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required client-supplied idempotency key for safe retries",
              "example": "550e8400-e29b-41d4-a716-446655440000"
            },
            "required": true,
            "description": "Required client-supplied idempotency key for safe retries",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicCreateDealTemplateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Template created as a copy of the deal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicDealTemplateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Billing entitlement required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. When the Bearer token is valid but the API key lacks a required scope for this operation, the response is HTTP 403 with error code `FORBIDDEN` and message `Forbidden` (standard error envelope). When the key is not allowed to access the path organization, the response is HTTP 403 with error code `ORG_NOT_ALLOWED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (`409`). `IDEMPOTENCY_HASH_MISMATCH` when the same Idempotency-Key is reused with a different request body; retries with the same body replay the original success response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported field for public API v1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (`429`). Error code `RATE_LIMITED` and message `Too many requests` (standard error envelope).",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the client may retry"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiErrorEnvelope"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {},
  "tags": [
    {
      "name": "API keys",
      "x-displayName": "API Keys",
      "description": "Authenticate and inspect API keys."
    },
    {
      "name": "Deals",
      "description": "Create and list deals."
    },
    {
      "name": "Wizards",
      "x-displayName": "Deal Wizards",
      "description": "Run deal wizards: match, answer questions, submit."
    },
    {
      "name": "Submissions",
      "description": "Read signing workflow state for submissions you created."
    },
    {
      "name": "Packages",
      "description": "Manage packages on a deal."
    },
    {
      "name": "Tasks",
      "x-displayName": "Tasks and Checklists",
      "description": "Task lifecycle, assignment, and listing."
    },
    {
      "name": "Contacts",
      "description": "Create, list, update, and delete contacts."
    },
    {
      "name": "Documents",
      "description": "Document upload flows."
    },
    {
      "name": "Insights",
      "description": "List and upload insight documents and folders."
    },
    {
      "name": "OpenAPI",
      "x-displayName": "OpenAPI",
      "description": "Machine-readable API description."
    }
  ]
}
