{
  "openapi": "3.1.0",
  "info": {
    "title": "Kyo REST API",
    "version": "1.0.0",
    "summary": "Read and write a Kyo agencyOS workspace — CRM, tasks, spaces, metrics, finance, HR, documents and automations.",
    "description": "The public REST API for Kyo (https://www.trykyo.com), an agencyOS: one workspace holding a\nCRM, projects and tasks, client spaces, finance, HR and a knowledge base.\n\n**Authentication.** Every call carries an OAuth 2.0 access token (`Authorization: Bearer kyo_at_…`)\nplus a public `apikey` routing header. Tokens are obtained through the authorization-code + PKCE\nflow documented at https://www.trykyo.com/docs/oauth. Clients may self-register (RFC 7591) at the registration\nendpoint, or be registered by a workspace admin under Settings → API.\n\n**Two permission gates.** A call succeeds only when the token holds the required scope AND the\nauthorizing user holds the matching feature permission in the workspace. Granting an app\n`finance:read` cannot give a member finance access they do not have in Kyo.\n\n**Non-destructive.** v1 has no DELETE — it returns 405 everywhere. The single removal-shaped\noperation is unlinking a join record with `?detach=true` on POST.\n\n**Pagination.** List responses are `{ data, next_cursor }`. Page by passing `cursor` until\n`next_cursor` is null. `limit` defaults to 50 and is capped at 200.\n\n**Rate limits.** 60 requests/minute per token and 600/minute per workspace. Responses carry\n`X-RateLimit-Remaining` and `X-RateLimit-Reset`; a 429 carries `Retry-After`.",
    "termsOfService": "https://www.trykyo.com/tos",
    "contact": {
      "name": "Kyo support",
      "email": "hello@trykyo.com",
      "url": "https://www.trykyo.com/contact"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://www.trykyo.com/tos"
    }
  },
  "externalDocs": {
    "description": "Kyo API reference",
    "url": "https://www.trykyo.com/docs/api"
  },
  "servers": [
    {
      "url": "https://pvozbkuhjofzitsmpspf.supabase.co/functions/v1/api-v1/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "oauth2": []
    },
    {
      "apikey": []
    }
  ],
  "tags": [
    {
      "name": "AI agents",
      "description": "The workspace's AI agents and their instructions."
    },
    {
      "name": "Automations",
      "description": "Workspace automations and their run history."
    },
    {
      "name": "CRM",
      "description": "Deals, contacts, companies, pipelines and their stages."
    },
    {
      "name": "Competitor research",
      "description": "Competitor monitoring workflows and the reports they produce."
    },
    {
      "name": "Enrichment",
      "description": "Metered company enrichment."
    },
    {
      "name": "Finance",
      "description": "Income, expenses, categories, debts and debt payments."
    },
    {
      "name": "HR",
      "description": "Team directory, departments, contracts, change requests, org chart and time off."
    },
    {
      "name": "Library",
      "description": "Documents, knowledge-base files and canvases."
    },
    {
      "name": "Metrics",
      "description": "Tracked metrics, their sub-pages and hand-logged entries."
    },
    {
      "name": "Spaces",
      "description": "Client spaces, projects, kanban stages, membership and status updates."
    },
    {
      "name": "Tasks",
      "description": "Tasks, labels, comments and attachment metadata."
    },
    {
      "name": "Workspace",
      "description": "Members, workspace settings, the activity feed and the credit balance."
    }
  ],
  "paths": {
    "/deals": {
      "get": {
        "operationId": "listDeals",
        "tags": [
          "CRM"
        ],
        "summary": "List deals",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "deals:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "pipeline_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `pipeline_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "pipeline_stage_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `pipeline_stage_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "owner_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `owner_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "company_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `company_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of deals.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createDeals",
        "tags": [
          "CRM"
        ],
        "summary": "Create a deal",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "deals:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DealsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Deals record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/deals/{id}": {
      "get": {
        "operationId": "getDeals",
        "tags": [
          "CRM"
        ],
        "summary": "Get a deal by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "deals:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Deals record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateDeals",
        "tags": [
          "CRM"
        ],
        "summary": "Update a deal",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "deals:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DealsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Deals record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/people": {
      "get": {
        "operationId": "listPeople",
        "tags": [
          "CRM"
        ],
        "summary": "List people",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "people:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "company_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `company_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `email`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of people.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createPeople",
        "tags": [
          "CRM"
        ],
        "summary": "Create a people",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "people:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PeopleCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created People record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/people/{id}": {
      "get": {
        "operationId": "getPeople",
        "tags": [
          "CRM"
        ],
        "summary": "Get a people by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "people:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The People record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updatePeople",
        "tags": [
          "CRM"
        ],
        "summary": "Update a people",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "people:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PeopleUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated People record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/companies": {
      "get": {
        "operationId": "listCompanies",
        "tags": [
          "CRM"
        ],
        "summary": "List companies",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "companies:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "industry",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `industry`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of companies.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createCompanies",
        "tags": [
          "CRM"
        ],
        "summary": "Create a companie",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "companies:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompaniesCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Companies record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/companies/{id}": {
      "get": {
        "operationId": "getCompanies",
        "tags": [
          "CRM"
        ],
        "summary": "Get a companie by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "companies:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Companies record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateCompanies",
        "tags": [
          "CRM"
        ],
        "summary": "Update a companie",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "companies:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompaniesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Companies record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/tasks": {
      "get": {
        "operationId": "listTasks",
        "tags": [
          "Tasks"
        ],
        "summary": "List tasks",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "tasks:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "space_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `space_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "project_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `project_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assignee_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `assignee_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "completed",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `completed`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "is_private",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `is_private`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "stage_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `stage_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createTasks",
        "tags": [
          "Tasks"
        ],
        "summary": "Create a task",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token.",
        "security": [
          {
            "oauth2": [
              "tasks:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TasksCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Tasks record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/tasks/{id}": {
      "get": {
        "operationId": "getTasks",
        "tags": [
          "Tasks"
        ],
        "summary": "Get a task by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "tasks:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Tasks record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateTasks",
        "tags": [
          "Tasks"
        ],
        "summary": "Update a task",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`.",
        "security": [
          {
            "oauth2": [
              "tasks:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TasksUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Tasks record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/deal_tasks": {
      "get": {
        "operationId": "listDealTasks",
        "tags": [
          "CRM"
        ],
        "summary": "List deal tasks",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "tasks:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "deal_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `deal_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assignee_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `assignee_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "completed",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `completed`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "is_private",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `is_private`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of deal tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createDealTasks",
        "tags": [
          "CRM"
        ],
        "summary": "Create a deal task",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "tasks:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DealTasksCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Deal tasks record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/deal_tasks/{id}": {
      "get": {
        "operationId": "getDealTasks",
        "tags": [
          "CRM"
        ],
        "summary": "Get a deal task by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "tasks:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Deal tasks record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateDealTasks",
        "tags": [
          "CRM"
        ],
        "summary": "Update a deal task",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "tasks:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DealTasksUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Deal tasks record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/pipelines": {
      "get": {
        "operationId": "listPipelines",
        "tags": [
          "CRM"
        ],
        "summary": "List pipelines",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "pipelines:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of pipelines.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createPipelines",
        "tags": [
          "CRM"
        ],
        "summary": "Create a pipeline",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "pipelines:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PipelinesCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Pipelines record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/pipelines/{id}": {
      "get": {
        "operationId": "getPipelines",
        "tags": [
          "CRM"
        ],
        "summary": "Get a pipeline by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "pipelines:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Pipelines record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updatePipelines",
        "tags": [
          "CRM"
        ],
        "summary": "Update a pipeline",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "pipelines:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PipelinesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Pipelines record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/pipeline_stages": {
      "get": {
        "operationId": "listPipelineStages",
        "tags": [
          "CRM"
        ],
        "summary": "List pipeline stages",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "pipelines:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "pipeline_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `pipeline_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of pipeline stages.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createPipelineStages",
        "tags": [
          "CRM"
        ],
        "summary": "Create a pipeline stage",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "pipelines:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PipelineStagesCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Pipeline stages record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/pipeline_stages/{id}": {
      "get": {
        "operationId": "getPipelineStages",
        "tags": [
          "CRM"
        ],
        "summary": "Get a pipeline stage by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "pipelines:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Pipeline stages record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updatePipelineStages",
        "tags": [
          "CRM"
        ],
        "summary": "Update a pipeline stage",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "pipelines:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PipelineStagesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Pipeline stages record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/labels": {
      "get": {
        "operationId": "listLabels",
        "tags": [
          "Tasks"
        ],
        "summary": "List labels",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "labels:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of labels.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createLabels",
        "tags": [
          "Tasks"
        ],
        "summary": "Create a label",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token.",
        "security": [
          {
            "oauth2": [
              "labels:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LabelsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Labels record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/labels/{id}": {
      "get": {
        "operationId": "getLabels",
        "tags": [
          "Tasks"
        ],
        "summary": "Get a label by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "labels:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Labels record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateLabels",
        "tags": [
          "Tasks"
        ],
        "summary": "Update a label",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`.",
        "security": [
          {
            "oauth2": [
              "labels:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LabelsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Labels record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/deal_people": {
      "get": {
        "operationId": "listDealPeople",
        "tags": [
          "CRM"
        ],
        "summary": "List deal people",
        "description": "Returns `{ data, next_cursor }`. This resource is naturally small and returns a single bounded page with `next_cursor: null`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "deals:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "deal_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `deal_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "person_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `person_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of deal people.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createDealPeople",
        "tags": [
          "CRM"
        ],
        "summary": "Link or unlink deal people",
        "description": "Creates the join record. Pass `?detach=true` to unlink instead — the only removal-shaped operation in v1; both linked records are kept. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "deals:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "detach",
            "in": "query",
            "required": false,
            "description": "Set to `true` to unlink the join record instead of creating it.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DealPeopleCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Deal people record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/comments": {
      "get": {
        "operationId": "listComments",
        "tags": [
          "Tasks"
        ],
        "summary": "List comments",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "comments:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "entity_type",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `entity_type`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entity_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `entity_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of comments.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createComments",
        "tags": [
          "Tasks"
        ],
        "summary": "Create a comment",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token.",
        "security": [
          {
            "oauth2": [
              "comments:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommentsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Comments record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/comments/{id}": {
      "get": {
        "operationId": "getComments",
        "tags": [
          "Tasks"
        ],
        "summary": "Get a comment by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "comments:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Comments record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateComments",
        "tags": [
          "Tasks"
        ],
        "summary": "Update a comment",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`.",
        "security": [
          {
            "oauth2": [
              "comments:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommentsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Comments record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/activity": {
      "get": {
        "operationId": "listActivity",
        "tags": [
          "Workspace"
        ],
        "summary": "List activity",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "activity:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "entity_type",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `entity_type`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entity_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `entity_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of activity.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/activity/{id}": {
      "get": {
        "operationId": "getActivity",
        "tags": [
          "Workspace"
        ],
        "summary": "Get a activity by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "activity:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Activity record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/spaces": {
      "get": {
        "operationId": "listSpaces",
        "tags": [
          "Spaces"
        ],
        "summary": "List spaces",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "spaces:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `status`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_default",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `is_default`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of spaces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createSpaces",
        "tags": [
          "Spaces"
        ],
        "summary": "Create a space",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token.",
        "security": [
          {
            "oauth2": [
              "spaces:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpacesCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Spaces record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/spaces/{id}": {
      "get": {
        "operationId": "getSpaces",
        "tags": [
          "Spaces"
        ],
        "summary": "Get a space by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "spaces:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Spaces record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateSpaces",
        "tags": [
          "Spaces"
        ],
        "summary": "Update a space",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`.",
        "security": [
          {
            "oauth2": [
              "spaces:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpacesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Spaces record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/projects": {
      "get": {
        "operationId": "listProjects",
        "tags": [
          "Spaces"
        ],
        "summary": "List projects",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "spaces:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "space_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `space_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of projects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createProjects",
        "tags": [
          "Spaces"
        ],
        "summary": "Create a project",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token.",
        "security": [
          {
            "oauth2": [
              "spaces:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Projects record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/projects/{id}": {
      "get": {
        "operationId": "getProjects",
        "tags": [
          "Spaces"
        ],
        "summary": "Get a project by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "spaces:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Projects record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateProjects",
        "tags": [
          "Spaces"
        ],
        "summary": "Update a project",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`.",
        "security": [
          {
            "oauth2": [
              "spaces:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Projects record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/credits": {
      "get": {
        "operationId": "listCredits",
        "tags": [
          "Workspace"
        ],
        "summary": "List credits",
        "description": "Returns `{ data, next_cursor }`. This resource is naturally small and returns a single bounded page with `next_cursor: null`.",
        "security": [
          {
            "oauth2": [
              "credits:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of credits.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/metrics": {
      "get": {
        "operationId": "listMetrics",
        "tags": [
          "Metrics"
        ],
        "summary": "List metrics",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `page_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `kind`.",
            "schema": {
              "type": "string",
              "enum": [
                "formula",
                "date_diff",
                "manual"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of metrics.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createMetrics",
        "tags": [
          "Metrics"
        ],
        "summary": "Create a metric",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MetricsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Metrics record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/metrics/{id}": {
      "get": {
        "operationId": "getMetrics",
        "tags": [
          "Metrics"
        ],
        "summary": "Get a metric by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Metrics record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateMetrics",
        "tags": [
          "Metrics"
        ],
        "summary": "Update a metric",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MetricsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Metrics record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/metric_pages": {
      "get": {
        "operationId": "listMetricPages",
        "tags": [
          "Metrics"
        ],
        "summary": "List metric pages",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of metric pages.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createMetricPages",
        "tags": [
          "Metrics"
        ],
        "summary": "Create a metric page",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MetricPagesCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Metric pages record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/metric_pages/{id}": {
      "get": {
        "operationId": "getMetricPages",
        "tags": [
          "Metrics"
        ],
        "summary": "Get a metric page by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Metric pages record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateMetricPages",
        "tags": [
          "Metrics"
        ],
        "summary": "Update a metric page",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MetricPagesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Metric pages record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/metric_entries": {
      "get": {
        "operationId": "listMetricEntries",
        "tags": [
          "Metrics"
        ],
        "summary": "List metric entries",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "metric_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `metric_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "entry_kind",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `entry_kind`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of metric entries.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createMetricEntries",
        "tags": [
          "Metrics"
        ],
        "summary": "Create a metric entrie",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MetricEntriesCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Metric entries record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/metric_entries/{id}": {
      "get": {
        "operationId": "getMetricEntries",
        "tags": [
          "Metrics"
        ],
        "summary": "Get a metric entrie by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Metric entries record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateMetricEntries",
        "tags": [
          "Metrics"
        ],
        "summary": "Update a metric entrie",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **metrics** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "metrics:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MetricEntriesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Metric entries record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/income": {
      "get": {
        "operationId": "listIncome",
        "tags": [
          "Finance"
        ],
        "summary": "List income",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `type`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recurrence",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `recurrence`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of income.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createIncome",
        "tags": [
          "Finance"
        ],
        "summary": "Create a income",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IncomeCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Income record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/income/{id}": {
      "get": {
        "operationId": "getIncome",
        "tags": [
          "Finance"
        ],
        "summary": "Get a income by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Income record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateIncome",
        "tags": [
          "Finance"
        ],
        "summary": "Update a income",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IncomeUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Income record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/expenses": {
      "get": {
        "operationId": "listExpenses",
        "tags": [
          "Finance"
        ],
        "summary": "List expenses",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `type`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recurrence",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `recurrence`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of expenses.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createExpenses",
        "tags": [
          "Finance"
        ],
        "summary": "Create a expense",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpensesCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Expenses record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/expenses/{id}": {
      "get": {
        "operationId": "getExpenses",
        "tags": [
          "Finance"
        ],
        "summary": "Get a expense by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Expenses record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateExpenses",
        "tags": [
          "Finance"
        ],
        "summary": "Update a expense",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpensesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Expenses record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/finance_categories": {
      "get": {
        "operationId": "listFinanceCategories",
        "tags": [
          "Finance"
        ],
        "summary": "List finance categories",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `kind`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pl_section",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `pl_section`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of finance categories.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createFinanceCategories",
        "tags": [
          "Finance"
        ],
        "summary": "Create a finance categorie",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FinanceCategoriesCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Finance categories record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/finance_categories/{id}": {
      "get": {
        "operationId": "getFinanceCategories",
        "tags": [
          "Finance"
        ],
        "summary": "Get a finance categorie by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Finance categories record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateFinanceCategories",
        "tags": [
          "Finance"
        ],
        "summary": "Update a finance categorie",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FinanceCategoriesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Finance categories record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/debts": {
      "get": {
        "operationId": "listDebts",
        "tags": [
          "Finance"
        ],
        "summary": "List debts",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "expense_type",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `expense_type`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of debts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createDebts",
        "tags": [
          "Finance"
        ],
        "summary": "Create a debt",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DebtsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Debts record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/debts/{id}": {
      "get": {
        "operationId": "getDebts",
        "tags": [
          "Finance"
        ],
        "summary": "Get a debt by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Debts record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateDebts",
        "tags": [
          "Finance"
        ],
        "summary": "Update a debt",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DebtsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Debts record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/debt_payments": {
      "get": {
        "operationId": "listDebtPayments",
        "tags": [
          "Finance"
        ],
        "summary": "List debt payments",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "debt_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `debt_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of debt payments.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createDebtPayments",
        "tags": [
          "Finance"
        ],
        "summary": "Create a debt payment",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DebtPaymentsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Debt payments record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/debt_payments/{id}": {
      "get": {
        "operationId": "getDebtPayments",
        "tags": [
          "Finance"
        ],
        "summary": "Get a debt payment by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Debt payments record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateDebtPayments",
        "tags": [
          "Finance"
        ],
        "summary": "Update a debt payment",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **finance** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "finance:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DebtPaymentsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Debt payments record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/team_members": {
      "get": {
        "operationId": "listTeamMembers",
        "tags": [
          "HR"
        ],
        "summary": "List team members",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `archived`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "department_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `department_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `user_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "team_role",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `team_role`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of team members.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createTeamMembers",
        "tags": [
          "HR"
        ],
        "summary": "Create a team member",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamMembersCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Team members record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/team_members/{id}": {
      "get": {
        "operationId": "getTeamMembers",
        "tags": [
          "HR"
        ],
        "summary": "Get a team member by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Team members record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateTeamMembers",
        "tags": [
          "HR"
        ],
        "summary": "Update a team member",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamMembersUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Team members record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/departments": {
      "get": {
        "operationId": "listDepartments",
        "tags": [
          "HR"
        ],
        "summary": "List departments",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of departments.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createDepartments",
        "tags": [
          "HR"
        ],
        "summary": "Create a department",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Departments record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/departments/{id}": {
      "get": {
        "operationId": "getDepartments",
        "tags": [
          "HR"
        ],
        "summary": "Get a department by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Departments record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateDepartments",
        "tags": [
          "HR"
        ],
        "summary": "Update a department",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Departments record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/leave_requests": {
      "get": {
        "operationId": "listLeaveRequests",
        "tags": [
          "HR"
        ],
        "summary": "List leave requests",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `user_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `status`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `type`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of leave requests.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createLeaveRequests",
        "tags": [
          "HR"
        ],
        "summary": "Create a leave request",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeaveRequestsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Leave requests record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/leave_requests/{id}": {
      "get": {
        "operationId": "getLeaveRequests",
        "tags": [
          "HR"
        ],
        "summary": "Get a leave request by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Leave requests record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateLeaveRequests",
        "tags": [
          "HR"
        ],
        "summary": "Update a leave request",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Changing `status` records you as the reviewer and stamps the review time. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeaveRequestsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Leave requests record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/hr_contracts": {
      "get": {
        "operationId": "listHrContracts",
        "tags": [
          "HR"
        ],
        "summary": "List hr contracts",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "member_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `member_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "is_current",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `is_current`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of hr contracts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createHrContracts",
        "tags": [
          "HR"
        ],
        "summary": "Create a hr contract",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HrContractsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Hr contracts record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/hr_contracts/{id}": {
      "get": {
        "operationId": "getHrContracts",
        "tags": [
          "HR"
        ],
        "summary": "Get a hr contract by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Hr contracts record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateHrContracts",
        "tags": [
          "HR"
        ],
        "summary": "Update a hr contract",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HrContractsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Hr contracts record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/hr_change_requests": {
      "get": {
        "operationId": "listHrChangeRequests",
        "tags": [
          "HR"
        ],
        "summary": "List hr change requests",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "member_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `member_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `status`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of hr change requests.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createHrChangeRequests",
        "tags": [
          "HR"
        ],
        "summary": "Create a hr change request",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HrChangeRequestsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Hr change requests record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/hr_change_requests/{id}": {
      "get": {
        "operationId": "getHrChangeRequests",
        "tags": [
          "HR"
        ],
        "summary": "Get a hr change request by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Hr change requests record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateHrChangeRequests",
        "tags": [
          "HR"
        ],
        "summary": "Update a hr change request",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Changing `status` records you as the reviewer and stamps the review time. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HrChangeRequestsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Hr change requests record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/org_chart": {
      "get": {
        "operationId": "listOrgChart",
        "tags": [
          "HR"
        ],
        "summary": "List org chart",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "parent_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `parent_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `user_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of org chart.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createOrgChart",
        "tags": [
          "HR"
        ],
        "summary": "Create a org chart",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrgChartCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Org chart record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/org_chart/{id}": {
      "get": {
        "operationId": "getOrgChart",
        "tags": [
          "HR"
        ],
        "summary": "Get a org chart by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Org chart record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateOrgChart",
        "tags": [
          "HR"
        ],
        "summary": "Update a org chart",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Requires the authorizing user's **hr** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "hr:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrgChartUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Org chart record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents": {
      "get": {
        "operationId": "listDocuments",
        "tags": [
          "Library"
        ],
        "summary": "List documents",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "docs:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of documents.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createDocuments",
        "tags": [
          "Library"
        ],
        "summary": "Create a document",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token.",
        "security": [
          {
            "oauth2": [
              "docs:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Documents record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}": {
      "get": {
        "operationId": "getDocuments",
        "tags": [
          "Library"
        ],
        "summary": "Get a document by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "docs:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Documents record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateDocuments",
        "tags": [
          "Library"
        ],
        "summary": "Update a document",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`.",
        "security": [
          {
            "oauth2": [
              "docs:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Documents record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/knowledge": {
      "get": {
        "operationId": "listKnowledge",
        "tags": [
          "Library"
        ],
        "summary": "List knowledge",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "docs:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `type`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `source`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of knowledge.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createKnowledge",
        "tags": [
          "Library"
        ],
        "summary": "Create a knowledge",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token.",
        "security": [
          {
            "oauth2": [
              "docs:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Knowledge record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/knowledge/{id}": {
      "get": {
        "operationId": "getKnowledge",
        "tags": [
          "Library"
        ],
        "summary": "Get a knowledge by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "docs:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Knowledge record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateKnowledge",
        "tags": [
          "Library"
        ],
        "summary": "Update a knowledge",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`.",
        "security": [
          {
            "oauth2": [
              "docs:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Knowledge record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/canvases": {
      "get": {
        "operationId": "listCanvases",
        "tags": [
          "Library"
        ],
        "summary": "List canvases",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "docs:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `type`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "folder_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `folder_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "is_knowledge_base",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `is_knowledge_base`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of canvases.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createCanvases",
        "tags": [
          "Library"
        ],
        "summary": "Create a canvase",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token.",
        "security": [
          {
            "oauth2": [
              "docs:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CanvasesCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Canvases record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/canvases/{id}": {
      "get": {
        "operationId": "getCanvases",
        "tags": [
          "Library"
        ],
        "summary": "Get a canvase by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "docs:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Canvases record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateCanvases",
        "tags": [
          "Library"
        ],
        "summary": "Update a canvase",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`.",
        "security": [
          {
            "oauth2": [
              "docs:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CanvasesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Canvases record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/automations": {
      "get": {
        "operationId": "listAutomations",
        "tags": [
          "Automations"
        ],
        "summary": "List automations",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Creating or updating requires workspace admin (enforced in the database).",
        "security": [
          {
            "oauth2": [
              "automations:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "enabled",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `enabled`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "section",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `section`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of automations.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createAutomations",
        "tags": [
          "Automations"
        ],
        "summary": "Create a automation",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Creating or updating requires workspace admin (enforced in the database).",
        "security": [
          {
            "oauth2": [
              "automations:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Automations record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/automations/{id}": {
      "get": {
        "operationId": "getAutomations",
        "tags": [
          "Automations"
        ],
        "summary": "Get a automation by id",
        "description": "Returns `{ data }`. Creating or updating requires workspace admin (enforced in the database).",
        "security": [
          {
            "oauth2": [
              "automations:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Automations record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateAutomations",
        "tags": [
          "Automations"
        ],
        "summary": "Update a automation",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Creating or updating requires workspace admin (enforced in the database).",
        "security": [
          {
            "oauth2": [
              "automations:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Automations record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/automation_logs": {
      "get": {
        "operationId": "listAutomationLogs",
        "tags": [
          "Automations"
        ],
        "summary": "List automation logs",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "automations:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "automation_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `automation_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "success",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `success`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of automation logs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/automation_logs/{id}": {
      "get": {
        "operationId": "getAutomationLogs",
        "tags": [
          "Automations"
        ],
        "summary": "Get a automation log by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "automations:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Automation logs record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/competitor_workflows": {
      "get": {
        "operationId": "listCompetitorWorkflows",
        "tags": [
          "Competitor research"
        ],
        "summary": "List competitor workflows",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **competitors** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "competitors:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `status`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "space_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `space_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of competitor workflows.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/competitor_workflows/{id}": {
      "get": {
        "operationId": "getCompetitorWorkflows",
        "tags": [
          "Competitor research"
        ],
        "summary": "Get a competitor workflow by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **competitors** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "competitors:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Competitor workflows record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/competitor_reports": {
      "get": {
        "operationId": "listCompetitorReports",
        "tags": [
          "Competitor research"
        ],
        "summary": "List competitor reports",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **competitors** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "competitors:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "workflow_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `workflow_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "importance",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `importance`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of competitor reports.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/competitor_reports/{id}": {
      "get": {
        "operationId": "getCompetitorReports",
        "tags": [
          "Competitor research"
        ],
        "summary": "Get a competitor report by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **competitors** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "competitors:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Competitor reports record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/agents": {
      "get": {
        "operationId": "listAgents",
        "tags": [
          "AI agents"
        ],
        "summary": "List agents",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **agents** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "agents:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `user_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "is_default",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `is_default`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of agents.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/agents/{id}": {
      "get": {
        "operationId": "getAgents",
        "tags": [
          "AI agents"
        ],
        "summary": "Get a agent by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **agents** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "agents:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Agents record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/users": {
      "get": {
        "operationId": "listUsers",
        "tags": [
          "Workspace"
        ],
        "summary": "List users",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. A non-admin may only update their own record.",
        "security": [
          {
            "oauth2": [
              "directory:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `email`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "role",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `role`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_agent",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `is_agent`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `status`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of users.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/users/{id}": {
      "get": {
        "operationId": "getUsers",
        "tags": [
          "Workspace"
        ],
        "summary": "Get a user by id",
        "description": "Returns `{ data }`. A non-admin may only update their own record.",
        "security": [
          {
            "oauth2": [
              "directory:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Users record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateUsers",
        "tags": [
          "Workspace"
        ],
        "summary": "Update a user",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. A non-admin may only update their own record.",
        "security": [
          {
            "oauth2": [
              "directory:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UsersUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Users record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/workspace": {
      "get": {
        "operationId": "listWorkspace",
        "tags": [
          "Workspace"
        ],
        "summary": "List workspace",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Writes require workspace admin.",
        "security": [
          {
            "oauth2": [
              "directory:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/workspace/{id}": {
      "get": {
        "operationId": "getWorkspace",
        "tags": [
          "Workspace"
        ],
        "summary": "Get a workspace by id",
        "description": "Returns `{ data }`. Writes require workspace admin.",
        "security": [
          {
            "oauth2": [
              "directory:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Workspace record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateWorkspace",
        "tags": [
          "Workspace"
        ],
        "summary": "Update a workspace",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`. Writes require workspace admin.",
        "security": [
          {
            "oauth2": [
              "directory:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkspaceUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Workspace record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/project_stages": {
      "get": {
        "operationId": "listProjectStages",
        "tags": [
          "Spaces"
        ],
        "summary": "List project stages",
        "description": "Returns `{ data, next_cursor }`. This resource is naturally small and returns a single bounded page with `next_cursor: null`.",
        "security": [
          {
            "oauth2": [
              "spaces:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "project_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `project_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of project stages.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createProjectStages",
        "tags": [
          "Spaces"
        ],
        "summary": "Create a project stage",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token.",
        "security": [
          {
            "oauth2": [
              "spaces:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectStagesCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Project stages record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/project_stages/{id}": {
      "get": {
        "operationId": "getProjectStages",
        "tags": [
          "Spaces"
        ],
        "summary": "Get a project stage by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "spaces:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Project stages record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateProjectStages",
        "tags": [
          "Spaces"
        ],
        "summary": "Update a project stage",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`.",
        "security": [
          {
            "oauth2": [
              "spaces:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectStagesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Project stages record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/space_members": {
      "get": {
        "operationId": "listSpaceMembers",
        "tags": [
          "Spaces"
        ],
        "summary": "List space members",
        "description": "Returns `{ data, next_cursor }`. This resource is naturally small and returns a single bounded page with `next_cursor: null`.",
        "security": [
          {
            "oauth2": [
              "spaces:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "space_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `space_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `user_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of space members.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createSpaceMembers",
        "tags": [
          "Spaces"
        ],
        "summary": "Link or unlink space members",
        "description": "Creates the join record. Pass `?detach=true` to unlink instead — the only removal-shaped operation in v1; both linked records are kept. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token.",
        "security": [
          {
            "oauth2": [
              "spaces:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "detach",
            "in": "query",
            "required": false,
            "description": "Set to `true` to unlink the join record instead of creating it.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpaceMembersCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Space members record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/space_updates": {
      "get": {
        "operationId": "listSpaceUpdates",
        "tags": [
          "Spaces"
        ],
        "summary": "List space updates",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "spaces:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "space_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `space_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `status`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of space updates.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createSpaceUpdates",
        "tags": [
          "Spaces"
        ],
        "summary": "Create a space update",
        "description": "Creates the record and returns it as `{ data }`. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token.",
        "security": [
          {
            "oauth2": [
              "spaces:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpaceUpdatesCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Space updates record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/space_updates/{id}": {
      "get": {
        "operationId": "getSpaceUpdates",
        "tags": [
          "Spaces"
        ],
        "summary": "Get a space update by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "spaces:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Space updates record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateSpaceUpdates",
        "tags": [
          "Spaces"
        ],
        "summary": "Update a space update",
        "description": "Partial update — send only the fields you are changing. Returns the updated record as `{ data }`.",
        "security": [
          {
            "oauth2": [
              "spaces:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpaceUpdatesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated Space updates record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/task_attachments": {
      "get": {
        "operationId": "listTaskAttachments",
        "tags": [
          "Tasks"
        ],
        "summary": "List task attachments",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then.",
        "security": [
          {
            "oauth2": [
              "tasks:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `task_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "crm_task_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `crm_task_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "space_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `space_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of task attachments.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/task_attachments/{id}": {
      "get": {
        "operationId": "getTaskAttachments",
        "tags": [
          "Tasks"
        ],
        "summary": "Get a task attachment by id",
        "description": "Returns `{ data }`.",
        "security": [
          {
            "oauth2": [
              "tasks:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Task attachments record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/deal_labels": {
      "get": {
        "operationId": "listDealLabels",
        "tags": [
          "CRM"
        ],
        "summary": "List deal labels",
        "description": "Returns `{ data, next_cursor }`. This resource is naturally small and returns a single bounded page with `next_cursor: null`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "deals:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "deal_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `deal_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "label_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `label_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of deal labels.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createDealLabels",
        "tags": [
          "CRM"
        ],
        "summary": "Link or unlink deal labels",
        "description": "Creates the join record. Pass `?detach=true` to unlink instead — the only removal-shaped operation in v1; both linked records are kept. Only the fields below are accepted; anything else in the body is ignored. Server-owned columns (workspace, creator, requester) are set from your token. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "deals:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "detach",
            "in": "query",
            "required": false,
            "description": "Set to `true` to unlink the join record instead of creating it.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DealLabelsCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created Deal labels record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/crm_files": {
      "get": {
        "operationId": "listCrmFiles",
        "tags": [
          "CRM"
        ],
        "summary": "List crm files",
        "description": "Returns `{ data, next_cursor }`. Page by passing `cursor` until `next_cursor` is null; treat a list as complete only then. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "deals:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "name": "deal_id",
            "in": "query",
            "required": false,
            "description": "Exact-match filter on `deal_id`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of crm files.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cursor for the next page, or null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/crm_files/{id}": {
      "get": {
        "operationId": "getCrmFiles",
        "tags": [
          "CRM"
        ],
        "summary": "Get a crm file by id",
        "description": "Returns `{ data }`. Requires the authorizing user's **crm** permission (read for GET, full for writes).",
        "security": [
          {
            "oauth2": [
              "deals:read"
            ]
          },
          {
            "apikey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The Crm files record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/enrich": {
      "post": {
        "operationId": "enrichCompany",
        "tags": [
          "Enrichment"
        ],
        "summary": "Look up firmographics for a company domain",
        "description": "Returns name, website, industry and socials for a domain. **Metered** — a fresh lookup spends workspace credits, so call it deliberately. Cached lookups are free. Requires the opt-in `enrich:write` scope, which is not part of the default CLI grant.",
        "security": [
          {
            "oauth2": [
              "enrich:write"
            ]
          },
          {
            "apikey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnrichRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Enrichment data for the domain.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The workspace has too few credits to run the lookup.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "insufficient_credits",
                  "message": "Workspace has no credits for enrichment.",
                  "request_id": "…"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth 2.0 authorization code with PKCE (S256 only). Access tokens live 1 hour; refresh tokens rotate on every use. Request least privilege: ask only for the scopes the integration needs.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://app.trykyo.com/oauth/authorize",
            "tokenUrl": "https://pvozbkuhjofzitsmpspf.supabase.co/functions/v1/oauth-token",
            "refreshUrl": "https://pvozbkuhjofzitsmpspf.supabase.co/functions/v1/oauth-token",
            "scopes": {
              "deals:read": "Read deals, their contacts, labels and files metadata",
              "deals:write": "Create and update deals, attach people and labels",
              "people:read": "Read CRM contacts",
              "people:write": "Create and update CRM contacts",
              "companies:read": "Read companies",
              "companies:write": "Create and update companies",
              "tasks:read": "Read tasks and deal tasks (private tasks stay hidden per the authorizing user's access)",
              "tasks:write": "Create and update tasks and deal tasks",
              "pipelines:read": "Read pipelines and their stages",
              "pipelines:write": "Create and update pipelines and their stages",
              "labels:read": "Read labels",
              "labels:write": "Create labels",
              "comments:read": "Read comments on deals and tasks",
              "comments:write": "Add comments to deals and tasks",
              "spaces:read": "Read spaces and projects",
              "spaces:write": "Create and update spaces and projects",
              "activity:read": "Read the activity feed",
              "credits:read": "Read the workspace credit balance and ledger",
              "enrich:write": "Run AI enrichment (uses workspace credits)",
              "metrics:read": "Read metrics, their sub-pages and logged entries",
              "metrics:write": "Create and update metrics, sub-pages and entries",
              "finance:read": "Read income, expenses, categories and debts",
              "finance:write": "Create and update income, expenses, categories and debts",
              "hr:read": "Read the team directory, contracts, org chart and time-off requests",
              "hr:write": "Create and update team members, contracts, org chart and time-off requests",
              "docs:read": "Read documents, knowledge-base files and canvases",
              "docs:write": "Create and update documents, knowledge-base files and canvases",
              "automations:read": "Read automations and their run history",
              "automations:write": "Create and update automations",
              "competitors:read": "Read competitor workflows and their reports",
              "agents:read": "Read the workspace's AI agents and their instructions",
              "directory:read": "Read workspace members and workspace settings",
              "directory:write": "Update member profiles and workspace settings (never roles, permissions or billing)"
            }
          }
        }
      },
      "apikey": {
        "type": "apiKey",
        "in": "header",
        "name": "apikey",
        "description": "Public routing key, the same value the Kyo web app ships. It grants nothing on its own — all authorization comes from the bearer token."
      }
    },
    "parameters": {
      "Limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Page size. Defaults to 50, capped at 200.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 200,
          "default": 50
        }
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "required": false,
        "description": "Opaque keyset cursor from the previous page's `next_cursor`. Omit for the first page; stop when `next_cursor` is null.",
        "schema": {
          "type": "string"
        }
      },
      "ResourceId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Record id.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "Every non-2xx response uses this shape. `error` is a stable machine-readable code; `message` is human-readable; `request_id` also appears in the X-Request-Id header and identifies the call in support.",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Stable error code.",
            "enum": [
              "bad_request",
              "unauthorized",
              "insufficient_scope",
              "insufficient_permission",
              "forbidden",
              "not_found",
              "unknown_resource",
              "method_not_allowed",
              "validation_error",
              "rate_limited",
              "insufficient_credits",
              "create_failed",
              "update_failed",
              "upstream_error",
              "enrich_unbilled",
              "internal_error"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation, including how to resolve it where possible."
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Correlation id for this request."
          }
        },
        "examples": [
          {
            "error": "insufficient_scope",
            "message": "This token is missing the \"deals:write\" scope.",
            "request_id": "2f8b0a1e-6c2a-4a1e-9f0e-7a3c1b5d9e42"
          }
        ]
      },
      "DealsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "pipeline_id": {
            "type": "string",
            "description": "uuid"
          },
          "pipeline_stage_id": {
            "type": "string",
            "description": "uuid"
          },
          "owner_id": {
            "type": "string",
            "description": "uuid"
          },
          "value": {
            "type": "number"
          },
          "confidence": {
            "type": "integer"
          },
          "website": {
            "type": "string"
          },
          "instagram": {
            "type": "string"
          },
          "twitter": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "uuid"
          }
        },
        "required": [
          "name",
          "pipeline_id"
        ]
      },
      "DealsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "pipeline_id": {
            "type": "string",
            "description": "uuid"
          },
          "pipeline_stage_id": {
            "type": "string",
            "description": "uuid"
          },
          "owner_id": {
            "type": "string",
            "description": "uuid"
          },
          "value": {
            "type": "number"
          },
          "confidence": {
            "type": "integer"
          },
          "website": {
            "type": "string"
          },
          "instagram": {
            "type": "string"
          },
          "twitter": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "uuid"
          }
        },
        "minProperties": 1
      },
      "PeopleCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "uuid"
          },
          "phone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "position": {
            "type": "string"
          },
          "linkedin_url": {
            "type": "string"
          },
          "twitter_url": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "PeopleUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "uuid"
          },
          "phone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "position": {
            "type": "string"
          },
          "linkedin_url": {
            "type": "string"
          },
          "twitter_url": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "CompaniesCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "website": {
            "type": "string"
          },
          "instagram": {
            "type": "string"
          },
          "linkedin": {
            "type": "string"
          },
          "twitter": {
            "type": "string"
          },
          "industry": {
            "type": "string"
          },
          "size": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "CompaniesUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "website": {
            "type": "string"
          },
          "instagram": {
            "type": "string"
          },
          "linkedin": {
            "type": "string"
          },
          "twitter": {
            "type": "string"
          },
          "industry": {
            "type": "string"
          },
          "size": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "TasksCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "space_id": {
            "type": "string",
            "description": "uuid"
          },
          "project_id": {
            "type": "string",
            "description": "uuid"
          },
          "assignee_id": {
            "type": "string",
            "description": "uuid"
          },
          "assignee_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "due_date": {
            "type": "string"
          },
          "start_date": {
            "type": "string"
          },
          "priority": {
            "type": "integer",
            "description": "0–4"
          },
          "completed": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          },
          "is_private": {
            "type": "boolean"
          },
          "stage_id": {
            "type": "string",
            "format": "uuid"
          },
          "parent_task_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "name"
        ]
      },
      "TasksUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "space_id": {
            "type": "string",
            "description": "uuid"
          },
          "project_id": {
            "type": "string",
            "description": "uuid"
          },
          "assignee_id": {
            "type": "string",
            "description": "uuid"
          },
          "assignee_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "due_date": {
            "type": "string"
          },
          "start_date": {
            "type": "string"
          },
          "priority": {
            "type": "integer",
            "description": "0–4"
          },
          "completed": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          },
          "is_private": {
            "type": "boolean"
          },
          "stage_id": {
            "type": "string",
            "format": "uuid"
          },
          "parent_task_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "minProperties": 1
      },
      "DealTasksCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "deal_id": {
            "type": "string",
            "description": "uuid"
          },
          "name": {
            "type": "string"
          },
          "assignee_id": {
            "type": "string",
            "description": "uuid"
          },
          "assignee_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "due_date": {
            "type": "string"
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "priority": {
            "type": "integer"
          },
          "completed": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          },
          "is_private": {
            "type": "boolean"
          }
        },
        "required": [
          "deal_id",
          "name"
        ]
      },
      "DealTasksUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "deal_id": {
            "type": "string",
            "description": "uuid"
          },
          "name": {
            "type": "string"
          },
          "assignee_id": {
            "type": "string",
            "description": "uuid"
          },
          "assignee_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "due_date": {
            "type": "string"
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "priority": {
            "type": "integer"
          },
          "completed": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          },
          "is_private": {
            "type": "boolean"
          }
        },
        "minProperties": 1
      },
      "PipelinesCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          }
        },
        "required": [
          "name"
        ]
      },
      "PipelinesUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          }
        },
        "minProperties": 1
      },
      "PipelineStagesCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "pipeline_id": {
            "type": "string",
            "description": "uuid"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "metric_tag": {
            "type": "string",
            "enum": [
              "messages_sent",
              "responses",
              "positive_responses",
              "deals_closed"
            ],
            "description": "optional stage tag; \"deals_closed\" marks a won/closed stage"
          }
        },
        "required": [
          "pipeline_id",
          "name"
        ]
      },
      "PipelineStagesUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "pipeline_id": {
            "type": "string",
            "description": "uuid"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "metric_tag": {
            "type": "string",
            "enum": [
              "messages_sent",
              "responses",
              "positive_responses",
              "deals_closed"
            ],
            "description": "optional stage tag; \"deals_closed\" marks a won/closed stage"
          }
        },
        "minProperties": 1
      },
      "LabelsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "LabelsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "DealPeopleCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "deal_id": {
            "type": "string",
            "description": "uuid"
          },
          "person_id": {
            "type": "string",
            "description": "uuid"
          },
          "role": {
            "type": "string"
          },
          "is_primary": {
            "type": "boolean"
          }
        },
        "required": [
          "deal_id",
          "person_id"
        ]
      },
      "CommentsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "entity_type": {
            "type": "string",
            "enum": [
              "deal",
              "task"
            ]
          },
          "entity_id": {
            "type": "string",
            "description": "uuid"
          },
          "content": {
            "type": "string"
          }
        },
        "required": [
          "entity_type",
          "entity_id",
          "content"
        ]
      },
      "CommentsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "entity_type": {
            "type": "string"
          },
          "entity_id": {
            "type": "string",
            "format": "uuid"
          },
          "content": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "SpacesCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "image_url": {
            "type": "string"
          },
          "is_default": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "SpacesUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "image_url": {
            "type": "string"
          },
          "is_default": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "ProjectsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "space_id": {
            "type": "string",
            "description": "uuid"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "start_date": {
            "type": "string"
          },
          "end_date": {
            "type": "string"
          },
          "kanban_enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "space_id",
          "name"
        ]
      },
      "ProjectsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "space_id": {
            "type": "string",
            "description": "uuid"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "start_date": {
            "type": "string"
          },
          "end_date": {
            "type": "string"
          },
          "kanban_enabled": {
            "type": "boolean"
          }
        },
        "minProperties": 1
      },
      "MetricsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "formula",
              "date_diff",
              "manual"
            ],
            "description": "formula = computed from workspace data; date_diff = days between two dates; manual = aggregate of hand-logged entries"
          },
          "formula": {
            "type": "string",
            "description": "for kind=formula, e.g. deals_won / meetings_booked"
          },
          "format": {
            "type": "string",
            "enum": [
              "number",
              "currency",
              "percent",
              "days",
              "hours"
            ]
          },
          "date_range": {
            "type": "string",
            "enum": [
              "last_7d",
              "last_30d",
              "last_90d",
              "last_365d",
              "this_month",
              "this_year",
              "all"
            ]
          },
          "date_from": {
            "type": "string"
          },
          "date_to": {
            "type": "string"
          },
          "manual_type": {
            "type": "string",
            "enum": [
              "number",
              "date_range",
              "time_range"
            ],
            "description": "for kind=manual: what each logged entry is"
          },
          "agg": {
            "type": "string",
            "enum": [
              "avg",
              "sum",
              "count",
              "latest"
            ],
            "description": "for kind=manual: how entries roll up"
          },
          "page_id": {
            "type": "string",
            "description": "uuid of the metric sub-page (department hub) this belongs to"
          },
          "position": {
            "type": "integer"
          },
          "slug": {
            "type": "string"
          },
          "member_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "uuid"
            }
          },
          "space_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "uuid"
            }
          },
          "pipeline_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "uuid"
            }
          }
        },
        "required": [
          "name"
        ]
      },
      "MetricsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "formula",
              "date_diff",
              "manual"
            ],
            "description": "formula = computed from workspace data; date_diff = days between two dates; manual = aggregate of hand-logged entries"
          },
          "formula": {
            "type": "string",
            "description": "for kind=formula, e.g. deals_won / meetings_booked"
          },
          "format": {
            "type": "string",
            "enum": [
              "number",
              "currency",
              "percent",
              "days",
              "hours"
            ]
          },
          "date_range": {
            "type": "string",
            "enum": [
              "last_7d",
              "last_30d",
              "last_90d",
              "last_365d",
              "this_month",
              "this_year",
              "all"
            ]
          },
          "date_from": {
            "type": "string"
          },
          "date_to": {
            "type": "string"
          },
          "manual_type": {
            "type": "string",
            "enum": [
              "number",
              "date_range",
              "time_range"
            ],
            "description": "for kind=manual: what each logged entry is"
          },
          "agg": {
            "type": "string",
            "enum": [
              "avg",
              "sum",
              "count",
              "latest"
            ],
            "description": "for kind=manual: how entries roll up"
          },
          "page_id": {
            "type": "string",
            "description": "uuid of the metric sub-page (department hub) this belongs to"
          },
          "position": {
            "type": "integer"
          },
          "slug": {
            "type": "string"
          },
          "member_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "uuid"
            }
          },
          "space_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "uuid"
            }
          },
          "pipeline_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "uuid"
            }
          }
        },
        "minProperties": 1
      },
      "MetricPagesCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          }
        },
        "required": [
          "name"
        ]
      },
      "MetricPagesUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          }
        },
        "minProperties": 1
      },
      "MetricEntriesCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "metric_id": {
            "type": "string",
            "description": "uuid"
          },
          "entry_kind": {
            "type": "string",
            "enum": [
              "number",
              "date_range",
              "time_range"
            ],
            "description": "must match the metric’s manual_type"
          },
          "value": {
            "type": "number",
            "description": "for entry_kind=number"
          },
          "from_ts": {
            "type": "string",
            "description": "ISO timestamp — start of a date_range/time_range entry"
          },
          "to_ts": {
            "type": "string",
            "description": "ISO timestamp — end of a date_range/time_range entry"
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "metric_id",
          "entry_kind"
        ]
      },
      "MetricEntriesUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "metric_id": {
            "type": "string",
            "format": "uuid"
          },
          "entry_kind": {
            "type": "string"
          },
          "value": {
            "type": "number"
          },
          "from_ts": {
            "type": "string",
            "format": "date-time"
          },
          "to_ts": {
            "type": "string",
            "format": "date-time"
          },
          "note": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "IncomeCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "amount": {
            "type": "number"
          },
          "type": {
            "type": "string",
            "description": "finance category key, e.g. \"services\" or \"salary\" — see kyo_list_finance_categories"
          },
          "recurrence": {
            "type": "string",
            "enum": [
              "one_time",
              "monthly"
            ],
            "description": "a monthly entry is stored ONCE and expanded virtually — never create one row per month"
          },
          "avatar_url": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "date",
          "amount",
          "type"
        ]
      },
      "IncomeUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "amount": {
            "type": "number"
          },
          "type": {
            "type": "string",
            "description": "finance category key, e.g. \"services\" or \"salary\" — see kyo_list_finance_categories"
          },
          "recurrence": {
            "type": "string",
            "enum": [
              "one_time",
              "monthly"
            ],
            "description": "a monthly entry is stored ONCE and expanded virtually — never create one row per month"
          },
          "avatar_url": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "ExpensesCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "amount": {
            "type": "number"
          },
          "type": {
            "type": "string",
            "description": "finance category key, e.g. \"services\" or \"salary\" — see kyo_list_finance_categories"
          },
          "recurrence": {
            "type": "string",
            "enum": [
              "one_time",
              "monthly"
            ],
            "description": "a monthly entry is stored ONCE and expanded virtually — never create one row per month"
          },
          "avatar_url": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "date",
          "amount",
          "type"
        ]
      },
      "ExpensesUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "amount": {
            "type": "number"
          },
          "type": {
            "type": "string",
            "description": "finance category key, e.g. \"services\" or \"salary\" — see kyo_list_finance_categories"
          },
          "recurrence": {
            "type": "string",
            "enum": [
              "one_time",
              "monthly"
            ],
            "description": "a monthly entry is stored ONCE and expanded virtually — never create one row per month"
          },
          "avatar_url": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "FinanceCategoriesCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "income",
              "expense"
            ]
          },
          "pl_section": {
            "type": "string",
            "enum": [
              "revenue",
              "contra_revenue",
              "cm1",
              "cm2",
              "cm3"
            ]
          },
          "sort": {
            "type": "integer"
          }
        },
        "required": [
          "key",
          "label",
          "kind",
          "pl_section"
        ]
      },
      "FinanceCategoriesUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "pl_section": {
            "type": "string"
          },
          "sort": {
            "type": "integer"
          }
        },
        "minProperties": 1
      },
      "DebtsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "total_amount": {
            "type": "number"
          },
          "paid_amount": {
            "type": "number"
          },
          "expense_type": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "total_amount",
          "expense_type"
        ]
      },
      "DebtsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "total_amount": {
            "type": "number"
          },
          "paid_amount": {
            "type": "number"
          },
          "expense_type": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "DebtPaymentsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "debt_id": {
            "type": "string",
            "description": "uuid"
          },
          "amount": {
            "type": "number"
          },
          "date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          }
        },
        "required": [
          "debt_id",
          "amount",
          "date"
        ]
      },
      "DebtPaymentsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "debt_id": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "number"
          },
          "date": {
            "type": "string",
            "format": "date"
          }
        },
        "minProperties": 1
      },
      "TeamMembersCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "user_id": {
            "type": "string",
            "description": "uuid"
          },
          "display_name": {
            "type": "string"
          },
          "team_role": {
            "type": "string"
          },
          "squads": {
            "type": "string"
          },
          "authority_user_id": {
            "type": "string",
            "description": "uuid"
          },
          "salary": {
            "type": "number"
          },
          "date_hired": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "left_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "phone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "contract_url": {
            "type": "string"
          },
          "contract_name": {
            "type": "string"
          },
          "archived": {
            "type": "boolean"
          },
          "avatar_url": {
            "type": "string"
          },
          "slack_user_id": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "department_id": {
            "type": "string",
            "description": "uuid"
          },
          "summary": {
            "type": "string"
          },
          "gender": {
            "type": "string"
          }
        },
        "required": [
          "display_name"
        ]
      },
      "TeamMembersUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "user_id": {
            "type": "string",
            "description": "uuid"
          },
          "display_name": {
            "type": "string"
          },
          "team_role": {
            "type": "string"
          },
          "squads": {
            "type": "string"
          },
          "authority_user_id": {
            "type": "string",
            "description": "uuid"
          },
          "salary": {
            "type": "number"
          },
          "date_hired": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "left_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "phone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "contract_url": {
            "type": "string"
          },
          "contract_name": {
            "type": "string"
          },
          "archived": {
            "type": "boolean"
          },
          "avatar_url": {
            "type": "string"
          },
          "slack_user_id": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "department_id": {
            "type": "string",
            "description": "uuid"
          },
          "summary": {
            "type": "string"
          },
          "gender": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "DepartmentsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "DepartmentsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "LeaveRequestsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "leave_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "return_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "reason": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "annual",
              "sick",
              "personal"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected"
            ]
          },
          "review_reason": {
            "type": "string"
          }
        },
        "required": [
          "leave_date",
          "return_date",
          "reason"
        ]
      },
      "LeaveRequestsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "leave_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "return_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "reason": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "annual",
              "sick",
              "personal"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected"
            ]
          },
          "review_reason": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "HrContractsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "member_id": {
            "type": "string",
            "description": "uuid"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "storage_path": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "description": "YYYY-MM-DD"
          },
          "is_current": {
            "type": "boolean"
          }
        },
        "required": [
          "member_id"
        ]
      },
      "HrContractsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "member_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "storage_path": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "is_current": {
            "type": "boolean"
          }
        },
        "minProperties": 1
      },
      "HrChangeRequestsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "member_id": {
            "type": "string",
            "description": "uuid"
          },
          "type": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "member_id"
        ]
      },
      "HrChangeRequestsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "member_id": {
            "type": "string",
            "description": "uuid"
          },
          "type": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "OrgChartCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "parent_id": {
            "type": "string",
            "description": "uuid"
          },
          "title": {
            "type": "string"
          },
          "user_id": {
            "type": "string",
            "description": "uuid"
          },
          "kpis": {
            "type": "object",
            "description": "json object"
          },
          "sort_order": {
            "type": "integer"
          }
        }
      },
      "OrgChartUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "parent_id": {
            "type": "string",
            "description": "uuid"
          },
          "title": {
            "type": "string"
          },
          "user_id": {
            "type": "string",
            "description": "uuid"
          },
          "kpis": {
            "type": "object",
            "description": "json object"
          },
          "sort_order": {
            "type": "integer"
          }
        },
        "minProperties": 1
      },
      "DocumentsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "description": "document body (HTML)"
          },
          "icon": {
            "type": "string"
          },
          "icon_color": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "DocumentsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "description": "document body (HTML)"
          },
          "icon": {
            "type": "string"
          },
          "icon_color": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "KnowledgeCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "storage_path": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer"
          },
          "source": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "icon_url": {
            "type": "string"
          },
          "external_id": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "KnowledgeUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "storage_path": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer"
          },
          "source": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "icon_url": {
            "type": "string"
          },
          "external_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "minProperties": 1
      },
      "CanvasesCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "description": "canvas item type, e.g. \"canvas\""
          },
          "data": {
            "type": "object",
            "description": "json object"
          },
          "folder_id": {
            "type": "string",
            "description": "uuid"
          },
          "is_knowledge_base": {
            "type": "boolean"
          }
        },
        "required": [
          "type"
        ]
      },
      "CanvasesUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "description": "canvas item type, e.g. \"canvas\""
          },
          "data": {
            "type": "object",
            "description": "json object"
          },
          "folder_id": {
            "type": "string",
            "description": "uuid"
          },
          "is_knowledge_base": {
            "type": "boolean"
          }
        },
        "minProperties": 1
      },
      "AutomationsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "trigger": {
            "type": "object",
            "description": "json object"
          },
          "conditions": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "json object"
            }
          },
          "condition_logic": {
            "type": "string",
            "enum": [
              "and",
              "or"
            ]
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "json object"
            }
          },
          "section": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "AutomationsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "trigger": {
            "type": "object",
            "description": "json object"
          },
          "conditions": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "json object"
            }
          },
          "condition_logic": {
            "type": "string",
            "enum": [
              "and",
              "or"
            ]
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "json object"
            }
          },
          "section": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "UsersUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "display_name": {
            "type": "string"
          },
          "avatar_url": {
            "type": "string"
          },
          "task_color": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "department": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "WorkspaceUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "image_url": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "okr_enabled": {
            "type": "boolean"
          },
          "kb_ai_enabled": {
            "type": "boolean"
          },
          "report_eod_enabled": {
            "type": "boolean"
          },
          "report_eow_enabled": {
            "type": "boolean"
          },
          "report_eom_enabled": {
            "type": "boolean"
          },
          "security_contact_email": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "ProjectStagesCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "project_id": {
            "type": "string",
            "description": "uuid"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "color": {
            "type": "string"
          },
          "icon": {
            "type": "string"
          }
        },
        "required": [
          "project_id",
          "name"
        ]
      },
      "ProjectStagesUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "project_id": {
            "type": "string",
            "description": "uuid"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "color": {
            "type": "string"
          },
          "icon": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "SpaceMembersCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "space_id": {
            "type": "string",
            "description": "uuid"
          },
          "user_id": {
            "type": "string",
            "description": "uuid"
          }
        },
        "required": [
          "space_id",
          "user_id"
        ]
      },
      "SpaceUpdatesCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "space_id": {
            "type": "string",
            "description": "uuid"
          },
          "content": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "space_id",
          "content"
        ]
      },
      "SpaceUpdatesUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "space_id": {
            "type": "string",
            "format": "uuid"
          },
          "content": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "DealLabelsCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "deal_id": {
            "type": "string",
            "description": "uuid"
          },
          "label_id": {
            "type": "string",
            "description": "uuid"
          }
        },
        "required": [
          "deal_id",
          "label_id"
        ]
      },
      "EnrichRequest": {
        "type": "object",
        "required": [
          "domain"
        ],
        "additionalProperties": false,
        "properties": {
          "domain": {
            "type": "string",
            "description": "Company domain, e.g. \"acme.com\". A full URL is accepted and normalised."
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Malformed request, body, or cursor.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "bad_request",
              "message": "Malformed request, body, or cursor.",
              "request_id": "…"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing, invalid, expired, or revoked access token.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "unauthorized",
              "message": "Missing, invalid, expired, or revoked access token.",
              "request_id": "…"
            }
          }
        }
      },
      "Forbidden": {
        "description": "The token lacks the required scope, the authorizing user lacks the feature permission (insufficient_permission), or row-level security rejected the write (forbidden).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "insufficient_scope",
              "message": "The token lacks the required scope, the authorizing user lacks the feature permission (insufficient_permission), or row-level security rejected the write (forbidden).",
              "request_id": "…"
            }
          }
        }
      },
      "NotFound": {
        "description": "No such record or resource.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "not_found",
              "message": "No such record or resource.",
              "request_id": "…"
            }
          }
        }
      },
      "MethodNotAllowed": {
        "description": "Method not supported. DELETE is never available in v1.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "method_not_allowed",
              "message": "Method not supported. DELETE is never available in v1.",
              "request_id": "…"
            }
          }
        }
      },
      "ValidationError": {
        "description": "A required field is missing, not a uuid, or outside an enum.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "validation_error",
              "message": "A required field is missing, not a uuid, or outside an enum.",
              "request_id": "…"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded. Honour the Retry-After header.",
        "headers": {
          "Retry-After": {
            "description": "Seconds to wait before retrying.",
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "rate_limited",
              "message": "Rate limit exceeded. Honour the Retry-After header.",
              "request_id": "…"
            }
          }
        }
      }
    }
  }
}
