{
  "openapi": "3.1.0",
  "info": {
    "title": "Casama API",
    "version": "0.1.0",
    "license": {
      "name": "Apache-2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0"
    }
  },
  "servers": [
    {
      "url": "http://localhost:8787"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Supabase access token"
      }
    },
    "schemas": {
      "RunEvent": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/RunStartedEvent"
          },
          {
            "$ref": "#/components/schemas/MessageDeltaEvent"
          },
          {
            "$ref": "#/components/schemas/MessageCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/ToolStartedEvent"
          },
          {
            "$ref": "#/components/schemas/ToolOutputEvent"
          },
          {
            "$ref": "#/components/schemas/ToolCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/ToolFailedEvent"
          },
          {
            "$ref": "#/components/schemas/ApprovalRequestedEvent"
          },
          {
            "$ref": "#/components/schemas/ApprovalResolvedEvent"
          },
          {
            "$ref": "#/components/schemas/DeviceAccessRequestedEvent"
          },
          {
            "$ref": "#/components/schemas/DeviceDataUsedEvent"
          },
          {
            "$ref": "#/components/schemas/SecretRequestedEvent"
          },
          {
            "$ref": "#/components/schemas/SecretResolvedEvent"
          },
          {
            "$ref": "#/components/schemas/TakeoverRequestedEvent"
          },
          {
            "$ref": "#/components/schemas/TakeoverResolvedEvent"
          },
          {
            "$ref": "#/components/schemas/LeaseChangedEvent"
          },
          {
            "$ref": "#/components/schemas/ComputerStateEvent"
          },
          {
            "$ref": "#/components/schemas/CheckpointCreatedEvent"
          },
          {
            "$ref": "#/components/schemas/SubrunStartedEvent"
          },
          {
            "$ref": "#/components/schemas/SubrunCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/MemoryWrittenEvent"
          },
          {
            "$ref": "#/components/schemas/SkillLoadedEvent"
          },
          {
            "$ref": "#/components/schemas/UsageEvent"
          },
          {
            "$ref": "#/components/schemas/ModelFallbackEvent"
          },
          {
            "$ref": "#/components/schemas/NoticeEvent"
          },
          {
            "$ref": "#/components/schemas/RunCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/RunFailedEvent"
          },
          {
            "$ref": "#/components/schemas/RunCancelledEvent"
          },
          {
            "$ref": "#/components/schemas/UiShownEvent"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "run.started": "#/components/schemas/RunStartedEvent",
            "message.delta": "#/components/schemas/MessageDeltaEvent",
            "message.completed": "#/components/schemas/MessageCompletedEvent",
            "tool.started": "#/components/schemas/ToolStartedEvent",
            "tool.output": "#/components/schemas/ToolOutputEvent",
            "tool.completed": "#/components/schemas/ToolCompletedEvent",
            "tool.failed": "#/components/schemas/ToolFailedEvent",
            "approval.requested": "#/components/schemas/ApprovalRequestedEvent",
            "approval.resolved": "#/components/schemas/ApprovalResolvedEvent",
            "device.access_requested": "#/components/schemas/DeviceAccessRequestedEvent",
            "device.data_used": "#/components/schemas/DeviceDataUsedEvent",
            "secret.requested": "#/components/schemas/SecretRequestedEvent",
            "secret.resolved": "#/components/schemas/SecretResolvedEvent",
            "takeover.requested": "#/components/schemas/TakeoverRequestedEvent",
            "takeover.resolved": "#/components/schemas/TakeoverResolvedEvent",
            "lease.changed": "#/components/schemas/LeaseChangedEvent",
            "computer.state": "#/components/schemas/ComputerStateEvent",
            "checkpoint.created": "#/components/schemas/CheckpointCreatedEvent",
            "subrun.started": "#/components/schemas/SubrunStartedEvent",
            "subrun.completed": "#/components/schemas/SubrunCompletedEvent",
            "memory.written": "#/components/schemas/MemoryWrittenEvent",
            "skill.loaded": "#/components/schemas/SkillLoadedEvent",
            "usage": "#/components/schemas/UsageEvent",
            "model.fallback": "#/components/schemas/ModelFallbackEvent",
            "notice": "#/components/schemas/NoticeEvent",
            "run.completed": "#/components/schemas/RunCompletedEvent",
            "run.failed": "#/components/schemas/RunFailedEvent",
            "run.cancelled": "#/components/schemas/RunCancelledEvent",
            "ui.shown": "#/components/schemas/UiShownEvent"
          }
        }
      },
      "RunStartedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "run.started"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "trigger": {
                "type": "string"
              },
              "model": {
                "type": "string"
              },
              "computer_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            },
            "required": [
              "trigger",
              "model",
              "computer_id"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "MessageDeltaEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "message.delta"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "message_id": {
                "type": "string",
                "format": "uuid"
              },
              "text": {
                "type": "string"
              }
            },
            "required": [
              "message_id",
              "text"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "MessageCompletedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "message.completed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "message_id": {
                "type": "string",
                "format": "uuid"
              },
              "content": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "message_id",
              "content"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "ToolStartedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "tool.started"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "call_id": {
                "type": "string"
              },
              "tool": {
                "type": "string"
              },
              "args_redacted": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "required": [
              "call_id",
              "tool",
              "args_redacted"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "ToolOutputEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "tool.output"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "call_id": {
                "type": "string"
              },
              "chunk": {
                "type": "string"
              }
            },
            "required": [
              "call_id",
              "chunk"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "ToolCompletedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "tool.completed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "call_id": {
                "type": "string"
              },
              "result_preview": {
                "type": "string"
              },
              "artifact_path": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "duration_ms": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "call_id",
              "result_preview",
              "artifact_path",
              "duration_ms"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "ToolFailedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "tool.failed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "call_id": {
                "type": "string"
              },
              "error_code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "call_id",
              "error_code",
              "message"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "ApprovalRequestedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "approval.requested"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "approval_id": {
                "type": "string",
                "format": "uuid"
              },
              "tool": {
                "type": "string"
              },
              "args_redacted": {
                "type": "object",
                "additionalProperties": {}
              },
              "risk": {
                "type": "string",
                "enum": [
                  "low",
                  "medium",
                  "high"
                ]
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "approval_id",
              "tool",
              "args_redacted",
              "risk",
              "expires_at"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "ApprovalResolvedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "approval.resolved"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "approval_id": {
                "type": "string",
                "format": "uuid"
              },
              "decision": {
                "type": "string",
                "enum": [
                  "approved",
                  "denied",
                  "expired"
                ]
              },
              "decided_by": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            },
            "required": [
              "approval_id",
              "decision",
              "decided_by"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "DeviceAccessRequestedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "device.access_requested"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "calendar",
                  "reminders",
                  "contacts",
                  "places",
                  "photos",
                  "health",
                  "notifications",
                  "activity"
                ]
              },
              "reason": {
                "type": "string"
              },
              "bot_id": {
                "type": "string",
                "format": "uuid"
              }
            },
            "required": [
              "kind",
              "reason",
              "bot_id"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "DeviceDataUsedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "device.data_used"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string"
              },
              "count": {
                "type": "integer"
              },
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              },
              "devices": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "kind",
              "count",
              "from",
              "to",
              "devices"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "SecretRequestedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "secret.requested"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "request_id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "service": {
                "type": "string"
              },
              "allowed_hosts": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "reason": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "value",
                  "totp"
                ]
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "request_id",
              "name",
              "service",
              "allowed_hosts",
              "reason",
              "kind",
              "expires_at"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "SecretResolvedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "secret.resolved"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "request_id": {
                "type": "string",
                "format": "uuid"
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "fulfilled",
                  "declined",
                  "expired"
                ]
              }
            },
            "required": [
              "request_id",
              "outcome"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "TakeoverRequestedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "takeover.requested"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "computer_id": {
                "type": "string",
                "format": "uuid"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "computer_id",
              "reason"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "TakeoverResolvedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "takeover.resolved"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "computer_id": {
                "type": "string",
                "format": "uuid"
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "completed",
                  "dismissed",
                  "expired"
                ]
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "computer_id",
              "outcome",
              "note"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "LeaseChangedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "lease.changed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "computer_id": {
                "type": "string",
                "format": "uuid"
              },
              "holder_type": {
                "type": "string",
                "enum": [
                  "bot",
                  "user"
                ]
              },
              "mode": {
                "type": "string",
                "enum": [
                  "view",
                  "control"
                ]
              }
            },
            "required": [
              "computer_id",
              "holder_type",
              "mode"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "ComputerStateEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "computer.state"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "computer_id": {
                "type": "string",
                "format": "uuid"
              },
              "state": {
                "type": "string",
                "enum": [
                  "provisioning",
                  "starting",
                  "running",
                  "idle",
                  "sleeping",
                  "stopped",
                  "error"
                ]
              }
            },
            "required": [
              "computer_id",
              "state"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "CheckpointCreatedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "checkpoint.created"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "checkpoint_id": {
                "type": "string",
                "format": "uuid"
              },
              "label": {
                "type": "string"
              }
            },
            "required": [
              "checkpoint_id",
              "label"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "SubrunStartedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "subrun.started"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "child_run_id": {
                "type": "string",
                "format": "uuid"
              },
              "bot_id": {
                "type": "string",
                "format": "uuid"
              },
              "task": {
                "type": "string"
              }
            },
            "required": [
              "child_run_id",
              "bot_id",
              "task"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "SubrunCompletedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "subrun.completed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "child_run_id": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string",
                "enum": [
                  "completed",
                  "failed",
                  "cancelled"
                ]
              },
              "summary": {
                "type": "string"
              }
            },
            "required": [
              "child_run_id",
              "status",
              "summary"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "MemoryWrittenEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "memory.written"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "memory_id": {
                "type": "string",
                "minLength": 1
              },
              "kind": {
                "type": "string",
                "enum": [
                  "fact",
                  "episode",
                  "summary",
                  "preference"
                ]
              },
              "scope": {
                "type": "string",
                "enum": [
                  "bot",
                  "profile"
                ]
              }
            },
            "required": [
              "memory_id",
              "kind"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "SkillLoadedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "skill.loaded"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "skill_id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "skill_id",
              "name"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "UsageEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "usage"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "tokens_in": {
                "type": "integer",
                "minimum": 0
              },
              "tokens_out": {
                "type": "integer",
                "minimum": 0
              },
              "cost_usd": {
                "type": "number",
                "minimum": 0
              }
            },
            "required": [
              "tokens_in",
              "tokens_out",
              "cost_usd"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "ModelFallbackEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "model.fallback"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "from_model": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "from_model",
              "reason",
              "message"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "NoticeEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "notice"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "RunCompletedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "run.completed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "final_message_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            },
            "required": [
              "final_message_id"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "RunFailedEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "run.failed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "error_code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "error_code",
              "message"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "RunCancelledEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "run.cancelled"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "cancelled_by": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            },
            "required": [
              "cancelled_by"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "UiShownEvent": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "ui.shown"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "surface_id": {
                "type": "string"
              },
              "messages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "surface_id",
              "messages"
            ]
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "RunEventEnvelope": {
        "type": "object",
        "properties": {
          "v": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol version, currently 1"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "payload": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "v",
          "run_id",
          "seq",
          "ts",
          "bot_id",
          "type",
          "payload"
        ]
      },
      "PublicConfig": {
        "type": "object",
        "properties": {
          "product_name": {
            "type": "string"
          },
          "api_version": {
            "type": "string"
          },
          "supabase_url": {
            "type": "string"
          },
          "supabase_anon_key": {
            "type": "string"
          },
          "billing_enabled": {
            "type": "boolean"
          },
          "default_models": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Default model id per provider (for example openrouter, openai)"
          },
          "default_reasoning_effort": {
            "type": "string",
            "enum": [
              "none",
              "low",
              "medium",
              "high",
              "xhigh",
              "max"
            ]
          },
          "wallpapers_enabled": {
            "type": "boolean"
          },
          "chatgpt_sign_in": {
            "type": "boolean"
          },
          "server_voice": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "live",
                "read_aloud",
                "dictation"
              ]
            }
          },
          "signup_proofs": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "app_check",
                "pow"
              ]
            }
          },
          "trace_url_template": {
            "type": [
              "string",
              "null"
            ]
          },
          "google_client_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sign_in_codes": {
            "type": "boolean"
          },
          "signups_open": {
            "type": "boolean"
          },
          "signups_by_invitation": {
            "type": "boolean"
          }
        },
        "required": [
          "product_name",
          "api_version",
          "supabase_url",
          "supabase_anon_key",
          "billing_enabled",
          "default_models",
          "default_reasoning_effort"
        ]
      },
      "SignupChallenge": {
        "type": "object",
        "properties": {
          "challenge": {
            "type": "string"
          },
          "difficulty": {
            "type": "integer",
            "description": "Find a nonce so that sha256(`<challenge>:<nonce>`) starts with this many zero bits"
          },
          "expires_at": {
            "type": "string"
          }
        },
        "required": [
          "challenge",
          "difficulty",
          "expires_at"
        ]
      },
      "Health": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "degraded"
            ]
          },
          "checks": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        },
        "required": [
          "status"
        ]
      },
      "SupportTicket": {
        "type": "object",
        "properties": {
          "reference": {
            "type": "string"
          },
          "reply_to": {
            "type": "string"
          }
        },
        "required": [
          "reference",
          "reply_to"
        ]
      },
      "Problem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "example": "https://casama.ai/problems/not_found"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "description": "Stable error code",
            "example": "not_found"
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "path",
                "message"
              ]
            },
            "description": "Field errors for validation_failed"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code"
        ]
      },
      "SupportTicketRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "topic": {
            "$ref": "#/components/schemas/SupportTopic"
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          },
          "transcript": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupportMessage"
            },
            "maxItems": 60
          },
          "app_version": {
            "type": "string",
            "maxLength": 40
          },
          "platform": {
            "type": "string",
            "maxLength": 40
          }
        },
        "required": [
          "topic",
          "message"
        ]
      },
      "SupportTopic": {
        "type": "string",
        "enum": [
          "billing",
          "broken",
          "account",
          "question",
          "other"
        ]
      },
      "SupportMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "user",
              "assistant"
            ]
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          }
        },
        "required": [
          "role",
          "content"
        ]
      },
      "SupportConfig": {
        "type": "object",
        "properties": {
          "assistant": {
            "type": "boolean"
          },
          "tickets": {
            "type": "boolean"
          },
          "email": {
            "type": "string"
          },
          "docs_url": {
            "type": "string"
          }
        },
        "required": [
          "assistant",
          "tickets",
          "email",
          "docs_url"
        ]
      },
      "SupportTicketList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupportTicketRow"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "SupportTicketRow": {
        "type": "object",
        "properties": {
          "reference": {
            "type": "string"
          },
          "topic": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "closed"
            ]
          },
          "user_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "org_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "org_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "closed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "reference",
          "topic",
          "subject",
          "status",
          "user_email",
          "org_id",
          "org_name",
          "created_at",
          "closed_at"
        ]
      },
      "SetSupportTicketStatus": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "open",
              "closed"
            ]
          }
        },
        "required": [
          "status"
        ]
      },
      "SupportChatReply": {
        "type": "object",
        "properties": {
          "reply": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupportSource"
            }
          },
          "handoff": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "topic": {
                "$ref": "#/components/schemas/SupportTopic"
              },
              "summary": {
                "type": "string"
              }
            },
            "required": [
              "topic",
              "summary"
            ]
          }
        },
        "required": [
          "reply",
          "sources",
          "handoff"
        ]
      },
      "SupportSource": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "title",
          "url"
        ]
      },
      "SupportChatRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupportMessage"
            },
            "minItems": 1,
            "maxItems": 40
          },
          "app_version": {
            "type": "string",
            "maxLength": 40
          },
          "platform": {
            "type": "string",
            "maxLength": 40
          }
        },
        "required": [
          "messages"
        ]
      },
      "BlockedPerson": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "blocked_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "user_id",
          "name",
          "blocked_at"
        ]
      },
      "BlockRequest": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "user_id"
        ]
      },
      "ReportReceipt": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "id"
        ]
      },
      "CreateReportRequest": {
        "type": "object",
        "properties": {
          "target_kind": {
            "$ref": "#/components/schemas/ReportTarget"
          },
          "target_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "reason": {
            "$ref": "#/components/schemas/ReportReason"
          },
          "note": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "required": [
          "target_kind",
          "target_id",
          "reason"
        ]
      },
      "ReportTarget": {
        "type": "string",
        "enum": [
          "gallery_item",
          "gallery_request",
          "bot",
          "message",
          "user",
          "workspace"
        ]
      },
      "ReportReason": {
        "type": "string",
        "enum": [
          "spam",
          "sexual",
          "violence",
          "harassment",
          "illegal",
          "impersonation",
          "other"
        ]
      },
      "EmailPreferences": {
        "type": "object",
        "properties": {
          "tips": {
            "type": "boolean"
          },
          "gallery_digest": {
            "type": "boolean",
            "description": "Monthly gallery picks by email (opt-in, D-315)"
          }
        },
        "required": [
          "tips"
        ]
      },
      "BlockedPersonList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BlockedPerson"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ContentReportList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContentReport"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ContentReport": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "target_kind": {
            "$ref": "#/components/schemas/ReportTargetKind"
          },
          "target_id": {
            "type": "string"
          },
          "target_org_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "target_org_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "$ref": "#/components/schemas/ReportReason"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "snapshot": {
            "type": [
              "string",
              "null"
            ]
          },
          "reporter_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "same_target": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "actioned",
              "dismissed"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "target_kind",
          "target_id",
          "target_org_id",
          "target_org_name",
          "reason",
          "note",
          "snapshot",
          "reporter_email",
          "same_target",
          "status",
          "created_at"
        ]
      },
      "ReportTargetKind": {
        "type": "string",
        "enum": [
          "gallery_item",
          "bot",
          "message",
          "user",
          "workspace"
        ]
      },
      "ReviewReportRequest": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "actioned",
              "dismissed"
            ]
          },
          "suspend_workspace": {
            "type": "boolean"
          }
        },
        "required": [
          "decision"
        ]
      },
      "Membership": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "role": {
            "$ref": "#/components/schemas/OrgRole"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "user_id",
          "role",
          "created_at"
        ]
      },
      "OrgRole": {
        "type": "string",
        "enum": [
          "owner",
          "admin",
          "member"
        ]
      },
      "OrganizationWithRole": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Organization"
          },
          {
            "type": "object",
            "properties": {
              "role": {
                "$ref": "#/components/schemas/OrgRole"
              },
              "require_mfa": {
                "type": "boolean",
                "description": "Owners and admins need two-step sign-in (an aal2 session) to use their powers"
              },
              "suspended": {
                "type": "boolean",
                "description": "Suspended by the instance owner: bots don't run and computers don't start"
              }
            },
            "required": [
              "role"
            ]
          }
        ]
      },
      "Organization": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "plan": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "icon": {
            "type": [
              "string",
              "null"
            ]
          },
          "color": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "plan",
          "region",
          "created_at"
        ]
      },
      "Invite": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/OrgRole"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "email_sent": {
            "type": "boolean"
          },
          "accept_token": {
            "type": "string",
            "description": "Returned only when no email provider is configured, so the inviter can share it directly"
          }
        },
        "required": [
          "id",
          "org_id",
          "email",
          "role",
          "expires_at",
          "email_sent"
        ]
      },
      "CreateInviteRequest": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "$ref": "#/components/schemas/InviteRole"
          }
        },
        "required": [
          "email"
        ]
      },
      "InviteRole": {
        "type": "string",
        "enum": [
          "admin",
          "member"
        ],
        "description": "Defaults to member"
      },
      "CreatedInviteLink": {
        "allOf": [
          {
            "$ref": "#/components/schemas/InviteLink"
          },
          {
            "type": "object",
            "properties": {
              "token": {
                "type": "string",
                "description": "Shown once"
              },
              "url": {
                "type": "string",
                "description": "The link to share (the app's /join/<token>)"
              }
            },
            "required": [
              "token",
              "url"
            ]
          }
        ]
      },
      "InviteLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member"
            ]
          },
          "token_hint": {
            "type": "string"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "max_uses": {
            "type": [
              "integer",
              "null"
            ]
          },
          "uses": {
            "type": "integer"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "enum": [
              "link",
              "code"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "is_default": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "org_id",
          "role",
          "token_hint",
          "expires_at",
          "max_uses",
          "uses",
          "revoked_at",
          "created_at"
        ]
      },
      "CreateInviteCodeRequest": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member"
            ]
          }
        }
      },
      "CreateInviteLinkRequest": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member"
            ]
          },
          "expires_in_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          },
          "max_uses": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "requires_approval": {
            "type": "boolean"
          }
        }
      },
      "InviteList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Invite"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "CreateInvitesRequest": {
        "type": "object",
        "properties": {
          "emails": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email"
            },
            "minItems": 1,
            "maxItems": 50
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member"
            ]
          }
        },
        "required": [
          "emails"
        ]
      },
      "CreateOrganizationRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,46}[a-z0-9])?$",
            "description": "Generated from the name when omitted"
          }
        },
        "required": [
          "name"
        ]
      },
      "JoinRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "declined"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "user_id",
          "email",
          "display_name",
          "role",
          "status",
          "created_at"
        ]
      },
      "DecideJoinRequest": {
        "type": "object",
        "properties": {
          "approve": {
            "type": "boolean"
          }
        },
        "required": [
          "approve"
        ]
      },
      "JoinDomains": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "my_domain": {
            "type": [
              "string",
              "null"
            ]
          },
          "can_use": {
            "type": "boolean"
          }
        },
        "required": [
          "items",
          "my_domain",
          "can_use"
        ]
      },
      "Me": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "locale": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "organizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrganizationWithRole"
            }
          }
        },
        "required": [
          "user_id",
          "email",
          "display_name",
          "locale",
          "timezone",
          "organizations"
        ]
      },
      "JoinResult": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "joined",
              "member",
              "requested"
            ]
          },
          "organization": {
            "$ref": "#/components/schemas/OrganizationWithRole"
          },
          "workspace_name": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "workspace_name"
        ]
      },
      "JoinRequestBody": {
        "type": "object",
        "properties": {
          "invite": {
            "type": "string",
            "minLength": 6,
            "maxLength": 512,
            "description": "An invite link, its token, an email invite token, or a short invite code"
          }
        },
        "required": [
          "invite"
        ]
      },
      "InviteLinkList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InviteLink"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "PendingInviteList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PendingInvite"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "PendingInvite": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "email",
          "role",
          "expires_at",
          "created_at"
        ]
      },
      "JoinRequestList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JoinRequest"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "JoinableWorkspaceList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JoinableWorkspace"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "JoinableWorkspace": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "icon": {
            "type": [
              "string",
              "null"
            ]
          },
          "color": {
            "type": [
              "string",
              "null"
            ]
          },
          "member_count": {
            "type": "integer"
          },
          "domain": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "icon",
          "color",
          "member_count",
          "domain"
        ]
      },
      "OrganizationList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrganizationWithRole"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "InvitePreview": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "link",
              "code",
              "email"
            ]
          },
          "workspace": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "icon": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "color": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "member_count": {
                "type": "integer"
              }
            },
            "required": [
              "name",
              "icon",
              "color",
              "member_count"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member"
            ]
          },
          "inviter_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "email_hint": {
            "type": [
              "string",
              "null"
            ]
          },
          "already_member": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "kind",
          "workspace",
          "role",
          "inviter_name",
          "requires_approval",
          "email_hint",
          "already_member"
        ]
      },
      "SetJoinDomainRequest": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "domain": {
            "type": "string",
            "maxLength": 253
          }
        },
        "required": [
          "enabled"
        ]
      },
      "UpdateDefaultInviteRequest": {
        "type": "object",
        "properties": {
          "requires_approval": {
            "type": "boolean"
          },
          "reset": {
            "type": "boolean"
          }
        }
      },
      "UpdateOrganizationRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "icon": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 40
          },
          "color": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^#[0-9a-fA-F]{6}$"
          }
        }
      },
      "WorkspaceBadgeList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkspaceBadge"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "WorkspaceBadge": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "approvals": {
            "type": "integer"
          },
          "unread": {
            "type": "integer"
          }
        },
        "required": [
          "org_id",
          "approvals",
          "unread"
        ]
      },
      "Run": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "parent_run_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "trigger": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/RunStatus"
          },
          "tokens_in": {
            "type": "integer"
          },
          "tokens_out": {
            "type": "integer"
          },
          "cost_usd": {
            "type": "number"
          },
          "last_seq": {
            "type": "integer"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ended_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "error": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          },
          "trace_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "OpenTelemetry trace of this run"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "conversation_id",
          "parent_run_id",
          "trigger",
          "status",
          "tokens_in",
          "tokens_out",
          "cost_usd",
          "last_seq",
          "started_at",
          "ended_at",
          "error",
          "trace_id",
          "created_at"
        ]
      },
      "RunStatus": {
        "type": "string",
        "enum": [
          "queued",
          "running",
          "waiting_approval",
          "waiting_takeover",
          "completed",
          "failed",
          "cancelled"
        ]
      },
      "Credential": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "provider": {
            "$ref": "#/components/schemas/ProviderId"
          },
          "label": {
            "type": "string"
          },
          "base_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "key_hint": {
            "type": [
              "string",
              "null"
            ],
            "description": "Last 4 characters of the key"
          },
          "last_tested_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_test_ok": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "owner_user_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Set for personal credentials (a ChatGPT plan): only the owner's runs use it"
          },
          "status": {
            "$ref": "#/components/schemas/CredentialStatus"
          },
          "account": {
            "type": [
              "string",
              "null"
            ],
            "description": "The signed-in ChatGPT account's email (chatgpt only)"
          },
          "fallback_on_limit": {
            "type": "boolean",
            "description": "chatgpt: use the bot's next model when the plan limit is reached"
          },
          "embedding_model": {
            "type": [
              "string",
              "null"
            ],
            "description": "openai_compatible: the server's embedding model, used for memory and knowledge search when there's no OpenAI key (D-271)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "provider",
          "label",
          "base_url",
          "key_hint",
          "last_tested_at",
          "last_test_ok",
          "owner_user_id",
          "status",
          "account",
          "fallback_on_limit",
          "embedding_model",
          "created_at"
        ]
      },
      "ProviderId": {
        "type": "string",
        "enum": [
          "openai",
          "anthropic",
          "google",
          "xai",
          "openrouter",
          "openai_compatible",
          "brave_search",
          "tavily",
          "chatgpt",
          "treg",
          "google_maps",
          "mapbox"
        ]
      },
      "CredentialStatus": {
        "type": "string",
        "enum": [
          "ok",
          "plan_usage_off",
          "needs_reconnect"
        ],
        "description": "ok; plan_usage_off: signed in to ChatGPT without granting plan usage; needs_reconnect: sign in again"
      },
      "ChatGptSignInCompleteRequest": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "minLength": 16,
            "maxLength": 200
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          },
          "client_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The issued client id from the callback (first sign-in)"
          },
          "error": {
            "type": "string",
            "maxLength": 200
          },
          "error_description": {
            "type": "string",
            "maxLength": 1000
          }
        },
        "required": [
          "state"
        ]
      },
      "Bot": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "avatar_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "persona_md": {
            "type": "string"
          },
          "model_policy": {
            "$ref": "#/components/schemas/ModelPolicy"
          },
          "autonomy": {
            "$ref": "#/components/schemas/Autonomy"
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "budget": {
            "$ref": "#/components/schemas/BotBudget"
          },
          "status": {
            "type": "string",
            "enum": [
              "idle",
              "working",
              "waiting",
              "disabled"
            ]
          },
          "default_computer_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Its computer; null = its private computer, else the team computer"
          },
          "folder_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Its sidebar folder (bot_folders)"
          },
          "sort_key": {
            "type": "number",
            "description": "Order within its folder"
          },
          "archived_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "setup_status": {
            "type": "string",
            "enum": [
              "pending",
              "done",
              "skipped"
            ],
            "description": "The setup interview"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_message": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "text": {
                "type": "string",
                "description": "Plain text, one line, cut to 160 characters"
              },
              "from": {
                "type": "string",
                "enum": [
                  "you",
                  "bot",
                  "someone"
                ],
                "description": "you = the caller; someone = another person in the workspace"
              },
              "file_name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The first attached file, if any"
              },
              "file_mime": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "conversation_id": {
                "type": "string",
                "format": "uuid"
              },
              "at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "text",
              "from",
              "file_name",
              "file_mime",
              "conversation_id",
              "at"
            ],
            "description": "The latest message in its direct chats you can see (listBots only); null when there is none"
          }
        },
        "required": [
          "id",
          "org_id",
          "name",
          "avatar_url",
          "persona_md",
          "model_policy",
          "autonomy",
          "visibility",
          "budget",
          "status",
          "default_computer_id",
          "folder_id",
          "sort_key",
          "archived_at",
          "setup_status",
          "created_at"
        ]
      },
      "ModelPolicy": {
        "type": "object",
        "properties": {
          "primary": {
            "$ref": "#/components/schemas/ModelChoice"
          },
          "fallbacks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelChoice"
            },
            "maxItems": 5
          },
          "cheap": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ModelChoice"
              },
              {
                "description": "Used for memory extraction, summaries and titles"
              }
            ]
          }
        }
      },
      "ModelChoice": {
        "type": "object",
        "properties": {
          "credential_id": {
            "type": "string",
            "format": "uuid"
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "reasoning_effort": {
            "$ref": "#/components/schemas/ReasoningEffort"
          }
        },
        "required": [
          "credential_id",
          "model"
        ]
      },
      "ReasoningEffort": {
        "type": "string",
        "enum": [
          "none",
          "low",
          "medium",
          "high",
          "xhigh",
          "max"
        ],
        "description": "For reasoning models; the server default applies to the default model when unset"
      },
      "Autonomy": {
        "type": "string",
        "enum": [
          "ask_always",
          "ask_risky",
          "autonomous"
        ]
      },
      "Visibility": {
        "type": "string",
        "enum": [
          "private",
          "team"
        ]
      },
      "BotBudget": {
        "type": "object",
        "properties": {
          "per_run_usd": {
            "type": "number",
            "minimum": 0
          },
          "daily_usd": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "CreateBotRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "persona_md": {
            "type": "string",
            "maxLength": 20000
          },
          "avatar_url": {
            "type": "string",
            "format": "uri"
          },
          "model_policy": {
            "$ref": "#/components/schemas/ModelPolicy"
          },
          "autonomy": {
            "$ref": "#/components/schemas/Autonomy"
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "budget": {
            "$ref": "#/components/schemas/BotBudget"
          },
          "template_id": {
            "type": "string",
            "maxLength": 64,
            "description": "Start from a starter template (persona, skills, routines)"
          }
        },
        "required": [
          "org_id",
          "name"
        ]
      },
      "Conversation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_message_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "enum": [
              "direct",
              "group"
            ]
          },
          "bot_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Group chats: every bot, the lead first"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "can_delete": {
            "type": "boolean",
            "description": "Whether you may delete it: you started it, or you manage its bot"
          },
          "is_main": {
            "type": "boolean",
            "description": "The person's General conversation with this bot (D-253): briefs, routine results and proactive messages land here"
          },
          "parent_conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "A topic's General conversation"
          },
          "anchor_message_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The message in General a topic started from (an accepted suggestion)"
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "needs_you",
              "working",
              null
            ],
            "description": "needs_you: the bot waits for an approval or a take-over in it; working: a run is going"
          },
          "pinned": {
            "type": "boolean",
            "description": "Pinned by the person who started it: listed after General, before the rest"
          },
          "project_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The project this chat belongs to (D-295)"
          }
        },
        "required": [
          "id",
          "bot_id",
          "title",
          "last_message_at",
          "kind",
          "bot_ids",
          "created_at"
        ]
      },
      "CreateConversationRequest": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "format": "uuid",
            "description": "The bot, or a group chat's lead"
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "bot_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 10,
            "description": "A group chat: the other bots (the lead may be listed too); 2 to 10 bots in all"
          }
        },
        "required": [
          "bot_id"
        ]
      },
      "CreateCredentialRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "provider": {
            "$ref": "#/components/schemas/ProviderId"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "api_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000,
            "description": "Stored in Vault; never returned"
          },
          "base_url": {
            "type": "string",
            "format": "uri"
          },
          "embedding_model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "openai_compatible only: an embedding model on that server, for memory search"
          }
        },
        "required": [
          "org_id",
          "provider",
          "label"
        ]
      },
      "DeletedConversations": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "integer",
            "description": "How many conversations were deleted"
          },
          "skipped": {
            "type": "integer",
            "description": "Left alone because the bot is still working in them"
          }
        },
        "required": [
          "deleted",
          "skipped"
        ]
      },
      "DeletedConversation": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "DeletedMemory": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "MemoryBackend": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "postgres",
              "honcho",
              "supermemory"
            ]
          },
          "base_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "workspace": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "provider",
          "base_url",
          "workspace",
          "updated_at"
        ]
      },
      "DeletedMessage": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "SendMessageResponse": {
        "type": "object",
        "properties": {
          "message_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Group chats: every bot's run"
          },
          "joined": {
            "type": "boolean",
            "description": "The bot was already working here: the message joined that run (run_id), which sees it before its next step"
          }
        },
        "required": [
          "message_id",
          "run_id",
          "conversation_id"
        ]
      },
      "EditMessageRequest": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100000
          }
        },
        "required": [
          "text"
        ]
      },
      "BotA2a": {
        "type": "object",
        "properties": {
          "workspace_enabled": {
            "type": "boolean"
          },
          "published": {
            "type": "boolean"
          },
          "agent_card_url": {
            "type": "string"
          }
        },
        "required": [
          "workspace_enabled",
          "published",
          "agent_card_url"
        ]
      },
      "ConversationThread": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "RunUsage": {
        "type": "object",
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/RunStatus"
          },
          "cost_usd": {
            "type": "number",
            "description": "Everything metered, including your own keys"
          },
          "charged_usd": {
            "type": "number",
            "description": "The part taken from Casama credits (1 credit = $1)"
          },
          "tokens_in": {
            "type": "integer"
          },
          "tokens_out": {
            "type": "integer"
          },
          "duration_ms": {
            "type": [
              "integer",
              "null"
            ]
          },
          "tool_calls": {
            "type": "integer"
          },
          "subruns": {
            "type": "integer"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "model": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "key",
                    "chatgpt_plan"
                  ]
                },
                "billable": {
                  "type": "boolean"
                },
                "quantity": {
                  "type": "number"
                },
                "cost_usd": {
                  "type": "number"
                }
              },
              "required": [
                "kind",
                "model",
                "source",
                "billable",
                "quantity",
                "cost_usd"
              ]
            }
          }
        },
        "required": [
          "run_id",
          "status",
          "cost_usd",
          "charged_usd",
          "tokens_in",
          "tokens_out",
          "duration_ms",
          "tool_calls",
          "subruns",
          "items"
        ]
      },
      "UsageReport": {
        "type": "object",
        "properties": {
          "period": {
            "type": "string",
            "enum": [
              "day",
              "week",
              "month",
              "year"
            ]
          },
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "total_cost_usd": {
            "type": "number"
          },
          "by_bot": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "bot_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "cost_usd": {
                  "type": "number"
                },
                "tokens_in": {
                  "type": "integer"
                },
                "tokens_out": {
                  "type": "integer"
                }
              },
              "required": [
                "bot_id",
                "name",
                "cost_usd",
                "tokens_in",
                "tokens_out"
              ]
            }
          },
          "by_day": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": {
                  "type": "string"
                },
                "cost_usd": {
                  "type": "number"
                },
                "tokens_in": {
                  "type": "integer"
                },
                "tokens_out": {
                  "type": "integer"
                }
              },
              "required": [
                "day",
                "cost_usd",
                "tokens_in",
                "tokens_out"
              ]
            }
          },
          "by_model": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "model": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "cost_usd": {
                  "type": "number"
                },
                "tokens_in": {
                  "type": "integer"
                },
                "tokens_out": {
                  "type": "integer"
                }
              },
              "required": [
                "model",
                "cost_usd",
                "tokens_in",
                "tokens_out"
              ]
            }
          },
          "by_kind": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "quantity": {
                  "type": "number"
                },
                "cost_usd": {
                  "type": "number"
                }
              },
              "required": [
                "kind",
                "quantity",
                "cost_usd"
              ]
            }
          },
          "runs": {
            "type": "integer"
          },
          "by_person": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "user_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "cost_usd": {
                  "type": "number"
                },
                "runs": {
                  "type": "integer"
                }
              },
              "required": [
                "user_id",
                "name",
                "cost_usd",
                "runs"
              ]
            }
          },
          "waived_usd": {
            "type": "number"
          }
        },
        "required": [
          "period",
          "since",
          "total_cost_usd",
          "by_bot"
        ]
      },
      "BotList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bot"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ConversationList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Conversation"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ModelOptionList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelOption"
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "live",
              "featured"
            ],
            "description": "live: the provider's own list; featured: Casama's short list (provider unreachable or fixture mode)"
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "items",
          "source"
        ]
      },
      "ModelOption": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "context_length": {
            "type": "integer"
          },
          "featured": {
            "type": "boolean",
            "description": "Recommended by Casama; listed first"
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "CredentialList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Credential"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "GroupChatList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Conversation"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "MemoryList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Memory"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "Memory": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "fact",
              "episode",
              "summary",
              "preference"
            ]
          },
          "content": {
            "type": "string"
          },
          "importance": {
            "type": "number"
          },
          "pinned": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "content",
          "importance",
          "pinned",
          "created_at",
          "updated_at"
        ]
      },
      "RunEventsPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RunEventEnvelope"
            }
          },
          "run_status": {
            "$ref": "#/components/schemas/RunStatus"
          }
        },
        "required": [
          "items",
          "run_status"
        ]
      },
      "SendMessageRequest": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "maxLength": 100000,
            "default": ""
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageAttachment"
            },
            "maxItems": 10
          },
          "ui_action": {
            "$ref": "#/components/schemas/UiActionPart"
          },
          "skills": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9_-]{0,62}$"
            },
            "maxItems": 5,
            "description": "Skills picked with / in the composer; the run loads them up front"
          }
        }
      },
      "MessageAttachment": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "pattern": "^(?!\\/)(?!.*\\.\\.)",
            "description": "Where the file is on the bot's computer, under its home folder (upload it first)"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "mime_type": {
            "type": "string",
            "maxLength": 120
          },
          "size": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "path",
          "name",
          "mime_type",
          "size"
        ]
      },
      "UiActionPart": {
        "type": "object",
        "properties": {
          "surface_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "context": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "surface_id",
          "name"
        ]
      },
      "SetBotA2aRequest": {
        "type": "object",
        "properties": {
          "published": {
            "type": "boolean"
          }
        },
        "required": [
          "published"
        ]
      },
      "SetMemoryBackendRequest": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "honcho",
              "supermemory"
            ]
          },
          "api_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 500
          },
          "base_url": {
            "type": "string",
            "format": "uri"
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "copy_existing": {
            "type": "boolean"
          }
        },
        "required": [
          "provider",
          "api_key"
        ]
      },
      "StartSetupResponse": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "conversation_id",
          "run_id"
        ]
      },
      "ChatGptSignInStart": {
        "type": "object",
        "properties": {
          "authorize_url": {
            "type": "string"
          },
          "redirect_uri": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "authorize_url",
          "redirect_uri",
          "state",
          "expires_at"
        ]
      },
      "ChatGptSignInStartRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "redirect_port": {
            "type": "integer",
            "minimum": 1024,
            "maximum": 65535,
            "description": "The client's loopback port; OpenAI redirects to http://127.0.0.1:<port>/auth/callback"
          },
          "credential_id": {
            "type": "string",
            "format": "uuid",
            "description": "Reconnect this ChatGPT credential"
          }
        },
        "required": [
          "org_id",
          "redirect_port"
        ]
      },
      "WelcomeChat": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "created": {
            "type": "boolean"
          }
        },
        "required": [
          "org_id",
          "bot_id",
          "conversation_id",
          "created"
        ]
      },
      "StartWelcomeRequest": {
        "type": "object",
        "properties": {
          "first_name": {
            "type": "string",
            "maxLength": 80
          },
          "bot_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        }
      },
      "SwitchBranchResponse": {
        "type": "object",
        "properties": {
          "head_message_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "head_message_id"
        ]
      },
      "SwitchBranchRequest": {
        "type": "object",
        "properties": {
          "message_id": {
            "type": "string",
            "format": "uuid",
            "description": "A message on the branch to show"
          }
        },
        "required": [
          "message_id"
        ]
      },
      "CredentialTestResult": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "model": {
            "type": "string"
          },
          "latency_ms": {
            "type": "integer"
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "model",
          "latency_ms"
        ]
      },
      "TestCredentialRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        }
      },
      "UpdateConversationRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "A new name; empty or null goes back to the automatic one"
          },
          "pinned": {
            "type": "boolean"
          }
        }
      },
      "UpdateCredentialRequest": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "fallback_on_limit": {
            "type": "boolean"
          },
          "embedding_model": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "openai_compatible only; null or empty turns it off"
          }
        }
      },
      "UpdateMemoryRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          },
          "pinned": {
            "type": "boolean"
          }
        }
      },
      "CleanStorageResult": {
        "type": "object",
        "properties": {
          "freed_bytes": {
            "type": "integer"
          },
          "storage": {
            "$ref": "#/components/schemas/ComputerStorage"
          }
        },
        "required": [
          "freed_bytes",
          "storage"
        ]
      },
      "ComputerStorage": {
        "type": "object",
        "properties": {
          "used_bytes": {
            "type": "integer"
          },
          "limit_bytes": {
            "type": "integer"
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StorageCategory"
            }
          },
          "cleanable_bytes": {
            "type": "integer",
            "description": "Caches and temporary files that Free up space removes"
          }
        },
        "required": [
          "used_bytes",
          "limit_bytes",
          "categories",
          "cleanable_bytes"
        ]
      },
      "StorageCategory": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "files",
              "apps",
              "caches",
              "browser",
              "other"
            ]
          },
          "bytes": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "bytes"
        ]
      },
      "ComputerBotList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComputerBotUse"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ComputerBotUse": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "last_active_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "bot_id",
          "name",
          "last_active_at"
        ]
      },
      "ComputerHistory": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComputerHistoryEntry"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ComputerHistoryEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "string",
            "description": "computer.started, computer.slept, computer.restarted, computer.reset, computer.erased, checkpoint.created, checkpoint.restored, computer.storage_cleaned, computer.process_stopped, computer.updated"
          },
          "actor_type": {
            "type": "string",
            "enum": [
              "user",
              "bot",
              "system"
            ]
          },
          "actor_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "actor_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {}
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "action",
          "actor_type",
          "actor_id",
          "actor_name",
          "metadata",
          "created_at"
        ]
      },
      "ComputerUsage": {
        "type": "object",
        "properties": {
          "month_start": {
            "type": "string"
          },
          "seconds": {
            "type": "integer"
          },
          "cost_usd": {
            "type": "number"
          },
          "days": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComputerUsageDay"
            }
          }
        },
        "required": [
          "month_start",
          "seconds",
          "cost_usd",
          "days"
        ]
      },
      "ComputerUsageDay": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "example": "2026-11-12"
          },
          "seconds": {
            "type": "integer"
          }
        },
        "required": [
          "date",
          "seconds"
        ]
      },
      "ComputerVitals": {
        "type": "object",
        "properties": {
          "cpu_percent": {
            "type": "number",
            "description": "Of the CPUs it has, 0-100"
          },
          "memory_used_bytes": {
            "type": "integer"
          },
          "memory_limit_bytes": {
            "type": "integer"
          },
          "disk_used_bytes": {
            "type": "integer"
          },
          "disk_limit_bytes": {
            "type": "integer"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "cpu_percent",
          "memory_used_bytes",
          "memory_limit_bytes",
          "disk_used_bytes",
          "disk_limit_bytes",
          "at"
        ]
      },
      "Checkpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "computer_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "label": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "computer_id",
          "run_id",
          "label",
          "size",
          "created_at"
        ]
      },
      "CreateCheckpointRequest": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "label"
        ]
      },
      "Computer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "private",
              "team",
              "local"
            ]
          },
          "name": {
            "type": "string"
          },
          "owner_bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "provider": {
            "type": "string"
          },
          "profile": {
            "type": "string",
            "enum": [
              "headless",
              "desktop"
            ]
          },
          "state": {
            "$ref": "#/components/schemas/ComputerState"
          },
          "size": {
            "type": "object",
            "properties": {
              "cpus": {
                "type": "number"
              },
              "memory_mb": {
                "type": "number"
              },
              "disk_gb": {
                "type": "number"
              }
            }
          },
          "has_snapshot": {
            "type": "boolean"
          },
          "max_desktops": {
            "type": "integer",
            "description": "Team computers: bots that may use the desktop at the same time"
          },
          "last_active_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "os": {
            "type": [
              "string",
              "null"
            ],
            "description": "The operating system to show, e.g. \"Ubuntu 24.04\" or \"macOS 26.2\"; null when unknown (D-227)"
          },
          "device": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "platform": {
                "type": "string",
                "enum": [
                  "macos",
                  "windows",
                  "linux"
                ]
              },
              "online": {
                "type": "boolean"
              },
              "last_seen_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "capabilities": {
                "$ref": "#/components/schemas/LocalCapabilities"
              }
            },
            "required": [
              "platform",
              "online",
              "last_seen_at",
              "capabilities"
            ],
            "description": "Personal computers only: the paired device"
          },
          "idle_sleep_minutes": {
            "type": "integer",
            "description": "Minutes without activity before it sleeps (D-240); 5 unless changed"
          },
          "operation": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "reset_system",
                  "erase"
                ]
              },
              "step": {
                "type": "string",
                "enum": [
                  "saving",
                  "wiping",
                  "restarting",
                  "done",
                  "failed"
                ]
              },
              "checkpoint_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid",
                "description": "The restore point saved first: restoring it undoes the reset"
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "started_at": {
                "type": "string",
                "format": "date-time"
              },
              "finished_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            },
            "required": [
              "kind",
              "step",
              "checkpoint_id",
              "error",
              "started_at",
              "finished_at"
            ],
            "description": "The last reset: in progress, done (with its undo point) or failed (D-240)"
          }
        },
        "required": [
          "id",
          "org_id",
          "kind",
          "name",
          "owner_bot_id",
          "provider",
          "profile",
          "state",
          "size",
          "has_snapshot",
          "max_desktops",
          "last_active_at",
          "error",
          "created_at"
        ]
      },
      "ComputerState": {
        "type": "string",
        "enum": [
          "provisioning",
          "starting",
          "running",
          "idle",
          "sleeping",
          "stopped",
          "error"
        ]
      },
      "LocalCapabilities": {
        "type": "object",
        "properties": {
          "shell": {
            "type": "boolean"
          },
          "files": {
            "type": "boolean"
          },
          "browser": {
            "type": "boolean"
          },
          "desktop": {
            "type": "boolean"
          },
          "mcp": {
            "type": "boolean"
          },
          "messages": {
            "type": "boolean"
          }
        }
      },
      "CreateComputerRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "kind": {
            "type": "string",
            "enum": [
              "team",
              "private"
            ]
          },
          "owner_bot_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required for private computers"
          },
          "profile": {
            "type": "string",
            "enum": [
              "headless",
              "desktop"
            ]
          },
          "provider": {
            "type": "string",
            "enum": [
              "docker",
              "e2b",
              "daytona",
              "casama-cloud",
              "novita",
              "kubernetes",
              "incus",
              "boat",
              "railway"
            ],
            "description": "Hosted providers must be configured on the supervisor"
          }
        },
        "required": [
          "org_id",
          "name",
          "kind"
        ]
      },
      "StreamSession": {
        "type": "object",
        "properties": {
          "signaling_url": {
            "type": "string",
            "description": "WebSocket URL (Neko signaling protocol, proxied by the API); includes the token"
          },
          "token": {
            "type": "string",
            "description": "Bound to you, this computer and the mode; 5 minutes"
          },
          "mode": {
            "$ref": "#/components/schemas/StreamMode"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "ice_servers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IceServer"
            }
          },
          "ice_transport_policy": {
            "type": "string",
            "enum": [
              "all",
              "relay"
            ]
          },
          "screenshot_url": {
            "type": "string",
            "description": "Fallback: poll about once a second"
          }
        },
        "required": [
          "signaling_url",
          "token",
          "mode",
          "expires_at",
          "ice_servers",
          "ice_transport_policy",
          "screenshot_url"
        ]
      },
      "StreamMode": {
        "type": "string",
        "enum": [
          "view",
          "control"
        ]
      },
      "IceServer": {
        "type": "object",
        "properties": {
          "urls": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "username": {
            "type": "string"
          },
          "credential": {
            "type": "string"
          }
        },
        "required": [
          "urls"
        ]
      },
      "StreamSessionRequest": {
        "type": "object",
        "properties": {
          "mode": {
            "$ref": "#/components/schemas/StreamMode"
          }
        }
      },
      "DeletedComputer": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "DeleteResult": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "TakeoverRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "computer_id": {
            "type": "string",
            "format": "uuid"
          },
          "reason": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "taken",
              "completed",
              "dismissed",
              "expired"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "run_id",
          "computer_id",
          "reason",
          "status",
          "note",
          "expires_at",
          "created_at"
        ]
      },
      "ReleaseLeaseRequest": {
        "type": "object",
        "properties": {
          "note": {
            "type": "string",
            "maxLength": 2000,
            "description": "Told to the bot on hand-back"
          }
        }
      },
      "Lease": {
        "type": "object",
        "properties": {
          "computer_id": {
            "type": "string",
            "format": "uuid"
          },
          "holder_type": {
            "type": "string",
            "enum": [
              "bot",
              "user"
            ]
          },
          "holder_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "view",
              "control"
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "you": {
            "type": "boolean",
            "description": "Whether you hold it"
          }
        },
        "required": [
          "computer_id",
          "holder_type",
          "holder_id",
          "mode",
          "expires_at",
          "you"
        ]
      },
      "CheckpointList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Checkpoint"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ComputerFileList": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComputerFileEntry"
            }
          }
        },
        "required": [
          "path",
          "entries"
        ]
      },
      "ComputerFileEntry": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "file",
              "dir",
              "link"
            ]
          },
          "size": {
            "type": "integer"
          },
          "modified": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "path",
          "type",
          "size",
          "modified"
        ]
      },
      "ComputerProcessList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComputerProcess"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ComputerProcess": {
        "type": "object",
        "properties": {
          "pid": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "command": {
            "type": "string"
          },
          "cpu_percent": {
            "type": "number"
          },
          "memory_bytes": {
            "type": "integer"
          },
          "elapsed_seconds": {
            "type": "integer"
          },
          "system": {
            "type": "boolean",
            "description": "Part of the computer itself; can't be stopped"
          }
        },
        "required": [
          "pid",
          "name",
          "command",
          "cpu_percent",
          "memory_bytes",
          "elapsed_seconds",
          "system"
        ]
      },
      "ComputerList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Computer"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "TakeoverRequestList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TakeoverRequest"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ResetComputerRequest": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "system",
              "erase"
            ],
            "description": "system: a fresh system, ~/workspace kept. erase: everything removed, like a new computer."
          },
          "checkpoint": {
            "type": "boolean",
            "description": "Save a restore point first (default true)"
          }
        },
        "required": [
          "mode"
        ]
      },
      "StoppedProcess": {
        "type": "object",
        "properties": {
          "stopped": {
            "type": "integer"
          }
        },
        "required": [
          "stopped"
        ]
      },
      "TakeLeaseRequest": {
        "type": "object",
        "properties": {
          "allow_shell": {
            "type": "boolean",
            "description": "Let the bot keep using shell and file tools while you have control"
          }
        }
      },
      "UpdateComputerRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "profile": {
            "type": "string",
            "enum": [
              "headless",
              "desktop"
            ],
            "description": "Takes effect on the next start (a running computer restarts)"
          },
          "max_desktops": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "description": "Team computers only"
          },
          "idle_sleep_minutes": {
            "type": "integer",
            "minimum": 5,
            "maximum": 60,
            "description": "Minutes without activity before it sleeps: 5, 15, 30 or 60"
          }
        }
      },
      "UploadResult": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          }
        },
        "required": [
          "path",
          "size"
        ]
      },
      "Creation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "bot_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "made_for": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "run_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "project_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The project it's filed under (D-295), when you can see that project"
          },
          "project_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "$ref": "#/components/schemas/CreationKind"
          },
          "label": {
            "type": [
              "string",
              "null"
            ],
            "description": "The bot's word for it: Site, Game, Report…"
          },
          "title": {
            "type": "string"
          },
          "page_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "media_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "mime": {
            "type": [
              "string",
              "null"
            ]
          },
          "size": {
            "type": "integer"
          },
          "width": {
            "type": [
              "integer",
              "null"
            ]
          },
          "height": {
            "type": [
              "integer",
              "null"
            ]
          },
          "duration_s": {
            "type": [
              "number",
              "null"
            ]
          },
          "has_cover": {
            "type": "boolean",
            "description": "GET /v1/creations/{id}/cover returns a picture; otherwise the app draws one"
          },
          "has_preview": {
            "type": "boolean",
            "description": "GET /v1/creations/{id}/preview returns a PDF of it (documents; D-280)"
          },
          "version": {
            "type": "integer"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "private",
              "workspace",
              "public"
            ],
            "description": "Who can open it (D-281); a page's follows the page"
          },
          "pinned": {
            "type": "boolean",
            "description": "Pinned by the person asking"
          },
          "last_opened_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "can_change": {
            "type": "boolean"
          },
          "public_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The public link, only in the answer that made it public (D-281)"
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "bot_id",
          "bot_name",
          "made_for",
          "conversation_id",
          "run_id",
          "kind",
          "label",
          "title",
          "page_id",
          "media_id",
          "mime",
          "size",
          "width",
          "height",
          "duration_s",
          "has_cover",
          "has_preview",
          "version",
          "visibility",
          "pinned",
          "last_opened_at",
          "can_change",
          "deleted_at",
          "created_at",
          "updated_at"
        ]
      },
      "CreationKind": {
        "type": "string",
        "enum": [
          "page",
          "image",
          "video",
          "audio",
          "document",
          "file"
        ]
      },
      "CreationDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Creation"
          },
          {
            "type": "object",
            "properties": {
              "siblings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Creation"
                },
                "description": "Other things the same run made, newest first"
              }
            },
            "required": [
              "siblings"
            ]
          }
        ]
      },
      "CreationList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Creation"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass back as cursor for more"
          },
          "kinds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreationKind"
            },
            "description": "The kinds this workspace has, for filter chips"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "kinds"
        ]
      },
      "UpdateCreationRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "label": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 24
          },
          "pinned": {
            "type": "boolean"
          },
          "opened": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Marks it opened now (Recently opened)"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "private",
              "workspace",
              "public"
            ],
            "description": "Making it public returns public_url once; public again gives a new link"
          },
          "expires_in_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          },
          "project_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "File it under a project, or null to take it out of one"
          }
        }
      },
      "ShareConversationResponse": {
        "type": "object",
        "properties": {
          "url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "url"
        ]
      },
      "ShareConversationRequest": {
        "type": "object",
        "properties": {
          "public": {
            "type": "boolean"
          }
        },
        "required": [
          "public"
        ]
      },
      "Ok": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ]
      },
      "AttachIntegrationRequest": {
        "type": "object",
        "properties": {
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "tool_allowlist": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "integration_id"
        ]
      },
      "Integration": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "$ref": "#/components/schemas/IntegrationKind"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "ok",
              "error"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "risk": {
                  "$ref": "#/components/schemas/Risk"
                }
              },
              "required": [
                "name",
                "description"
              ]
            }
          },
          "tools_cached_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "app_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "auth": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "oauth",
              "api_key",
              "none",
              null
            ]
          },
          "bot_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "risk_overrides": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/Risk"
            }
          },
          "device": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "computer_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "owner_user_id": {
                "type": "string",
                "format": "uuid"
              },
              "label": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "computer_id",
              "owner_user_id",
              "label"
            ]
          }
        },
        "required": [
          "id",
          "org_id",
          "kind",
          "name",
          "status",
          "error",
          "tools",
          "tools_cached_at",
          "created_at"
        ]
      },
      "IntegrationKind": {
        "type": "string",
        "enum": [
          "mcp",
          "openapi",
          "composio",
          "pipedream",
          "local_mcp",
          "a2a"
        ]
      },
      "Risk": {
        "type": "string",
        "enum": [
          "low",
          "medium",
          "high"
        ]
      },
      "CreateIntegrationRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "$ref": "#/components/schemas/IntegrationKind"
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,39}$"
          },
          "config": {
            "type": "object",
            "additionalProperties": {},
            "description": "mcp: {url, auth_header?}; a2a: {url} (the agent's address or agent card; secret: its bearer token); openapi: {spec, base_url?, auth?: {type, header?, secret}}; composio: {toolkits[], user_id?}; pipedream: {project_id, client_id, apps[], environment?}"
          },
          "secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000,
            "description": "API key or client secret; stored in Vault"
          }
        },
        "required": [
          "org_id",
          "kind",
          "name",
          "config"
        ]
      },
      "CreatedRoutine": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Routine"
          },
          {
            "type": "object",
            "properties": {
              "webhook_url": {
                "type": "string"
              },
              "webhook_secret": {
                "type": "string",
                "description": "Shown once; sign requests with HMAC-SHA256"
              }
            }
          }
        ]
      },
      "RoutineTrigger": {
        "type": "string",
        "enum": [
          "schedule",
          "once",
          "github",
          "webhook",
          "calendar_event",
          "message",
          "device"
        ],
        "description": "schedule repeats on a cron; once runs a single time at run_at"
      },
      "CalendarTriggerConfig": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "integration_id": {
            "type": "string",
            "format": "uuid",
            "description": "A connected Google or Outlook calendar"
          },
          "offset_minutes": {
            "type": "integer",
            "minimum": -1440,
            "maximum": 1440,
            "description": "Relative to the event's start (or end, with anchor end); -15 is 15 minutes before"
          },
          "anchor": {
            "type": "string",
            "enum": [
              "start",
              "end"
            ],
            "description": "What the offset counts from; end is for after a meeting (D-287)"
          },
          "calendar": {
            "type": "string",
            "maxLength": 200
          },
          "outside_guests": {
            "type": "boolean"
          },
          "title_match": {
            "type": "string",
            "maxLength": 200
          },
          "has_video_link": {
            "type": "boolean"
          }
        },
        "required": [
          "integration_id",
          "offset_minutes"
        ]
      },
      "MessageTriggerConfig": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "channel_id": {
            "type": "string",
            "format": "uuid"
          },
          "channel_kind": {
            "type": "string",
            "enum": [
              "telegram",
              "email",
              "sms",
              "slack",
              "whatsapp",
              "messenger",
              "feishu",
              "imessage",
              "teams",
              "discord",
              "linear",
              "jira"
            ]
          },
          "sender": {
            "type": "string",
            "maxLength": 300,
            "description": "An address or id; *@domain for email"
          },
          "subject_match": {
            "type": "string",
            "maxLength": 200
          },
          "text_match": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "DeviceTriggerConfig": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "event": {
            "type": "string",
            "enum": [
              "wake",
              "arrive",
              "leave",
              "leave_now",
              "workout_ended",
              "notification",
              "focus_on",
              "focus_off",
              "file_added"
            ]
          },
          "place": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "arrive and leave: a named place (Home, Work, Gym)"
          },
          "app": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "notification: the watched app (its name or package id)"
          },
          "minutes_before": {
            "type": "integer",
            "minimum": 0,
            "maximum": 120,
            "description": "leave_now: extra minutes on top of the travel time (default 5)"
          },
          "folder": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "file_added: a folder the desktop app watches (Downloads)"
          },
          "pattern": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "file_added: a file name pattern like *.pdf"
          }
        },
        "required": [
          "event"
        ]
      },
      "Routine": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "instructions_md": {
            "type": "string"
          },
          "schedule_cron": {
            "type": [
              "string",
              "null"
            ]
          },
          "timezone": {
            "type": "string"
          },
          "trigger": {
            "$ref": "#/components/schemas/RoutineTrigger"
          },
          "calendar": {
            "$ref": "#/components/schemas/CalendarTriggerConfig"
          },
          "message": {
            "$ref": "#/components/schemas/MessageTriggerConfig"
          },
          "device": {
            "$ref": "#/components/schemas/DeviceTriggerConfig"
          },
          "notify": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "next_run_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_run_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it switches itself off for good (D-262)"
          },
          "max_runs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "How many runs before it switches itself off (D-262)"
          },
          "run_count": {
            "type": "integer",
            "description": "Runs that count toward max_runs (manual runs don't)"
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "name",
          "instructions_md",
          "schedule_cron",
          "timezone",
          "trigger",
          "notify",
          "enabled",
          "next_run_at",
          "last_run_at",
          "conversation_id",
          "created_at"
        ]
      },
      "CreateRoutineRequest": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "instructions": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "trigger": {
            "$ref": "#/components/schemas/RoutineTrigger"
          },
          "schedule_cron": {
            "type": "string",
            "maxLength": 100,
            "description": "5-field cron, required for schedule triggers"
          },
          "run_at": {
            "type": "string",
            "format": "date-time",
            "description": "When a once routine runs (it switches itself off afterwards)"
          },
          "timezone": {
            "type": "string",
            "maxLength": 64,
            "description": "IANA timezone; defaults to your profile's"
          },
          "notify": {
            "type": "boolean"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "maxItems": 20,
            "description": "GitHub event names to accept"
          },
          "calendar": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CalendarTriggerConfig"
              },
              {
                "description": "Required for calendar_event triggers"
              }
            ]
          },
          "message": {
            "allOf": [
              {
                "$ref": "#/components/schemas/MessageTriggerConfig"
              },
              {
                "description": "Filters for message triggers: an email or chat message that matches starts the routine"
              }
            ]
          },
          "device": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DeviceTriggerConfig"
              },
              {
                "description": "Required for device triggers: the event on your own phone or computer"
              }
            ]
          },
          "ends_at": {
            "type": "string",
            "format": "date-time",
            "description": "Repeating and event routines: switch off for good at this time"
          },
          "max_runs": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000,
            "description": "Repeating and event routines: switch off for good after this many runs"
          },
          "gallery_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "The gallery routine idea this came from, so the workspace sees its updates (D-315)"
          }
        },
        "required": [
          "bot_id",
          "name",
          "instructions"
        ]
      },
      "Secret": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "allowed_hosts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowed_bot_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "kind": {
            "$ref": "#/components/schemas/SecretKind"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "name",
          "allowed_hosts",
          "allowed_bot_ids",
          "kind",
          "created_at"
        ]
      },
      "SecretKind": {
        "type": "string",
        "enum": [
          "value",
          "totp"
        ],
        "description": "value: the secret itself; totp: a two-step seed bots use as {{totp:NAME}}"
      },
      "CreateSecretRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]{0,63}$",
            "description": "Referenced as {{secret:NAME}}"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000,
            "description": "Stored in Vault; never returned"
          },
          "allowed_hosts": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 253
            },
            "minItems": 1,
            "maxItems": 50
          },
          "allowed_bot_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "kind": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SecretKind"
              },
              {
                "description": "totp: value is an otpauth://totp link or a base32 key"
              }
            ]
          }
        },
        "required": [
          "org_id",
          "name",
          "value",
          "allowed_hosts"
        ]
      },
      "Task": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "details_md": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/TaskStatus"
          },
          "priority": {
            "$ref": "#/components/schemas/TaskPriority"
          },
          "assignee_bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "assignee_user_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_by_bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_by_user_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "result_md": {
            "type": [
              "string",
              "null"
            ]
          },
          "due_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "labels": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "position": {
            "type": "number"
          },
          "review_required": {
            "type": "boolean"
          },
          "project_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Its project"
          },
          "milestone_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "parent_task_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "comments": {
            "type": "integer",
            "description": "How many comments the ticket has"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "title",
          "details_md",
          "status",
          "priority",
          "assignee_bot_id",
          "assignee_user_id",
          "created_by_bot_id",
          "created_by_user_id",
          "result_md",
          "due_at",
          "labels",
          "position",
          "review_required",
          "project_id",
          "milestone_id",
          "parent_task_id",
          "conversation_id",
          "comments",
          "updated_at",
          "created_at"
        ]
      },
      "TaskStatus": {
        "type": "string",
        "enum": [
          "todo",
          "in_progress",
          "in_review",
          "blocked",
          "done"
        ]
      },
      "TaskPriority": {
        "type": "string",
        "enum": [
          "urgent",
          "high",
          "medium",
          "low",
          "none"
        ]
      },
      "CreateTaskRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "details_md": {
            "type": "string",
            "maxLength": 10000
          },
          "status": {
            "$ref": "#/components/schemas/TaskStatus"
          },
          "priority": {
            "$ref": "#/components/schemas/TaskPriority"
          },
          "assignee_bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The bot starts on it at once"
          },
          "assignee_user_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "due_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "labels": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            },
            "maxItems": 10
          },
          "review_required": {
            "type": "boolean"
          }
        },
        "required": [
          "org_id",
          "title"
        ]
      },
      "TaskComment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "task_id": {
            "type": "string",
            "format": "uuid"
          },
          "author_type": {
            "type": "string",
            "enum": [
              "user",
              "bot"
            ]
          },
          "author_user_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "author_bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "body_md": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "task_id",
          "author_type",
          "author_user_id",
          "author_bot_id",
          "body_md",
          "created_at"
        ]
      },
      "CreateTaskCommentRequest": {
        "type": "object",
        "properties": {
          "body_md": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          }
        },
        "required": [
          "body_md"
        ]
      },
      "Accepted": {
        "type": "object",
        "properties": {
          "accepted": {
            "type": "boolean"
          }
        },
        "required": [
          "accepted"
        ]
      },
      "Approval": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "tool_name": {
            "type": "string"
          },
          "args_redacted": {
            "type": "object",
            "additionalProperties": {}
          },
          "summary": {
            "type": "string"
          },
          "risk": {
            "$ref": "#/components/schemas/Risk"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "denied",
              "expired"
            ]
          },
          "decided_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "run_id",
          "tool_name",
          "args_redacted",
          "summary",
          "risk",
          "status",
          "decided_at",
          "expires_at",
          "created_at"
        ]
      },
      "ApprovalDecisionRequest": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "approved",
              "denied"
            ]
          },
          "always_allow": {
            "type": "boolean",
            "description": "Always allow this tool for this bot"
          }
        },
        "required": [
          "decision"
        ]
      },
      "BotSecretRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "service": {
            "type": "string"
          },
          "allowed_hosts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reason": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/SecretKind"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "fulfilled",
              "declined",
              "expired"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "bot_id",
          "run_id",
          "conversation_id",
          "name",
          "service",
          "allowed_hosts",
          "reason",
          "kind",
          "status",
          "expires_at",
          "created_at"
        ],
        "description": "A bot asking for a secret; never holds a value"
      },
      "DeletedRoutine": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "DeletedId": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "FulfillSecretRequestBody": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000,
            "description": "Stored in Vault; never returned, logged or shown to the bot"
          }
        },
        "required": [
          "value"
        ]
      },
      "ApprovalList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Approval"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "IntegrationList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Integration"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "RoutineList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Routine"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "BotSecretRequestList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotSecretRequest"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "SecretList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Secret"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "TaskCommentList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskComment"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "TaskList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Task"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "TemplateList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Template"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "Template": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "autonomy": {
            "type": "string",
            "enum": [
              "ask_always",
              "ask_risky",
              "autonomous"
            ]
          },
          "skills": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "routines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "schedule_cron": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "schedule_cron"
              ]
            }
          },
          "persona": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "work",
              "research",
              "build",
              "create",
              "life"
            ]
          },
          "icon": {
            "type": "string"
          },
          "mascot": {
            "type": "string"
          },
          "starters": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "author": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "handle": {
                "type": "string"
              }
            },
            "required": [
              "name"
            ]
          },
          "added": {
            "type": "string",
            "description": "YYYY-MM-DD the item was added"
          },
          "updated": {
            "type": "string"
          },
          "pick": {
            "type": "string",
            "description": "Why a featured item is a pick"
          },
          "examples": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "access": {
            "$ref": "#/components/schemas/GalleryAccess"
          },
          "needs": {
            "$ref": "#/components/schemas/GalleryNeeds"
          },
          "inputs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryInput"
            }
          },
          "min_app": {
            "type": "string"
          },
          "season": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              }
            },
            "required": [
              "from",
              "to"
            ]
          },
          "source": {
            "type": "string",
            "description": "The extra catalog it came from (GALLERY_SOURCES); ids are source:id"
          },
          "version": {
            "type": "integer"
          },
          "stats": {
            "$ref": "#/components/schemas/GalleryStats"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "autonomy",
          "skills",
          "routines"
        ]
      },
      "GalleryAccess": {
        "type": "object",
        "properties": {
          "reads": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "writes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "runs_code": {
            "type": "boolean"
          },
          "computer": {
            "type": "boolean"
          },
          "credits": {
            "type": "string",
            "enum": [
              "none",
              "low",
              "medium",
              "high"
            ]
          }
        },
        "description": "What an item can touch, in plain words"
      },
      "GalleryNeeds": {
        "type": "object",
        "properties": {
          "apps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "skills": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "GalleryInput": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "choice",
              "time",
              "timezone"
            ]
          },
          "default": {
            "type": "string"
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "help": {
            "type": "string"
          }
        },
        "required": [
          "key",
          "label",
          "type"
        ],
        "description": "A question asked when a routine or bot is added"
      },
      "GalleryStats": {
        "type": "object",
        "properties": {
          "installers": {
            "type": "integer"
          },
          "trending": {
            "type": "integer",
            "description": "New installers this week"
          },
          "active": {
            "type": "integer",
            "description": "People who used it in 14 days"
          },
          "success": {
            "type": "number",
            "description": "Share of runs that finished, 0 to 1 (last 30 days)"
          }
        },
        "description": "Aggregate use. Numbers are left out under 10 installers; success under 20 runs (D-315)."
      },
      "RunStarted": {
        "type": "object",
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "run_id"
        ]
      },
      "IntegrationTestResult": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "tools"
        ]
      },
      "UpdateRoutineRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "instructions": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "schedule_cron": {
            "type": "string",
            "maxLength": 100,
            "description": "A once routine given a cron becomes a repeating one"
          },
          "run_at": {
            "type": "string",
            "format": "date-time",
            "description": "A repeating routine given run_at becomes a once one"
          },
          "timezone": {
            "type": "string",
            "maxLength": 64
          },
          "notify": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it switches itself off; null removes the end time"
          },
          "max_runs": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 10000,
            "description": "Runs left before it switches itself off, counted from now; null removes it"
          }
        }
      },
      "UpdateTaskRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "details_md": {
            "type": "string",
            "maxLength": 10000
          },
          "status": {
            "$ref": "#/components/schemas/TaskStatus"
          },
          "priority": {
            "$ref": "#/components/schemas/TaskPriority"
          },
          "assignee_bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The bot starts on it at once"
          },
          "assignee_user_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "due_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "labels": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            },
            "maxItems": 10
          },
          "review_required": {
            "type": "boolean"
          },
          "position": {
            "type": "number"
          }
        }
      },
      "PhoneCall": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_name": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ringing",
              "answered",
              "declined",
              "missed",
              "cancelled"
            ]
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "bot_name",
          "reason",
          "status",
          "conversation_id",
          "expires_at",
          "created_at"
        ]
      },
      "VoiceSession": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "gemini"
            ],
            "description": "Gemini Live over a WebSocket, the only live-call provider (D-260)"
          },
          "model": {
            "type": "string"
          },
          "client_secret": {
            "type": "string",
            "description": "Gemini's single-use token (the access_token query parameter)"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "connect_url": {
            "type": "string",
            "description": "Open a WebSocket here with ?access_token=<client_secret>"
          },
          "setup": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {},
            "description": "Send {setup: <this>} as the first message (add sessionResumption to reconnect)"
          },
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "tools": {
            "type": "integer"
          },
          "speak_first": {
            "type": "boolean"
          }
        },
        "required": [
          "provider",
          "model",
          "client_secret",
          "expires_at",
          "connect_url",
          "setup",
          "conversation_id",
          "tools",
          "speak_first"
        ]
      },
      "VoiceSessionRequest": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "call_id": {
            "type": "string",
            "format": "uuid",
            "description": "An answered phone call: the session uses its conversation and the bot speaks first"
          }
        },
        "required": [
          "bot_id"
        ]
      },
      "PhoneCallList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PhoneCall"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "SavedCount": {
        "type": "object",
        "properties": {
          "saved": {
            "type": "integer"
          }
        },
        "required": [
          "saved"
        ]
      },
      "VoiceTranscriptRequest": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "turns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant"
                  ]
                },
                "text": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 20000
                }
              },
              "required": [
                "role",
                "text"
              ]
            },
            "maxItems": 500
          },
          "seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400
          },
          "provider": {
            "type": "string",
            "enum": [
              "gemini",
              "openai"
            ],
            "description": "Which live-call provider the call used. Every call is Gemini Live now (D-260); openai is still accepted from older apps."
          },
          "usage": {
            "type": "object",
            "properties": {
              "input_audio_tokens": {
                "type": "integer",
                "minimum": 0
              },
              "input_text_tokens": {
                "type": "integer",
                "minimum": 0
              },
              "output_audio_tokens": {
                "type": "integer",
                "minimum": 0
              },
              "output_text_tokens": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "input_audio_tokens",
              "input_text_tokens",
              "output_audio_tokens",
              "output_text_tokens"
            ],
            "description": "Gemini Live: the call's token counts from usageMetadata, so usage records the real cost instead of a per-minute estimate"
          }
        },
        "required": [
          "conversation_id",
          "turns",
          "seconds"
        ]
      },
      "Transcription": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "seconds": {
            "type": "number"
          }
        },
        "required": [
          "text",
          "provider",
          "seconds"
        ]
      },
      "VoiceToolResult": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "failed",
              "waiting_approval",
              "running"
            ]
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "output": {
            "type": "string",
            "description": "Give this to the realtime model as the function output"
          },
          "approval_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "status",
          "run_id",
          "output",
          "approval_id"
        ]
      },
      "VoiceToolRequest": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "call_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "arguments": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "bot_id",
          "conversation_id",
          "call_id",
          "name"
        ]
      },
      "CreatedLocalDevice": {
        "allOf": [
          {
            "$ref": "#/components/schemas/LocalDevice"
          },
          {
            "type": "object",
            "properties": {
              "token": {
                "type": "string",
                "description": "Device token, shown once; the app keeps it in secure storage"
              }
            },
            "required": [
              "token"
            ]
          }
        ]
      },
      "LocalDevice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "computer_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "platform": {
            "type": "string",
            "enum": [
              "macos",
              "windows",
              "linux"
            ]
          },
          "os_version": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the desktop app reported when it last connected, e.g. \"macOS 26.2\""
          },
          "capabilities": {
            "$ref": "#/components/schemas/LocalCapabilities"
          },
          "allowed_roots": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowed_bot_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "online": {
            "type": "boolean"
          },
          "last_seen_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "user_id",
          "computer_id",
          "name",
          "platform",
          "capabilities",
          "allowed_roots",
          "allowed_bot_ids",
          "enabled",
          "online",
          "last_seen_at",
          "created_at"
        ]
      },
      "CreateLocalDeviceRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "platform": {
            "type": "string",
            "enum": [
              "macos",
              "windows",
              "linux"
            ]
          }
        },
        "required": [
          "org_id",
          "name",
          "platform"
        ]
      },
      "DeletedDevice": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "LocalDeviceList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LocalDevice"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "LocalMcpIntegrationList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Integration"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "SetLocalMcpServersRequest": {
        "type": "object",
        "properties": {
          "servers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LocalMcpServerInfo"
            },
            "maxItems": 50
          }
        },
        "required": [
          "servers"
        ]
      },
      "LocalMcpServerInfo": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,30}$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "kind": {
            "type": "string",
            "enum": [
              "stdio",
              "loopback"
            ]
          },
          "summary": {
            "type": "string",
            "maxLength": 300,
            "description": "Shown to the workspace, e.g. the command without its environment"
          },
          "timeout_s": {
            "type": "integer",
            "minimum": 10,
            "maximum": 7200,
            "description": "Longest a call may take (default 1800 s); progress keeps it alive"
          }
        },
        "required": [
          "key",
          "label",
          "kind",
          "summary"
        ]
      },
      "UpdateLocalDeviceRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "capabilities": {
            "$ref": "#/components/schemas/LocalCapabilities"
          },
          "allowed_roots": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            },
            "maxItems": 20
          },
          "allowed_bot_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 100
          },
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "AbuseEventList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AbuseEvent"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "AbuseEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "org_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "computer_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "kind": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "detail": {
            "type": "object",
            "additionalProperties": {}
          },
          "created_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "org_id",
          "org_name",
          "computer_id",
          "kind",
          "action",
          "detail",
          "created_at"
        ]
      },
      "ServerCapacity": {
        "type": "object",
        "properties": {
          "budget_mb": {
            "type": "integer",
            "description": "Memory hosted computers may use (COMPUTER_HOST_MEMORY_GB); 0 = none set"
          },
          "latest": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "at": {
                "type": "string"
              },
              "mem_total_mb": {
                "type": "integer"
              },
              "mem_available_mb": {
                "type": "integer"
              },
              "load1": {
                "type": "number"
              },
              "cpus": {
                "type": "integer"
              },
              "disk_used_pct": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "computers_running": {
                "type": "integer"
              },
              "computers_mem_mb": {
                "type": "integer"
              }
            },
            "required": [
              "at",
              "mem_total_mb",
              "mem_available_mb",
              "load1",
              "cpus",
              "disk_used_pct",
              "computers_running",
              "computers_mem_mb"
            ]
          },
          "days": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": {
                  "type": "string"
                },
                "peak_computers_mem_mb": {
                  "type": "integer"
                },
                "peak_computers": {
                  "type": "integer"
                },
                "min_available_mb": {
                  "type": "integer"
                },
                "peak_load1": {
                  "type": "number"
                }
              },
              "required": [
                "day",
                "peak_computers_mem_mb",
                "peak_computers",
                "min_available_mb",
                "peak_load1"
              ]
            }
          },
          "refusals_30d": {
            "type": "integer"
          },
          "full_in_weeks": {
            "type": [
              "number",
              "null"
            ],
            "description": "Weeks until daily peaks reach the budget at the 30-day trend"
          },
          "alerts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "early_warning",
                    "capacity_full",
                    "low_memory",
                    "disk"
                  ]
                },
                "day": {
                  "type": "string"
                },
                "body": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "day",
                "body"
              ]
            }
          }
        },
        "required": [
          "budget_mb",
          "latest",
          "days",
          "refusals_30d",
          "full_in_weeks",
          "alerts"
        ]
      },
      "CloudModels": {
        "type": "object",
        "properties": {
          "chat": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "OpenRouter model for chat on Casama's key."
          },
          "background": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "OpenRouter model for summaries, memory and briefs."
          },
          "image": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "OpenRouter image model."
          },
          "image_resolution": {
            "type": "string",
            "enum": [
              "1K",
              "2K",
              "4K"
            ]
          },
          "live": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Gemini Live model for calls."
          },
          "tts": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "OpenRouter text-to-speech model for read aloud (google/gemini-3.8-flash-lite-tts)."
          },
          "stt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "OpenRouter transcription model for dictation (openai/whisper-large-v3-turbo)."
          },
          "embedding": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "OpenAI embedding model."
          },
          "video": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "OpenRouter video model (google/gemini-omni-1.2-flash)."
          }
        },
        "required": [
          "chat",
          "background",
          "image",
          "image_resolution",
          "live",
          "tts",
          "stt",
          "embedding",
          "video"
        ]
      },
      "ConnectionSettings": {
        "type": "object",
        "properties": {
          "composio": {
            "type": "string",
            "enum": [
              "server",
              "own"
            ],
            "description": "server: through this server's Composio account (one click). own: people use their own Composio, Pipedream or Zapier accounts."
          },
          "google": {
            "type": "string",
            "enum": [
              "composio",
              "direct"
            ],
            "description": "Google's apps. composio: through this server's Composio account whenever it has one (the default; Google's own MCP servers need Developer Preview enrollment, D-166). direct: Google's own MCP servers with GOOGLE_OAUTH_CLIENT_ID. Casama Cloud always uses Composio."
          },
          "composio_key": {
            "type": "boolean",
            "description": "Whether this server has a Composio key (COMPOSIO_API_KEY)."
          },
          "google_direct_available": {
            "type": "boolean",
            "description": "Whether Google's own servers can be chosen: this server has a Google client (GOOGLE_OAUTH_CLIENT_ID) and isn't Casama Cloud."
          }
        },
        "required": [
          "composio",
          "google",
          "composio_key",
          "google_direct_available"
        ]
      },
      "AdminOrgList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdminOrg"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "AdminOrg": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "plan_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "limits": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          },
          "members": {
            "type": "integer"
          },
          "bots": {
            "type": "integer"
          },
          "cost_30d_usd": {
            "type": "number"
          },
          "suspended_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "suspended_reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "plan_code",
          "limits",
          "members",
          "bots",
          "cost_30d_usd"
        ]
      },
      "AdminOverview": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string"
          },
          "users": {
            "type": "integer"
          },
          "orgs": {
            "type": "integer"
          },
          "bots": {
            "type": "integer"
          },
          "runs_24h": {
            "type": "integer"
          },
          "failed_runs_24h": {
            "type": "integer"
          },
          "cost_24h_usd": {
            "type": "number"
          },
          "computers_running": {
            "type": "integer"
          },
          "devices_online": {
            "type": "integer"
          }
        },
        "required": [
          "version",
          "users",
          "orgs",
          "bots",
          "runs_24h",
          "failed_runs_24h",
          "cost_24h_usd",
          "computers_running",
          "devices_online"
        ]
      },
      "AdminPricing": {
        "type": "object",
        "properties": {
          "billing_enabled": {
            "type": "boolean"
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdminPlan"
            }
          },
          "packs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdminCreditPack"
            }
          },
          "settings": {
            "$ref": "#/components/schemas/BillingSettings"
          }
        },
        "required": [
          "billing_enabled",
          "plans",
          "packs",
          "settings"
        ]
      },
      "AdminPlan": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "interval": {
            "type": "string",
            "enum": [
              "none",
              "month",
              "year"
            ]
          },
          "active": {
            "type": "boolean"
          },
          "sort": {
            "type": "integer"
          },
          "price_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "limits": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          },
          "credit_gate": {
            "type": "boolean",
            "description": "Runs on Casama's keys stop when the workspace's credits run out"
          },
          "store_product_ids": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "dodo_product_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "workspaces": {
            "type": "integer",
            "description": "Workspaces on this plan now"
          }
        },
        "required": [
          "code",
          "name",
          "interval",
          "active",
          "sort",
          "price_label",
          "limits",
          "credit_gate",
          "store_product_ids",
          "dodo_product_id",
          "workspaces"
        ]
      },
      "AdminCreditPack": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "credits_usd": {
            "type": "number"
          },
          "active": {
            "type": "boolean"
          },
          "price_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "store_product_ids": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "dodo_product_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "code",
          "name",
          "credits_usd",
          "active",
          "price_label",
          "store_product_ids",
          "dodo_product_id"
        ]
      },
      "BillingSettings": {
        "type": "object",
        "properties": {
          "markup": {
            "type": "number",
            "minimum": 1,
            "description": "Multiplier on what Casama pays for usage on its own keys (1.3 = 30% over cost)"
          }
        },
        "required": [
          "markup"
        ]
      },
      "AdminServiceList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdminService"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "AdminService": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "configured": {
            "type": "boolean"
          },
          "healthy": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "configured",
          "healthy",
          "detail"
        ]
      },
      "UpdateNotice": {
        "type": "object",
        "properties": {
          "current": {
            "type": "string"
          },
          "latest": {
            "type": [
              "string",
              "null"
            ]
          },
          "update_available": {
            "type": "boolean"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "current",
          "latest",
          "update_available",
          "url"
        ]
      },
      "AdminUserList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdminUser"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "AdminUser": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_sign_in_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "orgs": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "email",
          "created_at",
          "last_sign_in_at",
          "orgs"
        ]
      },
      "ReportedCreationList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReportedCreation"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ReportedCreation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_name": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "reports": {
            "type": "integer"
          },
          "reporters": {
            "type": "integer"
          },
          "last_reason": {
            "type": "string"
          },
          "taken_down": {
            "type": "boolean"
          },
          "last_reported_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "org_name",
          "title",
          "kind",
          "reports",
          "reporters",
          "last_reason",
          "taken_down",
          "last_reported_at"
        ]
      },
      "SaveCreditPackRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "credits_usd": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 10000
          },
          "active": {
            "type": "boolean"
          },
          "price_label": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 80
          },
          "store_product_ids": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          "dodo_product_id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200
          }
        }
      },
      "SavePlanRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "interval": {
            "type": "string",
            "enum": [
              "none",
              "month",
              "year"
            ]
          },
          "active": {
            "type": "boolean"
          },
          "sort": {
            "type": "integer"
          },
          "price_label": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 80
          },
          "limits": {
            "type": "object",
            "additionalProperties": {
              "type": "number",
              "minimum": 0
            },
            "description": "Replaces the plan's limits; every workspace on the plan gets them right away"
          },
          "credit_gate": {
            "type": "boolean"
          },
          "store_product_ids": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          "dodo_product_id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200
          }
        }
      },
      "SetConnectionSettingsRequest": {
        "type": "object",
        "properties": {
          "composio": {
            "type": "string",
            "enum": [
              "server",
              "own"
            ]
          },
          "google": {
            "type": "string",
            "enum": [
              "composio",
              "direct"
            ]
          }
        }
      },
      "SetOrgLimitsRequest": {
        "type": "object",
        "properties": {
          "limits": {
            "type": "object",
            "additionalProperties": {
              "type": "number",
              "minimum": 0
            },
            "description": "For example {max_bots, max_computers, monthly_usd}; replaces the org's limits"
          }
        },
        "required": [
          "limits"
        ]
      },
      "SuspendOrgRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        },
        "required": [
          "reason"
        ]
      },
      "TakeDownRequest": {
        "type": "object",
        "properties": {
          "down": {
            "type": "boolean"
          }
        },
        "required": [
          "down"
        ]
      },
      "RedirectUrl": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "url"
        ]
      },
      "PortalRequest": {
        "type": "object",
        "properties": {
          "return_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "BillingUsage": {
        "type": "object",
        "properties": {
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BillingUsageItem"
            }
          },
          "total_usd": {
            "type": "number"
          },
          "credits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditEntry"
            }
          }
        },
        "required": [
          "period_start",
          "items",
          "total_usd",
          "credits"
        ]
      },
      "BillingUsageItem": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string"
          },
          "instance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Casama Link instance, if any"
          },
          "quantity": {
            "type": "number"
          },
          "cost_usd": {
            "type": "number"
          }
        },
        "required": [
          "kind",
          "instance",
          "quantity",
          "cost_usd"
        ]
      },
      "CreditEntry": {
        "type": "object",
        "properties": {
          "delta": {
            "type": "number"
          },
          "reason": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance_after": {
            "type": "number"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "delta",
          "reason",
          "note",
          "balance_after",
          "created_at"
        ]
      },
      "CheckoutResult": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "changed": {
            "type": "boolean"
          }
        },
        "required": [
          "url"
        ]
      },
      "CheckoutRequest": {
        "type": "object",
        "properties": {
          "plan_code": {
            "type": "string"
          },
          "pack_code": {
            "type": "string"
          },
          "return_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "CreatedLinkKey": {
        "allOf": [
          {
            "$ref": "#/components/schemas/LinkKey"
          },
          {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "description": "Shown once; set it as CASAMA_CLOUD_KEY"
              }
            },
            "required": [
              "key"
            ]
          }
        ]
      },
      "LinkKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "instance_name": {
            "type": "string"
          },
          "key_hint": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "instance_name",
          "key_hint",
          "scopes",
          "last_used_at",
          "created_at"
        ]
      },
      "CreateLinkKeyRequest": {
        "type": "object",
        "properties": {
          "instance_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "computers",
                "models",
                "remote_access",
                "push"
              ]
            },
            "minItems": 1
          }
        },
        "required": [
          "instance_name"
        ]
      },
      "BillingSummary": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "False on self-hosted servers: no paywall"
          },
          "plan_code": {
            "type": "string"
          },
          "plan_name": {
            "type": "string"
          },
          "interval": {
            "type": "string"
          },
          "limits": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          },
          "unlimited": {
            "type": "boolean"
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "source": {
            "type": "string",
            "enum": [
              "default",
              "dodo",
              "app_store",
              "google_play"
            ]
          },
          "cancel_at_period_end": {
            "type": "boolean"
          },
          "extra_seats": {
            "type": "integer",
            "description": "People paid for beyond the plan's seats (D-249)"
          },
          "trial_available": {
            "type": "boolean",
            "description": "The owner can still start a plan's free trial (D-249)"
          },
          "credits_usd": {
            "type": "number"
          },
          "daily": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "used_usd": {
                "type": "number",
                "description": "Spent today (UTC) on the server's keys"
              },
              "cap_usd": {
                "type": "number",
                "description": "The plan's daily cap on the server's keys"
              },
              "resets_at": {
                "type": "string",
                "format": "date-time",
                "description": "Next midnight UTC, when the day's spend resets"
              }
            },
            "required": [
              "used_usd",
              "cap_usd",
              "resets_at"
            ],
            "description": "Today's spend against the plan's daily cap; runs stop when it is reached (D-311). Null when no cap applies"
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Subscription"
            }
          },
          "providers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BillingSource"
            }
          }
        },
        "required": [
          "enabled",
          "plan_code",
          "plan_name",
          "interval",
          "limits",
          "unlimited",
          "valid_until",
          "source",
          "cancel_at_period_end",
          "credits_usd",
          "subscriptions",
          "providers"
        ]
      },
      "Subscription": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "$ref": "#/components/schemas/BillingSource"
          },
          "plan_code": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "current_period_end": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "cancel_at_period_end": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "source",
          "plan_code",
          "status",
          "current_period_end",
          "cancel_at_period_end"
        ]
      },
      "BillingSource": {
        "type": "string",
        "enum": [
          "dodo",
          "app_store",
          "google_play"
        ]
      },
      "LinkKeyList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LinkKey"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "PlanCatalog": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Plan"
            }
          },
          "packs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditPack"
            }
          }
        },
        "required": [
          "enabled",
          "plans",
          "packs"
        ]
      },
      "Plan": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "interval": {
            "type": "string",
            "enum": [
              "none",
              "month",
              "year"
            ]
          },
          "limits": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          },
          "price_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "web": {
            "type": "boolean"
          },
          "store_product_ids": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        },
        "required": [
          "code",
          "name",
          "interval",
          "limits",
          "price_label",
          "web",
          "store_product_ids"
        ]
      },
      "CreditPack": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "credits_usd": {
            "type": "number"
          },
          "web": {
            "type": "boolean"
          },
          "price_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "store_product_ids": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        },
        "required": [
          "code",
          "name",
          "credits_usd",
          "web"
        ]
      },
      "RevokedLinkKey": {
        "type": "object",
        "properties": {
          "revoked": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "revoked"
        ]
      },
      "SeatsRequest": {
        "type": "object",
        "properties": {
          "extra": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "People to pay for beyond the plan's seats"
          }
        },
        "required": [
          "extra"
        ]
      },
      "PurchaseRequest": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "app_store",
              "google_play"
            ]
          },
          "product_id": {
            "type": "string",
            "minLength": 1
          },
          "transaction_id": {
            "type": "string",
            "description": "App Store transaction id"
          },
          "purchase_token": {
            "type": "string",
            "description": "Google Play purchase token"
          }
        },
        "required": [
          "source",
          "product_id"
        ]
      },
      "AdminLinkServerList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdminLinkServer"
            }
          },
          "tunnels": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Tunnels held at the provider, or null when it didn't answer"
          },
          "zone": {
            "type": "string"
          }
        },
        "required": [
          "items",
          "tunnels",
          "zone"
        ]
      },
      "AdminLinkServer": {
        "allOf": [
          {
            "$ref": "#/components/schemas/LinkServer"
          },
          {
            "type": "object",
            "properties": {
              "org_id": {
                "type": "string",
                "format": "uuid"
              },
              "org_name": {
                "type": "string"
              }
            },
            "required": [
              "org_id",
              "org_name"
            ]
          }
        ]
      },
      "LinkServer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "instance_name": {
            "type": "string"
          },
          "address": {
            "type": "string",
            "description": "https://<label>.<zone>"
          },
          "pages_address": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "active: it has a tunnel. parked: not seen for a while, the tunnel returns when the server does. released: remote access was turned off, the address is kept for a time. suspended: taken down. Treat an unknown value as not active.",
            "example": "active"
          },
          "status_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "platform": {
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_seen_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "instance_name",
          "address",
          "pages_address",
          "status",
          "status_reason",
          "platform",
          "version",
          "last_seen_at",
          "created_at"
        ]
      },
      "RemoteAccessStatus": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "description": "off, starting, online, offline or needs_attention. Treat an unknown value as needs_attention.",
            "example": "online"
          },
          "address": {
            "type": [
              "string",
              "null"
            ],
            "description": "The public address, when it is on"
          },
          "pages_address": {
            "type": [
              "string",
              "null"
            ]
          },
          "local_address": {
            "type": [
              "string",
              "null"
            ],
            "description": "The address on the server's own machine"
          },
          "linked": {
            "type": "boolean",
            "description": "Whether the server has a link to Casama Cloud"
          },
          "problem": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where it stops: not_linked, cloud_unreachable, key_rejected, suspended, removed, plan_limit, unknown_server, address_changed, connector_missing, connector_blocked (the connector runs but its network blocks the tunnel, outbound port 7844) or address_unanswered (everything looks connected, yet the address doesn't answer from outside). More may be added.",
            "example": "connector_blocked"
          },
          "connections": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Connections the connector holds; null when it couldn't be asked"
          },
          "checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "push": {
            "type": "string",
            "description": "How notifications reach the store apps: own (this server's own Firebase key), relay (through Casama Cloud) or off.",
            "example": "relay"
          },
          "private_notifications": {
            "type": "boolean",
            "description": "On: the relay is given no text (the phone shows New activity) and the app loads it from this server."
          },
          "invites": {
            "type": "boolean",
            "description": "Whether invited people can make an account while remote access is on. Off: sign-ups are closed."
          },
          "live_view": {
            "type": "string",
            "description": "Live video for people away from the server's machine, which goes through a relay at Casama Cloud: included (the linked workspace's plan has it) or plan (it comes with a higher plan; they see screenshots). Absent when it isn't known. More values may be added.",
            "example": "included"
          }
        },
        "required": [
          "state",
          "address",
          "pages_address",
          "local_address",
          "linked",
          "problem",
          "connections",
          "checked_at"
        ]
      },
      "ApprovedLinkSignIn": {
        "type": "object",
        "properties": {
          "instance_name": {
            "type": "string"
          }
        },
        "required": [
          "instance_name"
        ]
      },
      "ApproveLinkSignInRequest": {
        "type": "object",
        "properties": {
          "user_code": {
            "type": "string",
            "minLength": 8,
            "maxLength": 16
          }
        },
        "required": [
          "user_code"
        ]
      },
      "SignInCode": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Shown once, inside the QR code; valid a few minutes"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "server_url": {
            "type": "string",
            "description": "The address a phone uses for this server"
          },
          "reachable": {
            "type": "boolean",
            "description": "false when that address only works on this machine or network; a phone elsewhere needs remote access turned on first"
          },
          "pair_url": {
            "type": "string",
            "description": "What the QR code holds: a link that opens the app with the code"
          }
        },
        "required": [
          "code",
          "expires_at",
          "server_url",
          "reachable",
          "pair_url"
        ]
      },
      "LinkSignInRequest": {
        "type": "object",
        "properties": {
          "user_code": {
            "type": "string",
            "description": "The code the server shows, like K7QM-2XFD"
          },
          "instance_name": {
            "type": "string"
          },
          "platform": {
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "type": [
              "string",
              "null"
            ]
          },
          "approved": {
            "type": "boolean"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "user_code",
          "instance_name",
          "platform",
          "version",
          "approved",
          "expires_at"
        ]
      },
      "LinkServerList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LinkServer"
            }
          },
          "limit": {
            "type": "integer",
            "description": "Servers this workspace's plan connects"
          }
        },
        "required": [
          "items",
          "limit"
        ]
      },
      "RedeemedSignInCode": {
        "type": "object",
        "properties": {
          "token_hash": {
            "type": "string",
            "description": "Finish with Auth's verify (type magiclink) to get this device its own session"
          },
          "email": {
            "type": "string"
          }
        },
        "required": [
          "token_hash",
          "email"
        ]
      },
      "RedeemSignInCodeRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "minLength": 20,
            "maxLength": 200
          },
          "device_name": {
            "type": "string",
            "maxLength": 80
          }
        },
        "required": [
          "code"
        ]
      },
      "RemovedLinkServer": {
        "type": "object",
        "properties": {
          "removed": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "removed"
        ]
      },
      "SetRemoteAccessSettingsRequest": {
        "type": "object",
        "properties": {
          "private_notifications": {
            "type": "boolean"
          }
        },
        "required": [
          "private_notifications"
        ]
      },
      "SuspendLinkServerRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "reason"
        ]
      },
      "AccountDeletion": {
        "type": "object",
        "properties": {
          "purge_after": {
            "type": "string",
            "format": "date-time"
          },
          "workspaces_deleted": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Workspaces you are the only owner of; they are deleted with you"
          }
        },
        "required": [
          "purge_after",
          "workspaces_deleted"
        ]
      },
      "DeleteAccountRequest": {
        "type": "object",
        "properties": {
          "confirm_email": {
            "type": "string",
            "format": "email",
            "description": "The account's email, to confirm"
          }
        },
        "required": [
          "confirm_email"
        ]
      },
      "OrgSettings": {
        "type": "object",
        "properties": {
          "run_event_retention_days": {
            "type": "integer",
            "minimum": 7,
            "maximum": 3650
          },
          "require_mfa": {
            "type": "boolean",
            "description": "Owners and admins must use two-step sign-in (turning it on needs an aal2 session)"
          },
          "mcp_decide_approvals": {
            "type": "boolean",
            "description": "Allow approving or denying actions from AI apps connected over MCP"
          },
          "allow_bot_to_bot": {
            "type": "boolean",
            "description": "Bots may @mention, message and delegate to each other; subagents always work"
          },
          "a2a_enabled": {
            "type": "boolean",
            "description": "Bots the workspace chooses can be published as A2A agents, reachable with workspace API keys"
          },
          "llm_tracing": {
            "type": "boolean",
            "description": "Send model calls to the server's Langfuse, secrets redacted; no effect without Langfuse"
          },
          "analytics_opt_out": {
            "type": "boolean",
            "description": "Disable usage analytics collection and rollups for this workspace"
          }
        },
        "required": [
          "run_event_retention_days",
          "require_mfa",
          "mcp_decide_approvals",
          "allow_bot_to_bot",
          "a2a_enabled",
          "llm_tracing"
        ]
      },
      "UpdateOrgSettingsRequest": {
        "type": "object",
        "properties": {
          "run_event_retention_days": {
            "type": "integer",
            "minimum": 7,
            "maximum": 3650
          },
          "require_mfa": {
            "type": "boolean",
            "description": "Owners and admins must use two-step sign-in (turning it on needs an aal2 session)"
          },
          "mcp_decide_approvals": {
            "type": "boolean",
            "description": "Allow approving or denying actions from AI apps connected over MCP"
          },
          "allow_bot_to_bot": {
            "type": "boolean",
            "description": "Bots may @mention, message and delegate to each other; subagents always work"
          },
          "a2a_enabled": {
            "type": "boolean",
            "description": "Bots the workspace chooses can be published as A2A agents, reachable with workspace API keys"
          },
          "llm_tracing": {
            "type": "boolean",
            "description": "Send model calls to the server's Langfuse, secrets redacted; no effect without Langfuse"
          },
          "analytics_opt_out": {
            "type": "boolean",
            "description": "Disable usage analytics collection and rollups for this workspace"
          }
        }
      },
      "WallpaperPhotoList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WallpaperPhoto"
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "unsplash"
            ]
          }
        },
        "required": [
          "items",
          "source"
        ]
      },
      "WallpaperPhoto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "thumb_url": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "color": {
            "type": [
              "string",
              "null"
            ]
          },
          "width": {
            "type": "integer"
          },
          "height": {
            "type": "integer"
          },
          "author": {
            "type": "string"
          },
          "author_url": {
            "type": "string"
          },
          "source_url": {
            "type": "string"
          },
          "download_location": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "thumb_url",
          "url",
          "color",
          "width",
          "height",
          "author",
          "author_url",
          "source_url",
          "download_location"
        ]
      },
      "WallpaperDownloadRequest": {
        "type": "object",
        "properties": {
          "download_location": {
            "type": "string",
            "maxLength": 2000,
            "format": "uri"
          }
        },
        "required": [
          "download_location"
        ]
      },
      "ConnectAppResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "connected",
              "authorize",
              "error"
            ]
          },
          "integration": {
            "$ref": "#/components/schemas/Integration"
          },
          "authorize_url": {
            "type": "string"
          },
          "flow_id": {
            "type": "string",
            "format": "uuid"
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "status"
        ]
      },
      "ConnectAppRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "maxLength": 100
          },
          "method": {
            "type": "string",
            "enum": [
              "oauth",
              "api_key",
              "none",
              "managed"
            ]
          },
          "api_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "return_to_app": {
            "type": "boolean"
          }
        },
        "required": [
          "org_id",
          "app_id",
          "method"
        ]
      },
      "ProviderConnectResponse": {
        "type": "object",
        "properties": {
          "redirect_url": {
            "type": "string"
          }
        },
        "required": [
          "redirect_url"
        ]
      },
      "ProviderConnectRequest": {
        "type": "object",
        "properties": {
          "app": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "return_to_app": {
            "type": "boolean"
          }
        },
        "required": [
          "app"
        ]
      },
      "ConnectFlowStatus": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "connected",
              "error",
              "expired"
            ]
          },
          "integration": {
            "$ref": "#/components/schemas/Integration"
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "status"
        ]
      },
      "AppCatalog": {
        "type": "object",
        "properties": {
          "apps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogApp"
            }
          },
          "redirect_uri": {
            "type": "string"
          }
        },
        "required": [
          "apps",
          "redirect_uri"
        ]
      },
      "CatalogApp": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "developer",
              "productivity",
              "google",
              "payments",
              "design",
              "sales",
              "data",
              "automation"
            ]
          },
          "color": {
            "type": "string",
            "description": "Brand color, hex without #"
          },
          "homepage": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "auth": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "oauth",
                "api_key",
                "none",
                "managed"
              ]
            }
          },
          "api_key": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "placeholder": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "steps": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "label",
              "url",
              "steps"
            ]
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "popular": {
            "type": "boolean"
          },
          "note": {
            "type": "string"
          },
          "oauth_available": {
            "type": "boolean"
          },
          "composio": {
            "type": "string"
          },
          "logo_url": {
            "type": "string"
          },
          "added": {
            "type": "string",
            "description": "YYYY-MM-DD the item was added"
          },
          "pick": {
            "type": "string",
            "description": "Why a featured item is a pick"
          },
          "examples": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "access": {
            "$ref": "#/components/schemas/GalleryAccess"
          },
          "min_app": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "The extra catalog it came from (GALLERY_SOURCES); ids are source:id"
          },
          "version": {
            "type": "integer"
          },
          "stats": {
            "$ref": "#/components/schemas/GalleryStats"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "category",
          "color",
          "homepage",
          "url",
          "auth",
          "capabilities",
          "popular",
          "oauth_available"
        ]
      },
      "ProviderAccountList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProviderAccount"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ProviderAccount": {
        "type": "object",
        "properties": {
          "app": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "connected",
              "pending",
              "error"
            ]
          }
        },
        "required": [
          "app",
          "status"
        ]
      },
      "ProviderAppList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProviderApp"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ProviderApp": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "logo": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "slug",
          "name",
          "description",
          "logo"
        ]
      },
      "UpdateIntegrationRequest": {
        "type": "object",
        "properties": {
          "risk_overrides": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high"
              ]
            }
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchResult"
            }
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FileSearchResult"
            }
          },
          "files_searched": {
            "type": "integer",
            "description": "How many awake computers had their files searched"
          }
        },
        "required": [
          "query",
          "items",
          "files",
          "files_searched"
        ]
      },
      "SearchResult": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/SearchKind"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "snippet": {
            "type": "string",
            "description": "Matching text; matches are wrapped in « »"
          },
          "bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "kind",
          "id",
          "title",
          "snippet",
          "bot_id",
          "conversation_id",
          "created_at"
        ]
      },
      "SearchKind": {
        "type": "string",
        "enum": [
          "message",
          "chat",
          "memory",
          "skill",
          "routine",
          "ticket"
        ]
      },
      "FileSearchResult": {
        "type": "object",
        "properties": {
          "computer_id": {
            "type": "string",
            "format": "uuid"
          },
          "computer_name": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "match": {
            "type": "string",
            "enum": [
              "name",
              "content"
            ]
          }
        },
        "required": [
          "computer_id",
          "computer_name",
          "path",
          "match"
        ]
      },
      "InstalledSkill": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "catalog",
              "github",
              "bot",
              "gallery"
            ]
          },
          "source_ref": {
            "type": "object",
            "additionalProperties": {}
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "file_count": {
            "type": "integer"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "bot_id",
          "name",
          "description",
          "source",
          "source_ref",
          "category",
          "file_count",
          "updated_at"
        ]
      },
      "ApplySkillUpdateRequest": {
        "type": "object",
        "properties": {
          "commit": {
            "type": "string",
            "pattern": "^[0-9a-f]{40}$"
          }
        },
        "required": [
          "commit"
        ]
      },
      "SkillUpdateCheck": {
        "type": "object",
        "properties": {
          "current_commit": {
            "type": "string"
          },
          "latest_commit": {
            "type": "string"
          },
          "has_update": {
            "type": "boolean"
          },
          "diff": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "SKILL.md line diff (+, -, space)"
          },
          "files_added": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "files_removed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "files_changed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "current_commit",
          "latest_commit",
          "has_update",
          "diff",
          "files_added",
          "files_removed",
          "files_changed"
        ]
      },
      "SkillCatalog": {
        "type": "object",
        "properties": {
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogSkill"
            }
          }
        },
        "required": [
          "categories",
          "items"
        ]
      },
      "CatalogSkill": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "icon": {
            "type": [
              "string",
              "null"
            ],
            "description": "A Lucide icon name (kebab-case); apps fall back to the category's icon"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "skill_md": {
            "type": "string",
            "description": "The raw SKILL.md, for a preview"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "category",
          "files"
        ]
      },
      "InstallCatalogSkillRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid",
            "description": "Install for one bot; default the whole workspace"
          },
          "catalog_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "gallery_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Install a skill from the gallery instead of the bundled catalog"
          }
        },
        "required": [
          "org_id"
        ]
      },
      "InstallGitHubSkillRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "minLength": 10,
            "maxLength": 500
          },
          "commit": {
            "type": "string",
            "pattern": "^[0-9a-f]{40}$"
          }
        },
        "required": [
          "org_id",
          "url",
          "commit"
        ]
      },
      "GitHubSkillPreview": {
        "type": "object",
        "properties": {
          "repo": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "commit": {
            "type": "string",
            "description": "The pinned commit installs and updates use"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "skill_md": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SkillPreviewFile"
            }
          }
        },
        "required": [
          "repo",
          "path",
          "ref",
          "commit",
          "name",
          "description",
          "skill_md",
          "files"
        ]
      },
      "SkillPreviewFile": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          },
          "executable": {
            "type": "boolean"
          },
          "text": {
            "type": [
              "string",
              "null"
            ],
            "description": "Contents of text files up to 100 KB; null for binaries"
          }
        },
        "required": [
          "path",
          "size",
          "executable",
          "text"
        ]
      },
      "GitHubSkillPreviewRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "minLength": 10,
            "maxLength": 500
          }
        },
        "required": [
          "org_id",
          "url"
        ]
      },
      "BotShareLink": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "token",
          "url",
          "expires_at"
        ]
      },
      "CreateBotShareRequest": {
        "type": "object",
        "properties": {
          "include_memories": {
            "type": "boolean",
            "default": false
          },
          "expires_in_days": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 365,
            "default": 30
          }
        }
      },
      "BotTemplateFile": {
        "type": "object",
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "casama.bot"
            ]
          },
          "version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1,
            "description": "Format version (1)"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "description": {
            "type": "string",
            "maxLength": 300
          },
          "persona_md": {
            "type": "string",
            "maxLength": 20000
          },
          "autonomy": {
            "type": "string",
            "enum": [
              "ask_always",
              "ask_risky",
              "autonomous"
            ]
          },
          "avatar": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200
          },
          "skills": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9_-]{0,62}$"
                },
                "description": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 300
                },
                "body_md": {
                  "type": "string",
                  "maxLength": 50000
                },
                "files": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "path": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "content_base64": {
                        "type": "string",
                        "maxLength": 1500000
                      },
                      "executable": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "path",
                      "content_base64"
                    ]
                  },
                  "maxItems": 60
                }
              },
              "required": [
                "name",
                "description",
                "body_md"
              ]
            },
            "maxItems": 30
          },
          "routines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "instructions_md": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 20000
                },
                "schedule_cron": {
                  "type": "string",
                  "maxLength": 100
                }
              },
              "required": [
                "name",
                "instructions_md",
                "schedule_cron"
              ]
            },
            "maxItems": 20
          },
          "connections": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "maxLength": 40
                },
                "name": {
                  "type": "string",
                  "maxLength": 120
                }
              },
              "required": [
                "kind",
                "name"
              ]
            },
            "maxItems": 30,
            "description": "Services to connect after importing (names only, no credentials)"
          },
          "memories": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "fact",
                    "episode",
                    "summary",
                    "preference"
                  ]
                },
                "content": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 8000
                }
              },
              "required": [
                "kind",
                "content"
              ]
            },
            "maxItems": 200
          }
        },
        "required": [
          "format",
          "version",
          "name",
          "persona_md",
          "autonomy"
        ]
      },
      "ImportBotResponse": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "skills": {
            "type": "integer"
          },
          "routines": {
            "type": "integer"
          },
          "memories": {
            "type": "integer"
          },
          "connections_to_add": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "name"
              ]
            }
          }
        },
        "required": [
          "bot_id",
          "skills",
          "routines",
          "memories",
          "connections_to_add"
        ]
      },
      "ImportBotRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "template": {
            "$ref": "#/components/schemas/BotTemplateFile"
          },
          "credential_id": {
            "type": "string",
            "format": "uuid",
            "description": "The model key the new bot uses"
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "include_memories": {
            "type": "boolean",
            "default": true
          },
          "include_routines": {
            "type": "boolean",
            "default": true
          }
        },
        "required": [
          "org_id",
          "template",
          "credential_id",
          "model"
        ]
      },
      "Project": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "goal_md": {
            "type": "string"
          },
          "done_criteria_md": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/ProjectStatus"
          },
          "plan_status": {
            "type": "string",
            "enum": [
              "draft",
              "proposed",
              "approved"
            ]
          },
          "status_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "lead_bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "owner_user_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "budget_usd": {
            "type": [
              "number",
              "null"
            ]
          },
          "spent_usd": {
            "type": "number"
          },
          "deadline_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "plan_md": {
            "type": "string"
          },
          "sessions": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "autonomous": {
            "type": "boolean",
            "description": "Plans for your approval, then works by itself in sessions (D-113). False: worked on together in its chat (D-295). Absent on older servers, where every project is autonomous"
          },
          "personal": {
            "type": "boolean",
            "description": "Grew out of a person's own chat: seen by them and by whoever can open its chat, not the whole workspace"
          },
          "folder": {
            "type": "string",
            "description": "Where its files live on the lead bot's computer, under the home folder (the folder is made when the bot first saves something there)"
          },
          "creations_count": {
            "type": "integer",
            "description": "How many things in the Library are filed under it, that you can see"
          },
          "latest_creation": {
            "$ref": "#/components/schemas/Creation"
          },
          "can_steer": {
            "type": "boolean",
            "description": "Whether you may change it: its owner, an admin or the lead bot's managers"
          }
        },
        "required": [
          "id",
          "org_id",
          "slug",
          "title",
          "goal_md",
          "done_criteria_md",
          "status",
          "plan_status",
          "status_reason",
          "lead_bot_id",
          "owner_user_id",
          "conversation_id",
          "budget_usd",
          "spent_usd",
          "deadline_at",
          "plan_md",
          "sessions",
          "created_at"
        ]
      },
      "ProjectStatus": {
        "type": "string",
        "enum": [
          "planning",
          "active",
          "paused",
          "blocked",
          "done",
          "cancelled"
        ]
      },
      "CreateProjectRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "goal_md": {
            "type": "string",
            "maxLength": 20000,
            "description": "Needed when the project works by itself"
          },
          "done_criteria_md": {
            "type": "string",
            "maxLength": 10000
          },
          "lead_bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "budget_usd": {
            "type": [
              "number",
              "null"
            ],
            "exclusiveMinimum": 0,
            "maximum": 10000
          },
          "deadline_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "autonomous": {
            "type": "boolean",
            "description": "true (the default, as before D-295): the lead bot drafts a plan for you to approve, then works by itself. false: a project you work on together in its chat"
          },
          "conversation_id": {
            "type": "string",
            "format": "uuid",
            "description": "With autonomous false: make this topic of yours the project's chat, and file what was made in it under the project. Without it the project gets a new topic"
          }
        },
        "required": [
          "org_id",
          "title",
          "lead_bot_id"
        ]
      },
      "ProjectDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Project"
          },
          {
            "type": "object",
            "properties": {
              "milestones": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ProjectMilestone"
                }
              },
              "runs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ProjectRun"
                }
              }
            },
            "required": [
              "milestones",
              "runs"
            ]
          }
        ]
      },
      "ProjectMilestone": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "requires_signoff": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "awaiting_signoff",
              "done"
            ]
          },
          "tickets_done": {
            "type": "integer"
          },
          "tickets_total": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "position",
          "requires_signoff",
          "status",
          "tickets_done",
          "tickets_total"
        ]
      },
      "ProjectRun": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "trigger": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "cost_usd": {
            "type": "number"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "trigger",
          "status",
          "cost_usd",
          "created_at"
        ]
      },
      "ProjectList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Project"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "UpdateProjectRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "cancelled",
              "done"
            ],
            "description": "Resume, pause, cancel or finish. A finished project you work on together can be made active again"
          },
          "budget_usd": {
            "type": [
              "number",
              "null"
            ],
            "exclusiveMinimum": 0,
            "maximum": 10000
          },
          "deadline_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "plan_md": {
            "type": "string",
            "maxLength": 20000
          },
          "goal_md": {
            "type": "string",
            "maxLength": 20000
          },
          "done_criteria_md": {
            "type": "string",
            "maxLength": 10000
          },
          "autonomous": {
            "type": "boolean",
            "description": "true: the lead bot drafts a plan for you to approve, then works by itself (needs a goal). false: back to working on it together; nothing more starts by itself"
          }
        }
      },
      "AcceptedSuggestion": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "conversation_id",
          "run_id"
        ]
      },
      "DismissSuggestionRequest": {
        "type": "object",
        "properties": {
          "dont_suggest_again": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "BotCheckins": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "brief_time": {
            "type": "string",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
            "description": "Local time, HH:MM"
          },
          "scan_every_hours": {
            "type": "integer",
            "minimum": 1,
            "maximum": 24
          },
          "daily_cap_usd": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 100
          }
        },
        "required": [
          "enabled",
          "brief_time",
          "scan_every_hours",
          "daily_cap_usd"
        ]
      },
      "ForYou": {
        "type": "object",
        "properties": {
          "briefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ForYouBrief"
            }
          },
          "suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Suggestion"
            }
          },
          "approvals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ForYouApproval"
            }
          }
        },
        "required": [
          "briefs",
          "suggestions",
          "approvals"
        ]
      },
      "ForYouBrief": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "text": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "bot_id",
          "conversation_id",
          "text",
          "created_at"
        ]
      },
      "Suggestion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "body_md": {
            "type": "string"
          },
          "push_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposed_action": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "tool": {
                "type": "string"
              },
              "args": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "required": [
              "tool"
            ]
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "urgency": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "urgent"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "title",
          "body_md",
          "proposed_action",
          "sources",
          "urgency",
          "expires_at",
          "created_at"
        ]
      },
      "ForYouApproval": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "summary": {
            "type": "string"
          },
          "risk": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "summary",
          "risk",
          "created_at"
        ]
      },
      "ActionRule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "match_kind": {
            "type": "string",
            "enum": [
              "tool",
              "group",
              "category"
            ]
          },
          "match_value": {
            "type": "string"
          },
          "target": {
            "$ref": "#/components/schemas/ActionRuleTarget"
          },
          "rule": {
            "type": "string",
            "enum": [
              "allow",
              "allow_within_limits",
              "ask",
              "hand_off"
            ]
          },
          "preview": {
            "type": "string",
            "description": "In plain language, e.g. Sends messages to anyone at acme.com without asking"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "bot_id",
          "match_kind",
          "match_value",
          "target",
          "rule",
          "preview",
          "created_at"
        ]
      },
      "ActionRuleTarget": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "domains": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 3,
              "maxLength": 253
            },
            "maxItems": 20
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email"
            },
            "maxItems": 50
          },
          "max_amount": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "CreateActionRuleRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Null or missing: the whole workspace (admins)"
          },
          "match_kind": {
            "type": "string",
            "enum": [
              "tool",
              "group",
              "category"
            ]
          },
          "match_value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "target": {
            "$ref": "#/components/schemas/ActionRuleTarget"
          },
          "rule": {
            "type": "string",
            "enum": [
              "allow",
              "allow_within_limits",
              "ask",
              "hand_off"
            ]
          }
        },
        "required": [
          "org_id",
          "match_kind",
          "match_value",
          "rule"
        ]
      },
      "DeletedRule": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "ActionRuleList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActionRule"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "MemoryImportPrompt": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string"
          }
        },
        "required": [
          "prompt"
        ]
      },
      "ParsedMemoryImport": {
        "type": "object",
        "properties": {
          "memories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportedMemoryItem"
            }
          }
        },
        "required": [
          "memories"
        ]
      },
      "ImportedMemoryItem": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "fact",
              "preference"
            ]
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          }
        },
        "required": [
          "kind",
          "content"
        ]
      },
      "ParseMemoryImportRequest": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200000
          }
        },
        "required": [
          "text"
        ]
      },
      "SavedImportedMemories": {
        "type": "object",
        "properties": {
          "saved": {
            "type": "integer"
          }
        },
        "required": [
          "saved"
        ]
      },
      "SaveImportedMemoriesRequest": {
        "type": "object",
        "properties": {
          "memories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportedMemoryItem"
            },
            "minItems": 1,
            "maxItems": 500
          }
        },
        "required": [
          "memories"
        ]
      },
      "AgentImportPlan": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "openclaw",
              "hermes"
            ]
          },
          "template": {
            "$ref": "#/components/schemas/BotTemplateFile"
          },
          "sources": {
            "type": "object",
            "properties": {
              "skills": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "routines": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "memories": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "skills",
              "routines",
              "memories"
            ]
          },
          "leftovers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "size": {
                  "type": "integer"
                }
              },
              "required": [
                "path",
                "size"
              ]
            }
          },
          "skipped": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                }
              },
              "required": [
                "path",
                "reason"
              ]
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "kind",
          "template",
          "sources",
          "leftovers",
          "skipped",
          "notes"
        ]
      },
      "StartAgentImportRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "zip_base64": {
            "type": "string",
            "maxLength": 70000000
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                },
                "content_base64": {
                  "type": "string",
                  "maxLength": 14000000
                }
              },
              "required": [
                "path",
                "content_base64"
              ]
            },
            "maxItems": 3000
          }
        },
        "required": [
          "org_id"
        ]
      },
      "WriteAgentImportFilesResponse": {
        "type": "object",
        "properties": {
          "written": {
            "type": "integer"
          },
          "folder": {
            "type": "string"
          }
        },
        "required": [
          "written",
          "folder"
        ]
      },
      "WriteAgentImportFilesRequest": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "bot_id"
        ]
      },
      "KnowledgeSource": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "upload",
              "website",
              "github",
              "connection"
            ]
          },
          "name": {
            "type": "string"
          },
          "config": {
            "type": "object",
            "additionalProperties": {}
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "syncing",
              "ready",
              "error"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "documents": {
            "type": "integer"
          },
          "chunks": {
            "type": "integer"
          },
          "last_synced_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "kind",
          "name",
          "config",
          "status",
          "error",
          "documents",
          "chunks",
          "last_synced_at",
          "created_at"
        ]
      },
      "CreateKnowledgeSourceRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "upload",
              "website",
              "github",
              "connection"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 300
                },
                "content_base64": {
                  "type": "string",
                  "maxLength": 34000000
                }
              },
              "required": [
                "name",
                "content_base64"
              ]
            },
            "maxItems": 50
          },
          "url": {
            "type": "string",
            "maxLength": 2000
          },
          "max_pages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "repo_url": {
            "type": "string",
            "maxLength": 500
          },
          "sync_every_hours": {
            "type": "integer",
            "minimum": 1,
            "maximum": 168
          },
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tool": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "args": {
                  "type": "object",
                  "additionalProperties": {}
                },
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 300
                },
                "url": {
                  "type": "string",
                  "maxLength": 2000
                }
              },
              "required": [
                "tool",
                "title"
              ]
            },
            "maxItems": 100
          }
        },
        "required": [
          "org_id",
          "kind",
          "name"
        ]
      },
      "DeletedKnowledgeSource": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "KnowledgeSourceList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeSource"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "BotAccess": {
        "type": "object",
        "properties": {
          "visibility": {
            "type": "string",
            "enum": [
              "private",
              "team"
            ]
          },
          "created_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotAccessEntry"
            }
          },
          "can_admin": {
            "type": "boolean"
          },
          "your_access": {
            "type": "string",
            "enum": [
              "chat",
              "edit",
              "admin"
            ]
          }
        },
        "required": [
          "visibility",
          "created_by",
          "entries",
          "can_admin",
          "your_access"
        ]
      },
      "BotAccessEntry": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "owner",
              "admin",
              "member",
              null
            ]
          },
          "access": {
            "type": "string",
            "enum": [
              "chat",
              "edit",
              "admin"
            ]
          }
        },
        "required": [
          "user_id",
          "email",
          "role",
          "access"
        ]
      },
      "WorkspaceMemberList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkspaceMember"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "WorkspaceMember": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "pronouns": {
            "type": [
              "string",
              "null"
            ]
          },
          "photo_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "user_id",
          "email",
          "role"
        ]
      },
      "SetBotAccessRequest": {
        "type": "object",
        "properties": {
          "visibility": {
            "type": "string",
            "enum": [
              "private",
              "team"
            ]
          },
          "entries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "user_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "owner",
                    "admin",
                    "member"
                  ]
                },
                "access": {
                  "type": "string",
                  "enum": [
                    "chat",
                    "edit",
                    "admin"
                  ]
                }
              },
              "required": [
                "access"
              ]
            },
            "maxItems": 200
          }
        },
        "required": [
          "visibility",
          "entries"
        ]
      },
      "Channel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "$ref": "#/components/schemas/ChannelKind"
          },
          "name": {
            "type": "string"
          },
          "config": {
            "type": "object",
            "additionalProperties": {}
          },
          "allowed_senders": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "webhook_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "verify_token": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_inbound_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "kind",
          "name",
          "config",
          "allowed_senders",
          "enabled",
          "webhook_url",
          "verify_token",
          "last_inbound_at",
          "last_error",
          "created_at"
        ]
      },
      "ChannelKind": {
        "type": "string",
        "enum": [
          "telegram",
          "email",
          "sms",
          "slack",
          "whatsapp",
          "messenger",
          "feishu",
          "imessage",
          "teams",
          "discord",
          "linear",
          "jira"
        ]
      },
      "CreateChannelRequest": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "$ref": "#/components/schemas/ChannelKind"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "config": {
            "type": "object",
            "additionalProperties": {}
          },
          "secrets": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 5000
            }
          },
          "allowed_senders": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            },
            "maxItems": 200
          }
        },
        "required": [
          "bot_id",
          "kind",
          "name",
          "allowed_senders"
        ]
      },
      "DeletedChannel": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "ChannelEventList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChannelEvent"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ChannelEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "direction": {
            "type": "string",
            "enum": [
              "in",
              "out"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "ignored",
              "routine",
              "sent",
              "failed"
            ]
          },
          "sender": {
            "type": [
              "string",
              "null"
            ]
          },
          "preview": {
            "type": [
              "string",
              "null"
            ]
          },
          "detail": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "direction",
          "status",
          "sender",
          "preview",
          "detail",
          "created_at"
        ]
      },
      "ChannelList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Channel"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "SlackInstallLink": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "url"
        ]
      },
      "UpdateChannelRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "allowed_senders": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            },
            "maxItems": 200
          },
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "ReplacedDataKeys": {
        "type": "object",
        "properties": {
          "workspaces": {
            "type": "integer"
          },
          "people": {
            "type": "integer"
          }
        },
        "required": [
          "workspaces",
          "people"
        ]
      },
      "EncryptionStatus": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "off",
              "encrypting",
              "on",
              "decrypting"
            ]
          },
          "available": {
            "type": "boolean"
          },
          "key": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "server_key",
              "aws_kms",
              null
            ]
          },
          "since": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "rotated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "rekeying": {
            "type": "boolean"
          }
        },
        "required": [
          "mode",
          "available",
          "key",
          "since",
          "rotated_at"
        ]
      },
      "SetEncryptionRequest": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ]
      },
      "GalleryRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "$ref": "#/components/schemas/GalleryKind"
          },
          "title": {
            "type": "string"
          },
          "details": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "planned",
              "done",
              "declined"
            ]
          },
          "done_item_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "votes": {
            "type": "integer"
          },
          "voted": {
            "type": "boolean"
          },
          "mine": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "title",
          "details",
          "status",
          "done_item_key",
          "votes",
          "voted",
          "mine",
          "created_at"
        ]
      },
      "GalleryKind": {
        "type": "string",
        "enum": [
          "theme",
          "scheme",
          "wallpaper",
          "skill",
          "app",
          "bot",
          "routine",
          "plugin"
        ]
      },
      "CreateGalleryRequest": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/GalleryKind"
          },
          "title": {
            "type": "string",
            "minLength": 4,
            "maxLength": 80
          },
          "details": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "kind",
          "title"
        ]
      },
      "GallerySubmission": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/GallerySubmissionKind"
          },
          "item_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "pr_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "merged",
              "closed",
              "failed"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "type",
          "item_id",
          "name",
          "pr_url",
          "status",
          "created_at"
        ]
      },
      "GallerySubmissionKind": {
        "type": "string",
        "enum": [
          "theme",
          "scheme",
          "wallpaper",
          "skill",
          "routine",
          "bot"
        ]
      },
      "CreateGallerySubmission": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/GallerySubmissionKind"
          },
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
            "description": "Folder name; made from the name when left out"
          },
          "item": {
            "type": "object",
            "additionalProperties": {},
            "description": "item.json fields"
          },
          "files": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "The item's other files by name: theme.json, scheme.json, wallpaper.json, SKILL.md (plus .md references), routine.json, bot.json"
          },
          "remix_of": {
            "$ref": "#/components/schemas/GalleryRef"
          }
        },
        "required": [
          "type",
          "item",
          "files"
        ]
      },
      "GalleryRef": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "id"
        ],
        "description": "Another gallery item"
      },
      "GalleryApproval": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/GalleryWorkspaceKind"
          },
          "item_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "requested_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "requested_by_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "denied",
              "failed"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "decided_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "type",
          "item_id",
          "name",
          "requested_by",
          "requested_by_name",
          "reason",
          "status",
          "error",
          "created_at",
          "decided_at"
        ]
      },
      "GalleryWorkspaceKind": {
        "type": "string",
        "enum": [
          "skill",
          "app",
          "bot",
          "routine",
          "plugin"
        ]
      },
      "GalleryApprovalDecision": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "approved",
              "denied"
            ]
          }
        },
        "required": [
          "decision"
        ]
      },
      "GalleryDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GalleryItem"
          },
          {
            "type": "object",
            "properties": {
              "document": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": {}
              },
              "skill_md": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "document",
              "skill_md"
            ]
          }
        ]
      },
      "GalleryAnyKind": {
        "type": "string",
        "enum": [
          "theme",
          "scheme",
          "wallpaper",
          "skill",
          "app",
          "bot",
          "routine",
          "plugin",
          "set"
        ],
        "description": "Looks and skills; with kinds=all also app, bot, routine, plugin and set (D-315)"
      },
      "GalleryAuthor": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "handle": {
            "type": "string",
            "description": "Stable author id for author pages (D-315)"
          }
        },
        "required": [
          "name"
        ]
      },
      "GalleryChange": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer"
          },
          "date": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "breaking": {
            "type": "boolean"
          }
        },
        "required": [
          "version",
          "date",
          "note"
        ]
      },
      "GalleryItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/GalleryAnyKind"
          },
          "name": {
            "type": "string"
          },
          "author": {
            "$ref": "#/components/schemas/GalleryAuthor"
          },
          "license": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "featured": {
            "type": "boolean"
          },
          "retired": {
            "type": "boolean"
          },
          "version": {
            "type": "integer"
          },
          "sha256": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "icon": {
            "type": "string",
            "description": "A skill's Lucide icon name."
          },
          "description": {
            "type": "string",
            "description": "A skill's one-line description."
          },
          "requires": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Features the look needs from the app (doodles, mesh, scheme-colors). Apps hide items that need something they can't draw."
          },
          "document": {
            "type": "object",
            "additionalProperties": {},
            "description": "A theme, scheme or wallpaper document, so a list can draw previews without fetching each item; an app, bot, routine or plugin entry; a set's set.json (items)."
          },
          "files": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "added": {
            "type": "string",
            "description": "YYYY-MM-DD the item was added"
          },
          "updated": {
            "type": "string"
          },
          "changelog": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryChange"
            }
          },
          "pick": {
            "type": "string",
            "description": "Why a featured item is a pick"
          },
          "examples": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "access": {
            "$ref": "#/components/schemas/GalleryAccess"
          },
          "needs": {
            "$ref": "#/components/schemas/GalleryNeeds"
          },
          "inputs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryInput"
            }
          },
          "remix_of": {
            "$ref": "#/components/schemas/GalleryRef"
          },
          "replaced_by": {
            "$ref": "#/components/schemas/GalleryRef"
          },
          "min_app": {
            "type": "string"
          },
          "min_server": {
            "type": "string"
          },
          "season": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              }
            },
            "required": [
              "from",
              "to"
            ]
          },
          "tested": {
            "type": "object",
            "properties": {
              "version": {
                "type": "integer"
              },
              "date": {
                "type": "string"
              }
            },
            "required": [
              "version",
              "date"
            ]
          },
          "source": {
            "type": "string",
            "description": "The extra catalog it came from (GALLERY_SOURCES); ids are source:id"
          },
          "stats": {
            "$ref": "#/components/schemas/GalleryStats"
          },
          "template": {
            "type": "object",
            "additionalProperties": {},
            "description": "Routines and bots with install questions: the raw fields with {{key}} placeholders (document has the defaults filled)"
          }
        },
        "required": [
          "id",
          "type",
          "name",
          "author",
          "license",
          "tags",
          "featured",
          "retired",
          "version",
          "sha256",
          "files"
        ]
      },
      "GalleryPolicy": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "open",
              "approval",
              "allowlist"
            ]
          },
          "allow": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 120
            },
            "maxItems": 500
          },
          "block": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 120
            },
            "maxItems": 500
          },
          "approval_for": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "runs_code",
                "apps",
                "all"
              ]
            },
            "maxItems": 3
          }
        },
        "required": [
          "mode",
          "allow",
          "block",
          "approval_for"
        ],
        "description": "Who may add what from the gallery. Item keys are \"<type>/<id>\". open: anything not blocked; approval: admins approve; allowlist: only listed items."
      },
      "GalleryStatsList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/GalleryStats"
            }
          }
        },
        "required": [
          "items"
        ],
        "description": "Stats by item key, \"<type>/<id>\""
      },
      "GalleryInstallResult": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "installed",
              "approval_pending"
            ]
          },
          "installed": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "kind": {
                "$ref": "#/components/schemas/GalleryWorkspaceKind"
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "approval_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "missing": {
            "$ref": "#/components/schemas/GalleryMissing"
          }
        },
        "required": [
          "status",
          "installed",
          "approval_id",
          "missing"
        ]
      },
      "GalleryMissing": {
        "type": "object",
        "properties": {
          "apps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ]
            }
          },
          "skills": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ]
            }
          }
        },
        "required": [
          "apps",
          "skills"
        ],
        "description": "What still has to be connected or added"
      },
      "GalleryInstallRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/GalleryWorkspaceKind"
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "inputs": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 120
            }
          },
          "bot_id": {
            "type": "string",
            "format": "uuid",
            "description": "The bot a routine, skill or plugin goes to; a routine needs one"
          }
        },
        "required": [
          "org_id",
          "type",
          "id"
        ]
      },
      "GallerySetInstallResult": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "$ref": "#/components/schemas/GalleryKind"
                },
                "id": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "installed",
                    "approval_pending",
                    "skipped",
                    "failed",
                    "device"
                  ]
                },
                "installed": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "kind": {
                      "$ref": "#/components/schemas/GalleryWorkspaceKind"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind",
                    "id"
                  ]
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "type",
                "id",
                "status",
                "installed",
                "error"
              ]
            }
          },
          "missing": {
            "$ref": "#/components/schemas/GalleryMissing"
          }
        },
        "required": [
          "items",
          "missing"
        ]
      },
      "GallerySetInstallRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid",
            "description": "Where the set's routines go"
          }
        },
        "required": [
          "org_id"
        ]
      },
      "GalleryList": {
        "type": "object",
        "properties": {
          "available": {
            "type": "boolean",
            "description": "False when the gallery host could not be read. Built-in looks still apply."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryItem"
            }
          }
        },
        "required": [
          "available",
          "items"
        ]
      },
      "GalleryApprovalList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryApproval"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "GalleryAuthorList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryAuthorProfile"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "GalleryAuthorProfile": {
        "type": "object",
        "properties": {
          "handle": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryRef"
            }
          }
        },
        "required": [
          "handle",
          "name",
          "items"
        ]
      },
      "GalleryInstalledList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryInstalledItem"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "GalleryInstalledItem": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/GalleryWorkspaceKind"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "installed_version": {
            "type": "integer"
          },
          "latest_version": {
            "type": [
              "integer",
              "null"
            ]
          },
          "update": {
            "type": "boolean"
          },
          "breaking": {
            "type": "boolean"
          },
          "access_added": {
            "$ref": "#/components/schemas/GalleryAccessDiff"
          },
          "retired": {
            "type": "boolean"
          },
          "replacement": {
            "$ref": "#/components/schemas/GalleryRef"
          },
          "changelog": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryChange"
            },
            "description": "Entries newer than the installed one"
          },
          "installed_at": {
            "type": "string",
            "format": "date-time"
          },
          "target": {
            "type": "object",
            "properties": {
              "kind": {
                "$ref": "#/components/schemas/GalleryWorkspaceKind"
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          }
        },
        "required": [
          "type",
          "id",
          "name",
          "installed_version",
          "latest_version",
          "update",
          "breaking",
          "access_added",
          "retired",
          "changelog",
          "installed_at",
          "target"
        ]
      },
      "GalleryAccessDiff": {
        "type": "object",
        "properties": {
          "reads": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "writes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "runs_code": {
            "type": "boolean"
          },
          "computer": {
            "type": "boolean"
          }
        },
        "required": [
          "reads",
          "writes",
          "runs_code",
          "computer"
        ],
        "description": "What the newer version can touch that this one can't"
      },
      "GalleryRequestList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryRequest"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "GallerySetList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GallerySet"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "GallerySet": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "icon": {
            "type": "string"
          },
          "author": {
            "$ref": "#/components/schemas/GalleryAuthor"
          },
          "featured": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryRef"
            }
          },
          "source": {
            "type": "string"
          },
          "added": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "icon",
          "author",
          "featured",
          "items"
        ]
      },
      "GallerySubmissionList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GallerySubmission"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "GalleryAuthorItemList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryAuthorItem"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "GalleryAuthorItem": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/GalleryKind"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "version": {
            "type": [
              "integer",
              "null"
            ]
          },
          "stats": {
            "type": "object",
            "properties": {
              "installers": {
                "type": "integer"
              },
              "installers_7d": {
                "type": "integer"
              },
              "active": {
                "type": "integer"
              },
              "runs_ok": {
                "type": "integer"
              },
              "runs_total": {
                "type": "integer"
              }
            },
            "required": [
              "installers",
              "installers_7d",
              "active",
              "runs_ok",
              "runs_total"
            ]
          },
          "reports_open": {
            "type": "integer"
          }
        },
        "required": [
          "type",
          "id",
          "name",
          "version",
          "stats",
          "reports_open"
        ]
      },
      "GalleryUpdateResult": {
        "type": "object",
        "properties": {
          "updated": {
            "type": "integer"
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "updated",
          "version"
        ]
      },
      "GalleryUpdateRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/GalleryWorkspaceKind"
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "accept_access": {
            "type": "boolean",
            "description": "Apply even though the update can touch more or is breaking"
          }
        },
        "required": [
          "org_id",
          "type",
          "id"
        ]
      },
      "UpdateGalleryRequest": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "open",
              "planned",
              "done",
              "declined"
            ]
          },
          "done_item_key": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 120
          }
        },
        "required": [
          "status"
        ]
      },
      "RemoteAppConfig": {
        "type": "object",
        "properties": {
          "min_versions": {
            "type": "object",
            "properties": {
              "ios": {
                "type": "string"
              },
              "android": {
                "type": "string"
              },
              "macos": {
                "type": "string"
              },
              "windows": {
                "type": "string"
              },
              "linux": {
                "type": "string"
              },
              "web": {
                "type": "string"
              }
            },
            "description": "Apps older than this on a platform must update first"
          },
          "update_urls": {
            "type": "object",
            "properties": {
              "ios": {
                "type": "string"
              },
              "android": {
                "type": "string"
              },
              "macos": {
                "type": "string"
              },
              "windows": {
                "type": "string"
              },
              "linux": {
                "type": "string"
              },
              "web": {
                "type": "string"
              }
            },
            "description": "Where Update goes on each platform"
          },
          "maintenance": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "message": {
                "type": "string"
              }
            },
            "required": [
              "message"
            ]
          },
          "announcements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Announcement"
            }
          },
          "flags": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            },
            "description": "Feature switches; a missing name means the app's own default"
          }
        },
        "required": [
          "min_versions",
          "update_urls",
          "maintenance",
          "announcements",
          "flags"
        ]
      },
      "Announcement": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "level": {
            "type": "string",
            "enum": [
              "info",
              "warning"
            ]
          },
          "starts_at": {
            "type": "string"
          },
          "ends_at": {
            "type": "string"
          },
          "platforms": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "ios",
                "android",
                "macos",
                "windows",
                "linux",
                "web"
              ]
            }
          },
          "min_version": {
            "type": "string"
          },
          "max_version": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "body",
          "level"
        ]
      },
      "SetRemoteAppConfigRequest": {
        "type": "object",
        "additionalProperties": {},
        "description": "The whole settings object; it replaces what's stored after it's checked"
      },
      "PluginDirectory": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DirectoryPlugin"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "DirectoryPlugin": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "The plugin's GitHub folder"
          },
          "commit": {
            "type": "string",
            "description": "The reviewed commit; installing pins it"
          },
          "icon": {
            "type": "string"
          },
          "adds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "author": {
            "$ref": "#/components/schemas/ContentAuthor"
          },
          "added": {
            "type": "string",
            "description": "YYYY-MM-DD the item was added"
          },
          "updated": {
            "type": "string"
          },
          "changelog": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryChange"
            }
          },
          "pick": {
            "type": "string",
            "description": "Why a featured item is a pick"
          },
          "examples": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "access": {
            "$ref": "#/components/schemas/GalleryAccess"
          },
          "needs": {
            "$ref": "#/components/schemas/GalleryNeeds"
          },
          "inputs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryInput"
            }
          },
          "remix_of": {
            "$ref": "#/components/schemas/GalleryRef"
          },
          "replaced_by": {
            "$ref": "#/components/schemas/GalleryRef"
          },
          "min_app": {
            "type": "string"
          },
          "min_server": {
            "type": "string"
          },
          "season": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              }
            },
            "required": [
              "from",
              "to"
            ]
          },
          "tested": {
            "type": "object",
            "properties": {
              "version": {
                "type": "integer"
              },
              "date": {
                "type": "string"
              }
            },
            "required": [
              "version",
              "date"
            ]
          },
          "source": {
            "type": "string",
            "description": "The extra catalog it came from (GALLERY_SOURCES); ids are source:id"
          },
          "stats": {
            "$ref": "#/components/schemas/GalleryStats"
          },
          "template": {
            "type": "object",
            "additionalProperties": {},
            "description": "Routines and bots with install questions: the raw fields with {{key}} placeholders (document has the defaults filled)"
          },
          "version": {
            "type": "integer"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "url",
          "commit",
          "adds",
          "author"
        ]
      },
      "ContentAuthor": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "handle": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "RoutineIdeaList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutineIdea"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "RoutineIdea": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "work",
              "research",
              "build",
              "create",
              "life"
            ]
          },
          "icon": {
            "type": "string",
            "description": "Lucide icon name, kebab-case"
          },
          "instructions_md": {
            "type": "string"
          },
          "schedule_cron": {
            "type": "string"
          },
          "featured": {
            "type": "boolean"
          },
          "author": {
            "$ref": "#/components/schemas/ContentAuthor"
          },
          "added": {
            "type": "string",
            "description": "YYYY-MM-DD the item was added"
          },
          "updated": {
            "type": "string"
          },
          "changelog": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryChange"
            }
          },
          "pick": {
            "type": "string",
            "description": "Why a featured item is a pick"
          },
          "examples": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "access": {
            "$ref": "#/components/schemas/GalleryAccess"
          },
          "needs": {
            "$ref": "#/components/schemas/GalleryNeeds"
          },
          "inputs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GalleryInput"
            }
          },
          "remix_of": {
            "$ref": "#/components/schemas/GalleryRef"
          },
          "replaced_by": {
            "$ref": "#/components/schemas/GalleryRef"
          },
          "min_app": {
            "type": "string"
          },
          "min_server": {
            "type": "string"
          },
          "season": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              }
            },
            "required": [
              "from",
              "to"
            ]
          },
          "tested": {
            "type": "object",
            "properties": {
              "version": {
                "type": "integer"
              },
              "date": {
                "type": "string"
              }
            },
            "required": [
              "version",
              "date"
            ]
          },
          "source": {
            "type": "string",
            "description": "The extra catalog it came from (GALLERY_SOURCES); ids are source:id"
          },
          "stats": {
            "$ref": "#/components/schemas/GalleryStats"
          },
          "template": {
            "type": "object",
            "additionalProperties": {},
            "description": "Routines and bots with install questions: the raw fields with {{key}} placeholders (document has the defaults filled)"
          },
          "version": {
            "type": "integer"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "category",
          "icon",
          "instructions_md",
          "schedule_cron",
          "featured",
          "author"
        ]
      },
      "TelephonySettings": {
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "account_sid": {
            "type": [
              "string",
              "null"
            ]
          },
          "from_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "allow_personal_numbers": {
            "type": "boolean"
          },
          "daily_cap": {
            "type": "integer"
          }
        },
        "required": [
          "connected",
          "account_sid",
          "from_number",
          "allow_personal_numbers",
          "daily_cap"
        ]
      },
      "OutboundCall": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "number": {
            "type": "string"
          },
          "purpose": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "ringing",
              "in_progress",
              "completed",
              "failed",
              "busy",
              "no_answer",
              "ended_by_user",
              "taken_over"
            ]
          },
          "transcript": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "bot",
                    "callee"
                  ]
                },
                "text": {
                  "type": "string"
                }
              },
              "required": [
                "role",
                "text"
              ]
            }
          },
          "seconds": {
            "type": [
              "integer",
              "null"
            ]
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ended_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "number",
          "purpose",
          "status",
          "transcript",
          "seconds",
          "started_at",
          "ended_at",
          "created_at"
        ]
      },
      "SetTelephonyRequest": {
        "type": "object",
        "properties": {
          "account_sid": {
            "type": "string",
            "pattern": "^AC[0-9a-fA-F]{32}$"
          },
          "auth_token": {
            "type": "string",
            "minLength": 16,
            "maxLength": 200
          },
          "from_number": {
            "type": "string",
            "pattern": "^\\+[1-9][0-9]{7,14}$"
          },
          "allow_personal_numbers": {
            "type": "boolean"
          },
          "daily_cap": {
            "type": "integer",
            "minimum": 0,
            "maximum": 500
          }
        },
        "required": [
          "account_sid",
          "from_number"
        ]
      },
      "TakeOverCallRequest": {
        "type": "object",
        "properties": {
          "phone": {
            "type": "string",
            "pattern": "^\\+[1-9][0-9]{7,14}$"
          }
        }
      },
      "PaymentSettings": {
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "stripe",
              null
            ]
          },
          "monthly_cap_usd": {
            "type": "number"
          },
          "bot_monthly_cap_usd": {
            "type": "number"
          },
          "spent_this_month_usd": {
            "type": "number"
          },
          "webhook_url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "connected",
          "provider",
          "monthly_cap_usd",
          "bot_monthly_cap_usd",
          "spent_this_month_usd",
          "webhook_url"
        ]
      },
      "PaymentRequestList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentRequest"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "PaymentRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "merchant": {
            "type": "string"
          },
          "amount_cents": {
            "type": "integer"
          },
          "currency": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "requested",
              "issued",
              "used",
              "declined",
              "expired",
              "failed",
              "canceled"
            ]
          },
          "last4": {
            "type": [
              "string",
              "null"
            ]
          },
          "spent_cents": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "merchant",
          "amount_cents",
          "currency",
          "reason",
          "status",
          "last4",
          "spent_cents",
          "expires_at",
          "created_at"
        ]
      },
      "SetPaymentSettingsRequest": {
        "type": "object",
        "properties": {
          "secret_key": {
            "type": "string",
            "minLength": 10,
            "maxLength": 300
          },
          "webhook_secret": {
            "type": "string",
            "minLength": 10,
            "maxLength": 300
          },
          "cardholder": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "email": {
                "type": "string",
                "format": "email"
              },
              "line1": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "city": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "state": {
                "type": "string",
                "maxLength": 100
              },
              "postal_code": {
                "type": "string",
                "minLength": 1,
                "maxLength": 20
              },
              "country": {
                "type": "string",
                "minLength": 2,
                "maxLength": 2
              }
            },
            "required": [
              "name",
              "email",
              "line1",
              "city",
              "postal_code",
              "country"
            ]
          },
          "monthly_cap_usd": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000
          },
          "bot_monthly_cap_usd": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000
          }
        },
        "required": [
          "secret_key",
          "webhook_secret",
          "cardholder"
        ]
      },
      "BotLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "active",
              "revoked"
            ]
          },
          "peer_bot_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "remote_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The other Casama server, when the contact is on another one"
          },
          "exchanges": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "activated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "name",
          "status",
          "peer_bot_name",
          "remote_url",
          "exchanges",
          "created_at",
          "activated_at"
        ]
      },
      "AcceptBotLinkRequest": {
        "type": "object",
        "properties": {
          "invite": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        },
        "required": [
          "invite",
          "bot_id",
          "name"
        ]
      },
      "CreatedBotLink": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BotLink"
          },
          {
            "type": "object",
            "properties": {
              "invite": {
                "type": "string"
              }
            },
            "required": [
              "invite"
            ]
          }
        ]
      },
      "CreateBotLinkRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "What you call this contact"
          }
        },
        "required": [
          "name"
        ]
      },
      "BotLinkList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotLink"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "LinkExchangeList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LinkExchange"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "LinkExchange": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "direction": {
            "type": "string",
            "enum": [
              "out",
              "in"
            ]
          },
          "request": {
            "type": "string"
          },
          "response": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "working",
              "answered",
              "failed"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "direction",
          "request",
          "response",
          "status",
          "created_at"
        ]
      },
      "SecretStoreSettings": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "vault",
              "infisical"
            ]
          },
          "site_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "project_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "environment": {
            "type": [
              "string",
              "null"
            ]
          },
          "secret_path": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "provider",
          "site_url",
          "project_id",
          "environment",
          "secret_path"
        ]
      },
      "SetSecretStoreRequest": {
        "type": "object",
        "properties": {
          "site_url": {
            "type": "string",
            "format": "uri"
          },
          "project_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "environment": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "secret_path": {
            "type": "string",
            "maxLength": 300,
            "pattern": "^\\/"
          },
          "client_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "client_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "move_existing": {
            "type": "boolean"
          }
        },
        "required": [
          "site_url",
          "project_id",
          "client_id",
          "client_secret"
        ]
      },
      "DeviceRequestResult": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "result": {
            "type": "object",
            "additionalProperties": {}
          },
          "error": {
            "type": "string",
            "maxLength": 1000
          }
        },
        "required": [
          "ok"
        ]
      },
      "DeviceGrant": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_name": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/DeviceKind"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "bot_id",
          "bot_name",
          "kind",
          "created_at"
        ]
      },
      "DeviceKind": {
        "type": "string",
        "enum": [
          "calendar",
          "reminders",
          "contacts",
          "places",
          "photos",
          "health",
          "notifications",
          "activity"
        ]
      },
      "DevicePlace": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "latitude": {
            "type": "number"
          },
          "longitude": {
            "type": "number"
          },
          "radius_m": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "latitude",
          "longitude",
          "radius_m",
          "created_at"
        ]
      },
      "DeviceReading": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "$ref": "#/components/schemas/DeviceKind"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "external_id": {
            "type": "string"
          },
          "summary": {
            "type": "object",
            "additionalProperties": {}
          },
          "collected_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "source_id",
          "kind",
          "period_start",
          "period_end",
          "external_id",
          "summary",
          "collected_at"
        ]
      },
      "DeviceRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "read",
              "calendar.create",
              "reminders.create",
              "locate"
            ]
          },
          "params": {
            "type": "object",
            "additionalProperties": {}
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "source_id",
          "kind",
          "action",
          "params",
          "created_at"
        ]
      },
      "DeviceSource": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "device_key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "platform": {
            "type": "string",
            "enum": [
              "ios",
              "android",
              "macos",
              "windows",
              "linux",
              "web"
            ]
          },
          "kinds": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/DeviceKindSettings"
            }
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "device_key",
          "name",
          "platform",
          "kinds",
          "last_seen_at",
          "created_at"
        ]
      },
      "DeviceKindSettings": {
        "type": "object",
        "properties": {
          "retention_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 365,
            "description": "0 keeps nothing (live only); the default is 365 for daily summaries, 90 for places and notifications"
          },
          "private_model": {
            "type": "boolean",
            "description": "Only bots on a private (local) model may read this kind"
          },
          "extras": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "cycle",
                "glucose",
                "blood_pressure"
              ]
            },
            "description": "Health only: sensitive extras the person turned on (off by default)"
          },
          "apps": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "maxItems": 50,
            "description": "Notifications only: the apps (names or package ids) whose notifications are shared; nothing else is"
          }
        }
      },
      "ReportDeviceEventsRequest": {
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeviceEventInput"
            },
            "maxItems": 50
          }
        },
        "required": [
          "events"
        ]
      },
      "DeviceEventInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Unique per event on the device, so a retry never fires twice"
          },
          "type": {
            "type": "string",
            "enum": [
              "wake",
              "arrive",
              "leave",
              "workout_ended",
              "notification",
              "focus_on",
              "focus_off",
              "file_added",
              "driving_on",
              "driving_off"
            ]
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "place": {
            "type": "string",
            "maxLength": 60
          },
          "app": {
            "type": "string",
            "maxLength": 200
          },
          "title": {
            "type": "string",
            "maxLength": 300
          },
          "text": {
            "type": "string",
            "maxLength": 2000
          },
          "folder": {
            "type": "string",
            "maxLength": 200,
            "description": "file_added: the watched folder's name (Downloads)"
          },
          "name": {
            "type": "string",
            "maxLength": 300,
            "description": "file_added: the new file's name"
          }
        },
        "required": [
          "id",
          "type",
          "at"
        ]
      },
      "SaveDevicePlaceRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "latitude": {
            "type": "number",
            "minimum": -90,
            "maximum": 90
          },
          "longitude": {
            "type": "number",
            "minimum": -180,
            "maximum": 180
          },
          "radius_m": {
            "type": "integer",
            "minimum": 50,
            "maximum": 2000
          }
        },
        "required": [
          "name",
          "latitude",
          "longitude"
        ]
      },
      "SaveDeviceSourceRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "platform": {
            "type": "string",
            "enum": [
              "ios",
              "android",
              "macos",
              "windows",
              "linux",
              "web"
            ]
          },
          "kinds": {
            "type": "object",
            "properties": {
              "calendar": {
                "$ref": "#/components/schemas/DeviceKindSettings"
              },
              "reminders": {
                "$ref": "#/components/schemas/DeviceKindSettings"
              },
              "contacts": {
                "$ref": "#/components/schemas/DeviceKindSettings"
              },
              "places": {
                "$ref": "#/components/schemas/DeviceKindSettings"
              },
              "photos": {
                "$ref": "#/components/schemas/DeviceKindSettings"
              },
              "health": {
                "$ref": "#/components/schemas/DeviceKindSettings"
              },
              "notifications": {
                "$ref": "#/components/schemas/DeviceKindSettings"
              },
              "activity": {
                "$ref": "#/components/schemas/DeviceKindSettings"
              }
            },
            "description": "The kinds turned on; a kind left out is turned off and its data deleted"
          }
        },
        "required": [
          "name",
          "platform",
          "kinds"
        ]
      },
      "SetDeviceGrantRequest": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "$ref": "#/components/schemas/DeviceKind"
          },
          "allowed": {
            "type": "boolean"
          }
        },
        "required": [
          "bot_id",
          "kind",
          "allowed"
        ]
      },
      "UploadDeviceReadingsRequest": {
        "type": "object",
        "properties": {
          "readings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeviceReadingInput"
            },
            "maxItems": 500
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Answers this fresh-read request"
          }
        },
        "required": [
          "readings"
        ]
      },
      "DeviceReadingInput": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/DeviceKind"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "external_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "summary": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "kind",
          "period_start",
          "period_end",
          "external_id",
          "summary"
        ]
      },
      "UserFactList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserFact"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "UserFact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "fact",
              "preference"
            ]
          },
          "content": {
            "type": "string"
          },
          "pinned": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "content",
          "pinned",
          "updated_at"
        ]
      },
      "AddUserFactsRequest": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "fact",
                    "preference"
                  ]
                },
                "content": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 500
                }
              },
              "required": [
                "content"
              ]
            },
            "minItems": 1,
            "maxItems": 200
          }
        },
        "required": [
          "items"
        ]
      },
      "AboutYou": {
        "type": "object",
        "properties": {
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "preferred_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "pronouns": {
            "type": [
              "string",
              "null"
            ]
          },
          "about": {
            "type": "string"
          },
          "reply_style": {
            "type": "string"
          },
          "learn": {
            "type": "boolean"
          },
          "name_asked": {
            "type": "boolean"
          },
          "photo_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "provider_photo": {
            "type": "boolean"
          },
          "photo_import_tried": {
            "type": "boolean"
          }
        },
        "required": [
          "display_name",
          "preferred_name",
          "pronouns",
          "about",
          "reply_style",
          "learn",
          "name_asked"
        ]
      },
      "DeletedUserFact": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "ProfileSpace": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "shared": {
            "type": "boolean"
          }
        },
        "required": [
          "org_id",
          "shared"
        ]
      },
      "ImportProfilePhotoRequest": {
        "type": "object",
        "properties": {
          "replace": {
            "type": "boolean"
          }
        }
      },
      "SetProfilePhotoRequest": {
        "type": "object",
        "properties": {
          "content_type": {
            "type": "string",
            "enum": [
              "image/jpeg",
              "image/png",
              "image/webp"
            ]
          },
          "data": {
            "type": "string",
            "maxLength": 1400000
          }
        },
        "required": [
          "content_type",
          "data"
        ]
      },
      "SetProfileSpaceRequest": {
        "type": "object",
        "properties": {
          "shared": {
            "type": "boolean"
          }
        },
        "required": [
          "shared"
        ]
      },
      "UpdateAboutYouRequest": {
        "type": "object",
        "properties": {
          "preferred_name": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 60
          },
          "pronouns": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 40
          },
          "about": {
            "type": "string",
            "maxLength": 1500
          },
          "reply_style": {
            "type": "string",
            "maxLength": 600
          },
          "learn": {
            "type": "boolean"
          },
          "name_asked": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "UpdateUserFactRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "pinned": {
            "type": "boolean"
          }
        }
      },
      "PageViewLink": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "url",
          "expires_at"
        ]
      },
      "PageViewLinkRequest": {
        "type": "object",
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "html",
              "pdf"
            ]
          }
        }
      },
      "DeletedPage": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "BotPageDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BotPage"
          },
          {
            "type": "object",
            "properties": {
              "versions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PageVersion"
                }
              }
            },
            "required": [
              "versions"
            ]
          }
        ]
      },
      "PageVersion": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "version",
          "created_at"
        ]
      },
      "BotPage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "private",
              "workspace",
              "public"
            ]
          },
          "version": {
            "type": "integer"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "refresh_routine_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "can_manage": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "title",
          "visibility",
          "version",
          "expires_at",
          "refresh_routine_id",
          "conversation_id",
          "can_manage",
          "updated_at",
          "created_at"
        ]
      },
      "PageList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotPage"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "RevertPageRequest": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "version"
        ]
      },
      "UpdatePageResponse": {
        "type": "object",
        "properties": {
          "page": {
            "$ref": "#/components/schemas/BotPage"
          },
          "public_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          }
        },
        "required": [
          "page",
          "public_url"
        ]
      },
      "UpdatePageRequest": {
        "type": "object",
        "properties": {
          "visibility": {
            "type": "string",
            "enum": [
              "private",
              "workspace",
              "public"
            ]
          },
          "expires_in_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          }
        },
        "required": [
          "visibility"
        ]
      },
      "PasswordManager": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "enum": [
              "workspace",
              "personal"
            ]
          },
          "provider": {
            "type": "string",
            "enum": [
              "1password",
              "bitwarden"
            ]
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "allowed_vaults": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowed_bot_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "error"
            ]
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "scope",
          "provider",
          "name",
          "url",
          "allowed_vaults",
          "allowed_bot_ids",
          "status",
          "last_error",
          "created_at"
        ]
      },
      "CreatePasswordManagerRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "enum": [
              "workspace",
              "personal"
            ]
          },
          "provider": {
            "type": "string",
            "enum": [
              "1password",
              "bitwarden"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "token": {
            "type": "string",
            "maxLength": 5000
          }
        },
        "required": [
          "org_id",
          "scope",
          "provider",
          "name",
          "url",
          "token"
        ]
      },
      "DeletedPasswordManager": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "PasswordManagerVaultList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PasswordManagerVault"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "PasswordManagerVault": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "allowed": {
            "type": "boolean"
          },
          "logins": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "allowed",
          "logins"
        ]
      },
      "PasswordManagerList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PasswordManager"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "UpdatePasswordManagerRequest": {
        "type": "object",
        "properties": {
          "allowed_vaults": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 200
            },
            "maxItems": 100
          },
          "allowed_bot_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 200
          }
        },
        "required": [
          "allowed_vaults"
        ]
      },
      "DeletedReplay": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "ReplayList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Replay"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "Replay": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "params": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReplayParamInfo"
            }
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tool": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              },
              "required": [
                "tool"
              ]
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "bot",
              "teach",
              "manual"
            ]
          },
          "runs": {
            "type": "integer"
          },
          "failures": {
            "type": "integer"
          },
          "last_failure": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_run_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "name",
          "description",
          "params",
          "steps",
          "source",
          "runs",
          "failures",
          "last_failure",
          "last_run_at",
          "updated_at"
        ]
      },
      "ReplayParamInfo": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "default": {
            "type": "string"
          },
          "secret": {
            "type": "boolean"
          }
        },
        "required": [
          "name"
        ]
      },
      "ReplayFromTeachRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_-]{0,62}$"
          },
          "description": {
            "type": "string",
            "maxLength": 300
          }
        },
        "required": [
          "name"
        ]
      },
      "RunReplayResponse": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "conversation_id",
          "run_id"
        ]
      },
      "RunReplayRequest": {
        "type": "object",
        "properties": {
          "params": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 2000
            }
          }
        }
      },
      "SkillProposal": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "new",
              "edit"
            ]
          },
          "skill_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "body_md": {
            "type": "string"
          },
          "previous_body_md": {
            "type": [
              "string",
              "null"
            ]
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reason": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "accepted",
              "dismissed",
              "applied"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "kind",
          "skill_id",
          "name",
          "description",
          "body_md",
          "previous_body_md",
          "tools",
          "reason",
          "status",
          "created_at"
        ]
      },
      "AcceptSkillProposalRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_-]{0,62}$"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "body_md": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50000
          }
        }
      },
      "SkillStats": {
        "type": "object",
        "properties": {
          "uses": {
            "type": "integer"
          },
          "successes": {
            "type": "integer"
          },
          "failures": {
            "type": "integer"
          },
          "corrections": {
            "type": "integer"
          },
          "success_rate": {
            "type": [
              "number",
              "null"
            ]
          },
          "last_failure_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_failure_run_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "revisions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "description": {
                  "type": "string"
                },
                "body_md": {
                  "type": "string"
                },
                "by_bot": {
                  "type": "boolean"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "description",
                "body_md",
                "by_bot",
                "created_at"
              ]
            }
          }
        },
        "required": [
          "uses",
          "successes",
          "failures",
          "corrections",
          "success_rate",
          "last_failure_at",
          "last_failure_run_id",
          "revisions"
        ]
      },
      "SkillProposalList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SkillProposal"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "PluginUpdatePreview": {
        "type": "object",
        "properties": {
          "up_to_date": {
            "type": "boolean"
          },
          "from_commit": {
            "type": "string"
          },
          "to_commit": {
            "type": "string"
          },
          "from_version": {
            "type": [
              "string",
              "null"
            ]
          },
          "to_version": {
            "type": [
              "string",
              "null"
            ]
          },
          "skills_added": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "skills_removed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "skills_changed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "servers_added": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "servers_removed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "servers_changed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "hosts_added": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "secrets_added": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "preview": {
            "$ref": "#/components/schemas/PluginPreview"
          }
        },
        "required": [
          "up_to_date",
          "from_commit",
          "to_commit",
          "from_version",
          "to_version",
          "skills_added",
          "skills_removed",
          "skills_changed",
          "servers_added",
          "servers_removed",
          "servers_changed",
          "hosts_added",
          "secrets_added",
          "preview"
        ]
      },
      "PluginPreview": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "version": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": "string"
          },
          "repo": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "commit": {
            "type": "string"
          },
          "skills": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "description"
              ]
            }
          },
          "servers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PluginServerInfo"
            }
          },
          "secrets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PluginSecretInfo"
            }
          },
          "hosts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "name",
          "version",
          "description",
          "repo",
          "path",
          "commit",
          "skills",
          "servers",
          "secrets",
          "hosts",
          "warnings"
        ]
      },
      "PluginServerInfo": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "stdio",
              "streamable-http",
              "sse"
            ]
          },
          "command": {
            "type": [
              "string",
              "null"
            ]
          },
          "args": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "key",
          "type",
          "command",
          "args",
          "url"
        ]
      },
      "PluginSecretInfo": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "server": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "description",
          "server"
        ]
      },
      "Plugin": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "version": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": "string"
          },
          "repo": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "commit": {
            "type": "string"
          },
          "skills": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ]
            }
          },
          "servers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InstalledPluginServer"
            }
          },
          "hosts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "secrets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PluginSecretInfo"
            }
          },
          "installed_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "name",
          "version",
          "description",
          "repo",
          "path",
          "commit",
          "skills",
          "servers",
          "hosts",
          "secrets",
          "installed_at",
          "updated_at"
        ]
      },
      "InstalledPluginServer": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PluginServerInfo"
          },
          {
            "type": "object",
            "properties": {
              "integration_id": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "ok",
                  "error"
                ]
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tools": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "risk": {
                      "type": "string",
                      "enum": [
                        "low",
                        "medium",
                        "high"
                      ]
                    }
                  },
                  "required": [
                    "name",
                    "risk"
                  ]
                }
              }
            },
            "required": [
              "integration_id",
              "status",
              "error",
              "tools"
            ]
          }
        ]
      },
      "InstallPluginRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "commit": {
            "type": "string",
            "pattern": "^[0-9a-f]{40}$"
          },
          "secrets": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 10000
            }
          }
        },
        "required": [
          "org_id",
          "bot_id",
          "url",
          "commit"
        ]
      },
      "PluginList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Plugin"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "PreviewPluginRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "commit": {
            "type": "string",
            "pattern": "^[0-9a-f]{40}$"
          }
        },
        "required": [
          "org_id",
          "url"
        ]
      },
      "DeletedPlugin": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "UpdatePluginRequest": {
        "type": "object",
        "properties": {
          "commit": {
            "type": "string",
            "pattern": "^[0-9a-f]{40}$"
          },
          "secrets": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 10000
            }
          }
        },
        "required": [
          "commit"
        ]
      },
      "TeachStep": {
        "type": "object",
        "properties": {
          "seq": {
            "type": "integer"
          },
          "kind": {
            "type": "string",
            "enum": [
              "click",
              "type",
              "key",
              "scroll"
            ]
          },
          "x": {
            "type": [
              "integer",
              "null"
            ]
          },
          "y": {
            "type": [
              "integer",
              "null"
            ]
          },
          "button": {
            "type": [
              "integer",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "key": {
            "type": [
              "string",
              "null"
            ]
          },
          "dx": {
            "type": [
              "integer",
              "null"
            ]
          },
          "dy": {
            "type": [
              "integer",
              "null"
            ]
          },
          "secret_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "password": {
            "type": "boolean"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_screenshot": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "seq",
          "kind",
          "x",
          "y",
          "button",
          "text",
          "key",
          "dx",
          "dy",
          "secret_name",
          "password",
          "url",
          "has_screenshot",
          "created_at"
        ]
      },
      "AddTeachStepRequest": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "click",
              "type",
              "key",
              "scroll"
            ]
          },
          "x": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20000
          },
          "y": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20000
          },
          "button": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3
          },
          "text": {
            "type": "string",
            "maxLength": 2000
          },
          "key": {
            "type": "string",
            "maxLength": 40
          },
          "dx": {
            "type": "integer",
            "minimum": -10000,
            "maximum": 10000
          },
          "dy": {
            "type": "integer",
            "minimum": -10000,
            "maximum": 10000
          }
        },
        "required": [
          "kind"
        ]
      },
      "DeletedTeach": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "TeachSession": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "computer_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "recording",
              "drafting",
              "drafted",
              "saved",
              "cancelled",
              "failed"
            ]
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "draft": {
            "$ref": "#/components/schemas/TeachDraft"
          },
          "skill_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeachStep"
            }
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "stopped_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "computer_id",
          "status",
          "conversation_id",
          "draft",
          "skill_id",
          "steps",
          "started_at",
          "stopped_at"
        ]
      },
      "TeachDraft": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "inputs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "secret": {
                  "type": "boolean"
                }
              },
              "required": [
                "name"
              ]
            }
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "name",
          "description",
          "body",
          "inputs",
          "checks"
        ]
      },
      "MarkTeachSecretRequest": {
        "type": "object",
        "properties": {
          "secret_name": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]{0,63}$"
          }
        },
        "required": [
          "secret_name"
        ]
      },
      "SaveTeachResponse": {
        "type": "object",
        "properties": {
          "skill_id": {
            "type": "string",
            "format": "uuid"
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "run_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "skill_id",
          "conversation_id",
          "run_id"
        ]
      },
      "SaveTeachRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_-]{0,62}$"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "body": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50000
          },
          "try_now": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "description",
          "body"
        ]
      },
      "StartTeachRequest": {
        "type": "object",
        "properties": {
          "computer_id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "computer_id",
          "bot_id"
        ]
      },
      "DeletedWatcher": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "WatcherList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Watcher"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "Watcher": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bot_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "page_change",
              "reply",
              "query",
              "time"
            ]
          },
          "target": {
            "type": "object",
            "additionalProperties": {}
          },
          "condition_md": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "done",
              "expired"
            ]
          },
          "check_every_seconds": {
            "type": "integer"
          },
          "fired_count": {
            "type": "integer"
          },
          "last_checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "bot_id",
          "name",
          "kind",
          "target",
          "condition_md",
          "status",
          "check_every_seconds",
          "fired_count",
          "last_checked_at",
          "last_error",
          "expires_at",
          "conversation_id",
          "created_at"
        ]
      },
      "UpdateWatcherRequest": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          }
        },
        "required": [
          "status"
        ]
      },
      "GitSyncStatus": {
        "type": "object",
        "properties": {
          "configured": {
            "type": "boolean"
          },
          "repo": {
            "type": [
              "string",
              "null"
            ]
          },
          "branch": {
            "type": [
              "string",
              "null"
            ]
          },
          "path": {
            "type": [
              "string",
              "null"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "has_token": {
            "type": "boolean"
          },
          "webhook_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "webhook_secret": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_synced_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_commit": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "open_pr_url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "configured",
          "repo",
          "branch",
          "path",
          "enabled",
          "has_token",
          "webhook_url",
          "webhook_secret",
          "last_synced_at",
          "last_commit",
          "last_error",
          "open_pr_url"
        ]
      },
      "WorkspaceFilesExport": {
        "type": "object",
        "properties": {
          "zip_base64": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "content_base64": {
                  "type": "string"
                }
              },
              "required": [
                "path",
                "content_base64"
              ]
            }
          }
        },
        "required": [
          "zip_base64",
          "count",
          "files"
        ]
      },
      "WorkspaceFilesResult": {
        "type": "object",
        "properties": {
          "created": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "updated": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "deleted": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unchanged": {
            "type": "integer"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dry_run": {
            "type": "boolean"
          }
        },
        "required": [
          "created",
          "updated",
          "deleted",
          "unchanged",
          "errors",
          "dry_run"
        ]
      },
      "ImportWorkspaceFilesRequest": {
        "type": "object",
        "properties": {
          "zip_base64": {
            "type": "string",
            "maxLength": 70000000
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                },
                "content_base64": {
                  "type": "string",
                  "maxLength": 14000000
                }
              },
              "required": [
                "path",
                "content_base64"
              ]
            },
            "maxItems": 5000
          },
          "dry_run": {
            "type": "boolean"
          }
        }
      },
      "SetGitSyncRequest": {
        "type": "object",
        "properties": {
          "repo": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$"
          },
          "branch": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "path": {
            "type": "string",
            "maxLength": 200
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "repo"
        ]
      },
      "CreatedMcpKey": {
        "allOf": [
          {
            "$ref": "#/components/schemas/McpKey"
          },
          {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "description": "Shown once; paste it into the AI app as a bearer token"
              },
              "mcp_url": {
                "type": "string"
              }
            },
            "required": [
              "key",
              "mcp_url"
            ]
          }
        ]
      },
      "McpKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "hint": {
            "type": "string"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "hint",
          "last_used_at",
          "created_at"
        ]
      },
      "CreateMcpKeyRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        },
        "required": [
          "name"
        ]
      },
      "McpConsentResult": {
        "type": "object",
        "properties": {
          "redirect_url": {
            "type": "string"
          }
        },
        "required": [
          "redirect_url"
        ]
      },
      "McpConsentRequest": {
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "approve": {
            "type": "boolean"
          }
        },
        "required": [
          "org_id",
          "approve"
        ]
      },
      "McpAuthRequestInfo": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "client_name": {
            "type": "string"
          },
          "redirect_host": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "client_name",
          "redirect_host",
          "expires_at"
        ]
      },
      "McpKeyList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/McpKey"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "RevokedKey": {
        "type": "object",
        "properties": {
          "revoked": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "revoked"
        ]
      },
      "Referral": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "link": {
            "type": [
              "string",
              "null"
            ]
          },
          "reward_usd": {
            "type": "number"
          },
          "welcome_usd": {
            "type": "number"
          },
          "reward_cap": {
            "type": "integer"
          },
          "invited": {
            "type": "integer"
          },
          "rewarded": {
            "type": "integer"
          },
          "pending": {
            "type": "integer"
          },
          "earned_usd": {
            "type": "number"
          },
          "invited_by": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "welcome_earned_usd": {
                "type": [
                  "number",
                  "null"
                ]
              }
            },
            "required": [
              "name",
              "welcome_earned_usd"
            ]
          },
          "redeem_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "enabled",
          "code",
          "link",
          "reward_usd",
          "welcome_usd",
          "reward_cap",
          "invited",
          "rewarded",
          "pending",
          "earned_usd",
          "invited_by",
          "redeem_until"
        ]
      },
      "ReferralPreview": {
        "type": "object",
        "properties": {
          "inviter_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "reward_usd": {
            "type": "number"
          },
          "welcome_usd": {
            "type": "number"
          }
        },
        "required": [
          "inviter_name",
          "reward_usd",
          "welcome_usd"
        ]
      },
      "RedeemReferralRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "code"
        ]
      }
    },
    "parameters": {}
  },
  "paths": {
    "/v1/config": {
      "get": {
        "operationId": "getConfig",
        "tags": [
          "system"
        ],
        "summary": "Public client configuration (no auth)",
        "responses": {
          "200": {
            "description": "Client configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicConfig"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signup/challenge": {
      "get": {
        "operationId": "getSignupChallenge",
        "tags": [
          "system"
        ],
        "summary": "A proof-of-work puzzle for signing up when the server asks for one (no auth)",
        "responses": {
          "200": {
            "description": "Challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignupChallenge"
                }
              }
            }
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "operationId": "healthz",
        "tags": [
          "system"
        ],
        "responses": {
          "200": {
            "description": "Process is up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          }
        }
      }
    },
    "/readyz": {
      "get": {
        "operationId": "readyz",
        "tags": [
          "system"
        ],
        "responses": {
          "200": {
            "description": "Dependencies reachable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          },
          "503": {
            "description": "Not ready",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          }
        }
      }
    },
    "/v1/support/tickets": {
      "post": {
        "operationId": "createSupportTicket",
        "tags": [
          "support"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Send a message to the support team",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportTicketRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportTicket"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/support": {
      "get": {
        "operationId": "getSupportConfig",
        "tags": [
          "support"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "What help this server offers",
        "responses": {
          "200": {
            "description": "Support",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportConfig"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/support-tickets": {
      "get": {
        "operationId": "listSupportTickets",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Messages sent to support from the app, newest first (instance owners)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "closed",
                "all"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Tickets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportTicketList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/support-tickets/{reference}": {
      "post": {
        "operationId": "setSupportTicketStatus",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Mark a support message closed or open again",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 20
            },
            "required": true,
            "name": "reference",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetSupportTicketStatus"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ticket",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportTicketRow"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/support/chat": {
      "post": {
        "operationId": "supportChat",
        "tags": [
          "support"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Ask the support assistant",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportChatRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The assistant's answer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportChatReply"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/blocks": {
      "post": {
        "operationId": "blockPerson",
        "tags": [
          "moderation"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Block someone: no invites or agent links from them, and their messages hidden",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BlockRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Blocked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlockedPerson"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listBlocks",
        "tags": [
          "moderation"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "People you blocked",
        "responses": {
          "200": {
            "description": "Blocked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlockedPersonList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports": {
      "post": {
        "operationId": "createReport",
        "tags": [
          "moderation"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Report something or someone to the people who run this server",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/email-preferences": {
      "get": {
        "operationId": "getEmailPreferences",
        "tags": [
          "account"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Email preferences",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailPreferences"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setEmailPreferences",
        "tags": [
          "account"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailPreferences"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Email preferences",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailPreferences"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/content-reports": {
      "get": {
        "operationId": "listContentReports",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Reports from inside the app, open first (instance owners)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "actioned",
                "dismissed",
                "all"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Reports",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContentReportList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/content-reports/{id}": {
      "post": {
        "operationId": "reviewContentReport",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Close a report: acted on (optionally suspending the workspace) or dismissed",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewReportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContentReport"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/blocks/{user_id}": {
      "delete": {
        "operationId": "unblockPerson",
        "tags": [
          "moderation"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "user_id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Unblocked"
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invites/{token}/accept": {
      "post": {
        "operationId": "acceptInvite",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Join an organization with an invite token",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 256
            },
            "required": true,
            "name": "token",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Joined",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Membership"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invite-links/{token}/accept": {
      "post": {
        "operationId": "acceptInviteLink",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Join a workspace with an invite link",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 256
            },
            "required": true,
            "name": "token",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Joined",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationWithRole"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/invites": {
      "post": {
        "operationId": "createInvite",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Invite someone by email (owners and admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInviteRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Invite created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invite"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listInvites",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Email invites not yet accepted (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Pending invites",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PendingInviteList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/invite-codes": {
      "post": {
        "operationId": "createInviteCode",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A short invite code to read out or type, valid for 48 hours (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInviteCodeRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedInviteLink"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/invite-links": {
      "post": {
        "operationId": "createInviteLink",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create a shareable invite link (admins); the token is shown once",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInviteLinkRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedInviteLink"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listInviteLinks",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Invite links (admins)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InviteLinkList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/invites/batch": {
      "post": {
        "operationId": "createInvites",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Invite several people by email at once (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvitesRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Invites",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InviteList"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs": {
      "post": {
        "operationId": "createOrg",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create an organization; the caller becomes its owner",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrganizationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Organization"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listOrgs",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Organizations the user belongs to",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/join-requests/{request_id}": {
      "post": {
        "operationId": "decideJoinRequest",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Approve or decline a request to join (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "request_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecideJoinRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Decided",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JoinRequest"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/default-invite": {
      "get": {
        "operationId": "getDefaultInvite",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The workspace's standing invite link (admins); made on first use",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedInviteLink"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateDefaultInvite",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Make the standing link ask an admin first, or reset it (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDefaultInviteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedInviteLink"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/join-domains": {
      "get": {
        "operationId": "getJoinDomains",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Email domains whose verified addresses can join without an invite (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Domains",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JoinDomains"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setJoinDomain",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Let people with a verified address at your own email domain join (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetJoinDomainRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Domains",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JoinDomains"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "getMe",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The signed-in user and their organizations",
        "responses": {
          "200": {
            "description": "Current user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteMyAccount",
        "tags": [
          "privacy"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Delete your account: you are signed out now, and your data, workspaces you solely own and their computer snapshots are purged after the grace period",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteAccountRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scheduled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDeletion"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/join": {
      "post": {
        "operationId": "joinByDomain",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Join a workspace open to your verified email domain",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Joined",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationWithRole"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/join": {
      "post": {
        "operationId": "joinWithInvite",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Join with an invite link, code or email invite (or ask to join)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JoinRequestBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JoinResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/join-requests": {
      "get": {
        "operationId": "listJoinRequests",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "People waiting to join (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Pending requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JoinRequestList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/joinable-workspaces": {
      "get": {
        "operationId": "listJoinableWorkspaces",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Workspaces open to the signed-in person's verified email domain",
        "responses": {
          "200": {
            "description": "Workspaces",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JoinableWorkspaceList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/join/preview": {
      "get": {
        "operationId": "previewInvite",
        "tags": [
          "workspaces"
        ],
        "summary": "What an invite link, code or email invite opens, before joining (no sign-in needed)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 6,
              "maxLength": 512
            },
            "required": true,
            "name": "invite",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Preview",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitePreview"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/invites/{invite_id}/resend": {
      "post": {
        "operationId": "resendInvite",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Send an email invite again with a new link, valid 7 more days (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "invite_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Resent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invite"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/invites/{invite_id}": {
      "delete": {
        "operationId": "revokeInvite",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "invite_id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked"
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/invite-links/{link_id}": {
      "delete": {
        "operationId": "revokeInviteLink",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "link_id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked"
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}": {
      "patch": {
        "operationId": "updateOrg",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Rename a workspace or change its icon and color (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrganizationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Organization"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/badges": {
      "get": {
        "operationId": "workspaceBadges",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Pending approvals and unread notifications per workspace",
        "responses": {
          "200": {
            "description": "Badges",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceBadgeList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/runs/{id}/cancel": {
      "post": {
        "operationId": "cancelRun",
        "tags": [
          "runs"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Cancel a run and its subruns",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "202": {
            "description": "Cancellation requested",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/credentials/chatgpt/complete": {
      "post": {
        "operationId": "completeChatGptSignIn",
        "tags": [
          "credentials"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Finish ChatGPT sign-in; the server exchanges the code and keeps the tokens in Vault",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatGptSignInCompleteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Connected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Credential"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots": {
      "post": {
        "operationId": "createBot",
        "tags": [
          "bots"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBotRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Bot"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listBots",
        "tags": [
          "bots"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "true lists only archived bots (default: active bots)"
            },
            "required": false,
            "description": "true lists only archived bots (default: active bots)",
            "name": "archived",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Bots you can access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversations": {
      "post": {
        "operationId": "createConversation",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConversationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Conversation"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/credentials": {
      "post": {
        "operationId": "createCredential",
        "tags": [
          "credentials"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Store a model key in Vault; returns metadata only",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCredentialRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Credential"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listCredentials",
        "tags": [
          "credentials"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Credential metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CredentialList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/conversations": {
      "delete": {
        "operationId": "deleteBotConversations",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Delete every direct conversation with a bot that you may delete",
        "description": "Yours, or all of them if you manage the bot. Group chats and conversations the bot is still working in are left alone. What the bot made stays in the Library unless with_creations is true.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "true also deletes what the bot made in these chats (D-274)"
            },
            "required": false,
            "description": "true also deletes what the bot made in these chats (D-274)",
            "name": "with_creations",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedConversations"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listConversations",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Newest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversations/{id}": {
      "delete": {
        "operationId": "deleteConversation",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Delete a conversation and its messages",
        "description": "Only the person who started it or someone who manages its bot. Usage records, what the bot remembered and what it made (the Library, D-274) stay, unless with_creations is true. Refused with 409 while the bot is working in it.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "true also deletes what the bot made in these chats (D-274)"
            },
            "required": false,
            "description": "true also deletes what the bot made in these chats (D-274)",
            "name": "with_creations",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedConversation"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateConversation",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Rename or pin a conversation",
        "description": "Only the person who started it or someone who manages its bot.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateConversationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Conversation"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/credentials/{id}": {
      "delete": {
        "operationId": "deleteCredential",
        "tags": [
          "credentials"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Delete a credential and its Vault secret (a ChatGPT sign-in is revoked first)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateCredential",
        "tags": [
          "credentials"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Rename a credential or change its settings",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCredentialRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Credential"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/memories/{memoryId}": {
      "delete": {
        "operationId": "deleteMemory",
        "tags": [
          "memory"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "required": true,
            "name": "memoryId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedMemory"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateMemory",
        "tags": [
          "memory"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "required": true,
            "name": "memoryId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMemoryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Memory",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Memory"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/memory-backend": {
      "delete": {
        "operationId": "deleteMemoryBackend",
        "tags": [
          "memory"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Go back to the built-in memory (memories in the provider stay there)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Backend",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryBackend"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getMemoryBackend",
        "tags": [
          "memory"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Backend",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryBackend"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setMemoryBackend",
        "tags": [
          "memory"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Keep bot memory in Honcho or Supermemory with the workspace's own key (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetMemoryBackendRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Backend",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryBackend"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversations/{id}/messages/{message_id}": {
      "delete": {
        "operationId": "deleteMessage",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Delete one message from a conversation",
        "description": "Your own message, or any message in a chat you may delete (you started it, or you manage its bot). The messages after it stay, joined to the one before it. What a bot made stays in the Library. Refused with 409 while the bot is working in the chat.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "message_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedMessage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversations/{id}/messages/{message_id}/edit": {
      "post": {
        "operationId": "editMessage",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Edit a sent message: forks the conversation there and reruns it (the old branch stays)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "message_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditMessageRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Run started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendMessageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/a2a": {
      "get": {
        "operationId": "getBotA2a",
        "tags": [
          "a2a"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "A2A",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotA2a"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setBotA2a",
        "tags": [
          "a2a"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Publish a bot as an A2A agent (the workspace must have A2A on)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetBotA2aRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A2A",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotA2a"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversations/{id}/thread": {
      "get": {
        "operationId": "getConversationThread",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The branch being shown, oldest first (what conversation_thread returns, with content opened)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "description": "Only the messages people read (user and assistant), the newest `limit` of them. Without it: the whole branch, every role"
            },
            "required": false,
            "description": "Only the messages people read (user and assistant), the newest `limit` of them. Without it: the whole branch, every role",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "With `limit`: the page just before this message"
            },
            "required": false,
            "description": "With `limit`: the page just before this message",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "With `limit`: the newest messages back to this one and half a page before it (a search hit)"
            },
            "required": false,
            "description": "With `limit`: the newest messages back to this one and half a page before it (a search hit)",
            "name": "around",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Messages",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationThread"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/runs/{id}": {
      "get": {
        "operationId": "getRun",
        "tags": [
          "runs"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Run",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/runs/{id}/usage": {
      "get": {
        "operationId": "getRunUsage",
        "tags": [
          "runs"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "What a run and its subruns cost, broken down by what was metered",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Run usage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunUsage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "operationId": "getUsage",
        "tags": [
          "usage"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "week",
                "month",
                "year"
              ]
            },
            "required": false,
            "name": "period",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Usage and cost by bot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageReport"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/credentials/{id}/models": {
      "get": {
        "operationId": "listCredentialModels",
        "tags": [
          "credentials"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Models this key can use, recommended ones first",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Models",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelOptionList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/group-chats": {
      "get": {
        "operationId": "listGroupChats",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Group chats in a workspace that you can see",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Group chats",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GroupChatList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/memories": {
      "get": {
        "operationId": "listMemories",
        "tags": [
          "memory"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 500
            },
            "required": false,
            "name": "q",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Memories, pinned first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/runs/{id}/events": {
      "get": {
        "operationId": "listRunEvents",
        "tags": [
          "runs"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Events after a seq. Send Accept: text/event-stream to keep streaming live events (SSE).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0
            },
            "required": false,
            "name": "after_seq",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "required": false,
            "name": "limit",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Events in seq order (JSON), or a server-sent event stream",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunEventsPage"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "event: run_event, data: RunEventEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversations/{id}/messages": {
      "post": {
        "operationId": "sendMessage",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Send a message; starts a run",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessageRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Run started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendMessageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/setup": {
      "post": {
        "operationId": "startBotSetup",
        "tags": [
          "bots"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Start (or rerun) the bot's setup interview in a new conversation",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "201": {
            "description": "Started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartSetupResponse"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/credentials/chatgpt/start": {
      "post": {
        "operationId": "startChatGptSignIn",
        "tags": [
          "credentials"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Begin ChatGPT sign-in; returns the authorize URL for a loopback callback",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatGptSignInStartRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sign-in started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatGptSignInStart"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/welcome": {
      "post": {
        "operationId": "startWelcome",
        "tags": [
          "bots"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A new person's personal workspace, bot and welcome chat; the same chat again if it exists",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartWelcomeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Welcome chat",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WelcomeChat"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversations/{id}/branch": {
      "post": {
        "operationId": "switchBranch",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Show another branch of the conversation (its newest message under the given one)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SwitchBranchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Head",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SwitchBranchResponse"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/credentials/{id}/test": {
      "post": {
        "operationId": "testCredential",
        "tags": [
          "credentials"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Validate a key with a 1-token call",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestCredentialRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CredentialTestResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/storage/clean": {
      "post": {
        "operationId": "cleanComputerStorage",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Free up space: removes caches and temporary files (never files in ~/workspace)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Cleaned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CleanStorageResult"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/bots": {
      "get": {
        "operationId": "computerBots",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The bots that use this computer",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Bots",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComputerBotList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/files/pdf-preview": {
      "get": {
        "operationId": "computerFilePdfPreview",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A document (Word, Excel, PowerPoint, OpenDocument, RTF) as a PDF, for previewing",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4000
            },
            "required": true,
            "name": "path",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The document as a PDF",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "This kind of file has no PDF preview, or the computer can't make one",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The conversion failed or took too long",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/files/thumbnail": {
      "get": {
        "operationId": "computerFileThumbnail",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A small JPEG or PNG of a video's first frame, an image or a PDF's first page",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4000
            },
            "required": true,
            "name": "path",
            "in": "query"
          },
          {
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "example": 480
            },
            "required": false,
            "name": "size",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The thumbnail. `x-duration-ms` carries a video's length and `x-file-mtime` the file's modified time (ms) when known.",
            "content": {
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No thumbnail for this file (missing, unsupported, or the computer can't make one)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The computer is asleep, stopped or offline (thumbnail_unavailable); it isn't woken",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/history": {
      "get": {
        "operationId": "computerHistory",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "What happened to the computer, newest first",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "History",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComputerHistory"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/screenshot": {
      "get": {
        "operationId": "computerScreenshot",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "PNG of the desktop, or of the bot's browser page on headless computers",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "PNG image",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/storage": {
      "get": {
        "operationId": "computerStorage",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "What takes up the home folder. Never wakes the computer.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Storage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComputerStorage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The computer is asleep or stopped (computer_not_running); it isn't woken for this",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/stream": {
      "get": {
        "operationId": "computerStream",
        "tags": [
          "computers"
        ],
        "summary": "WebSocket live-view signaling (Neko protocol). Authenticated by the stream-session token; input is accepted only in control mode while you hold the lease.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "token",
            "in": "query"
          }
        ],
        "responses": {
          "101": {
            "description": "Switching to WebSocket"
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/terminal": {
      "get": {
        "operationId": "computerTerminal",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "WebSocket terminal. Binary frames carry terminal bytes both ways. Browsers may pass the access token as ?access_token=.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "required": false,
            "name": "cols",
            "in": "query"
          },
          {
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "required": false,
            "name": "rows",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "access_token",
            "in": "query"
          }
        ],
        "responses": {
          "101": {
            "description": "Switching to WebSocket"
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/usage": {
      "get": {
        "operationId": "computerUsage",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Time on and its cost this month, by day",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Usage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComputerUsage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/vitals": {
      "get": {
        "operationId": "computerVitals",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "CPU, memory and disk right now. Never wakes the computer or counts as activity.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Vitals",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComputerVitals"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The computer is asleep or stopped (computer_not_running); it isn't woken for this",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/checkpoints": {
      "post": {
        "operationId": "createCheckpoint",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCheckpointRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Checkpoint"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listCheckpoints",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Newest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckpointList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers": {
      "post": {
        "operationId": "createComputer",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create a private computer for a bot (or the team computer if it was removed)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateComputerRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Computer"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listComputers",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Computers you can use",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComputerList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/stream-session": {
      "post": {
        "operationId": "createStreamSession",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Get a 5-minute live-view session (signaling URL, token, TURN credentials)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StreamSessionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StreamSession"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}": {
      "delete": {
        "operationId": "deleteComputer",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Delete a computer and its files, snapshots and checkpoints",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedComputer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getComputer",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Computer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Computer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateComputer",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateComputerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Computer"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/files": {
      "delete": {
        "operationId": "deleteComputerFile",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4000
            },
            "required": true,
            "name": "path",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteResult"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "downloadComputerFile",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Download a file",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4000
            },
            "required": true,
            "name": "path",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "File contents",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "uploadComputerFile",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Upload a file (request body is the raw contents, up to 100 MB)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4000
            },
            "required": true,
            "name": "path",
            "in": "query"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Uploaded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/takeovers/{id}/dismiss": {
      "post": {
        "operationId": "dismissTakeover",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Decline a takeover request; the bot continues without help",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReleaseLeaseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dismissed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TakeoverRequest"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/files/archive": {
      "get": {
        "operationId": "downloadComputerArchive",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Download every file in ~/workspace as one .zip (up to 1 GB)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "A zip file",
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Over 1 GB (archive_too_large)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "There are no files (nothing_to_download)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/lease": {
      "get": {
        "operationId": "getLease",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Who controls the screen (the bot unless a person took over)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Lease",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Lease"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "releaseLease",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Hand control back to the bot, optionally with a note",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReleaseLeaseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lease",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Lease"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "takeLease",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Take control (or renew it). The bot pauses screen actions; control returns after 15 minutes without renewal.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TakeLeaseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lease",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Lease"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/files/list": {
      "get": {
        "operationId": "listComputerFiles",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "List a directory (default ~/workspace)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 4000
            },
            "required": false,
            "name": "path",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Entries",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComputerFileList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/processes": {
      "get": {
        "operationId": "listComputerProcesses",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Programs running now, busiest first. Never wakes the computer.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Processes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComputerProcessList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The computer is asleep or stopped (computer_not_running); it isn't woken for this",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/takeovers": {
      "get": {
        "operationId": "listTakeovers",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Open requests from bots for a person to take over a screen",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Takeover requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TakeoverRequestList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/reset": {
      "post": {
        "operationId": "resetComputer",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Reset the computer in the background: a restore point, then a fresh system (and, to erase, an empty home folder). Follow `operation` on the computer.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResetComputerRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Computer"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/restart": {
      "post": {
        "operationId": "restartComputer",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Sleep and start again with the same files",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Computer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Computer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/checkpoints/{cid}/restore": {
      "post": {
        "operationId": "restoreCheckpoint",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Undo to a checkpoint (replaces the home directory)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "cid",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Computer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Computer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/start": {
      "post": {
        "operationId": "startComputer",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Start or restore the computer",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Computer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Computer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/stop": {
      "post": {
        "operationId": "stopComputer",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Save the home directory to storage and stop (sleep)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Computer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Computer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/computers/{id}/processes/{pid}/stop": {
      "post": {
        "operationId": "stopComputerProcess",
        "tags": [
          "computers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Stop a program (asks it to quit, then forces it after 3 seconds)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 2
            },
            "required": true,
            "name": "pid",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Stopped",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoppedProcess"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The computer is asleep or stopped (computer_not_running); it isn't woken for this",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/creations/{id}": {
      "delete": {
        "operationId": "deleteCreation",
        "tags": [
          "creations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Hides it now; the bytes go after 30 days unless it's restored",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Creation"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getCreation",
        "tags": [
          "creations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Creation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreationDetail"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateCreation",
        "tags": [
          "creations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Rename, relabel, pin or mark opened",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCreationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Creation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Creation"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/creations/{id}/duplicate": {
      "post": {
        "operationId": "duplicateCreation",
        "tags": [
          "creations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A private copy to change while the original stays as it is (D-291)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "201": {
            "description": "The copy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Creation"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/creations/{id}/content": {
      "get": {
        "operationId": "getCreationContent",
        "tags": [
          "creations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The bytes (pictures, videos, sound; one byte range honoured). Pages open by view link",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Contents",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "A byte range",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/creations/{id}/cover": {
      "get": {
        "operationId": "getCreationCover",
        "tags": [
          "creations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The picture for its card, when it has one (has_cover)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Cover",
            "content": {
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/creations/{id}/preview": {
      "get": {
        "operationId": "getCreationPreview",
        "tags": [
          "creations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A PDF of a document, made when it was kept, so it opens without its computer (D-280)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "PDF",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/creations": {
      "get": {
        "operationId": "listCreations",
        "tags": [
          "creations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The Library: things bots made that you can open, newest first (D-274)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          },
          {
            "schema": {
              "$ref": "#/components/schemas/CreationKind"
            },
            "required": false,
            "name": "kind",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": false,
            "name": "bot_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": false,
            "name": "conversation_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": false,
            "name": "project_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "required": false,
            "name": "pinned",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "new",
                "opened"
              ],
              "description": "new (default) or recently opened"
            },
            "required": false,
            "description": "new (default) or recently opened",
            "name": "sort",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "true lists what was deleted in the last 30 days (for Undo)"
            },
            "required": false,
            "description": "true lists what was deleted in the last 30 days (for Undo)",
            "name": "deleted",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "required": false,
            "name": "q",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "required": false,
            "name": "limit",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Creations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreationList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/creations/{id}/restore": {
      "post": {
        "operationId": "restoreCreation",
        "tags": [
          "creations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Restored",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Creation"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversations/{id}/export": {
      "get": {
        "operationId": "exportConversation",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Download a chat as Markdown or JSON (D-282)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "markdown",
                "json"
              ]
            },
            "required": false,
            "name": "format",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The chat",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversations/{id}/share": {
      "post": {
        "operationId": "shareConversation",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Make or stop a public read-only link to a chat (D-282)",
        "description": "Only the person who started it or someone who manages its bot. Making it public again gives a new link. A private chat (personal device data) can't be shared: 409.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShareConversationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Shared",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShareConversationResponse"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/media/{id}": {
      "get": {
        "operationId": "getChatMedia",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A chat file's bytes, in its own content type; one byte range honoured (cached for good)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "One byte range, e.g. bytes=0-1023"
            },
            "required": false,
            "description": "One byte range, e.g. bytes=0-1023",
            "name": "range",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "A byte range",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "416": {
            "description": "The range is outside the file"
          }
        }
      }
    },
    "/v1/media/{id}/poster": {
      "get": {
        "operationId": "getChatMediaPoster",
        "tags": [
          "chat"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A video's poster (a JPEG still) for its chat card; 404 for other files (cached for good)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Poster",
            "content": {
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/integrations": {
      "post": {
        "operationId": "attachIntegration",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Let a bot use an integration's tools (optionally only some)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AttachIntegrationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Attached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations": {
      "post": {
        "operationId": "createIntegration",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Add an MCP server, OpenAPI source, Composio or Pipedream Connect",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateIntegrationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Integration"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listIntegrations",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Integrations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/routines": {
      "post": {
        "operationId": "createRoutine",
        "tags": [
          "routines"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Schedule a routine (cron in a timezone) or create a GitHub/custom webhook trigger",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRoutineRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedRoutine"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/secrets": {
      "post": {
        "operationId": "createSecret",
        "tags": [
          "secrets"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create a named secret with allowed hosts (value stored in Vault)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "Retries with the same key return the first result"
            },
            "required": false,
            "description": "Retries with the same key return the first result",
            "name": "idempotency-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSecretRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Secret"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listSecrets",
        "tags": [
          "secrets"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Secret metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks": {
      "post": {
        "operationId": "createTask",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create a ticket; assigning a bot starts its work",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTaskRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listTasks",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": false,
            "name": "project_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The shared task board",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}/comments": {
      "post": {
        "operationId": "createTaskComment",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Comment on a ticket; a comment on a bot's ticket wakes that bot",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTaskCommentRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Posted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskComment"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listTaskComments",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Comments, oldest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskCommentList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/hooks/custom/{routine_id}": {
      "post": {
        "operationId": "customWebhook",
        "tags": [
          "webhooks"
        ],
        "summary": "Custom webhook for a routine (X-Casama-Signature: sha256=HMAC-SHA256 of the body)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "routine_id",
            "in": "path"
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted for verification",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Accepted"
                }
              }
            }
          },
          "413": {
            "description": "Body too large"
          }
        }
      }
    },
    "/v1/approvals/{id}/decision": {
      "post": {
        "operationId": "decideApproval",
        "tags": [
          "approvals"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Approve or deny; denying cancels that step only",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApprovalDecisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Decided",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Approval"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/secrets/requests/{id}/decline": {
      "post": {
        "operationId": "declineSecretRequest",
        "tags": [
          "secrets"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Decline a bot's request for a secret; the bot continues without it",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Declined",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotSecretRequest"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/routines/{id}": {
      "delete": {
        "operationId": "deleteRoutine",
        "tags": [
          "routines"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Delete a routine (its past runs and conversation are kept)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedRoutine"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateRoutine",
        "tags": [
          "routines"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRoutineRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Routine"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/secrets/{id}": {
      "delete": {
        "operationId": "deleteSecret",
        "tags": [
          "secrets"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedId"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}": {
      "delete": {
        "operationId": "deleteTask",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateTask",
        "tags": [
          "tasks"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Change a ticket (moving, reassigning, editing); a newly assigned bot starts its work",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTaskRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/secrets/requests/{id}/fulfill": {
      "post": {
        "operationId": "fulfillSecretRequest",
        "tags": [
          "secrets"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Save the value a bot asked for (into Vault, for that bot and those hosts only)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FulfillSecretRequestBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Fulfilled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotSecretRequest"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/hooks/github/{routine_id}": {
      "post": {
        "operationId": "githubWebhook",
        "tags": [
          "webhooks"
        ],
        "summary": "GitHub webhook for a routine (X-Hub-Signature-256)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "routine_id",
            "in": "path"
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted for verification",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Accepted"
                }
              }
            }
          },
          "413": {
            "description": "Body too large"
          }
        }
      }
    },
    "/v1/approvals": {
      "get": {
        "operationId": "listApprovals",
        "tags": [
          "approvals"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "approved",
                "denied",
                "expired"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Newest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/routines": {
      "get": {
        "operationId": "listRoutines",
        "tags": [
          "routines"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Routines",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutineList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/secrets/requests": {
      "get": {
        "operationId": "listSecretRequests",
        "tags": [
          "secrets"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Bots waiting for a secret (pending requests you can see)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Secret requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotSecretRequestList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates": {
      "get": {
        "operationId": "listTemplates",
        "tags": [
          "bots"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Starter bots",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/routines/{id}/run": {
      "post": {
        "operationId": "runRoutine",
        "tags": [
          "routines"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Run a routine now",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "202": {
            "description": "Started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunStarted"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/{id}/test": {
      "post": {
        "operationId": "testIntegration",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "List tools to prove the connection works (refreshes the tool cache)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationTestResult"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/calls/{id}/answer": {
      "post": {
        "operationId": "answerVoiceCall",
        "tags": [
          "voice"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Answer a call; then start a voice session with its call_id",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PhoneCall"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/voice/session": {
      "post": {
        "operationId": "createVoiceSession",
        "tags": [
          "voice"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Start a live call: mints an ephemeral realtime key with the bot's persona and tools",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoiceSessionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceSession"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/calls/{id}/decline": {
      "post": {
        "operationId": "declineVoiceCall",
        "tags": [
          "voice"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Decline a call; the reason arrives as a normal notification",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PhoneCall"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/calls/{id}": {
      "get": {
        "operationId": "getVoiceCall",
        "tags": [
          "voice"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PhoneCall"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/calls/ringing": {
      "get": {
        "operationId": "listRingingCalls",
        "tags": [
          "voice"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Calls ringing for you now (the in-app banner on desktop and web)",
        "responses": {
          "200": {
            "description": "Calls",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PhoneCallList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages/{id}/speech": {
      "get": {
        "operationId": "messageSpeech",
        "tags": [
          "voice"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Read aloud: MP3 audio of an assistant message (cached per voice)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "MP3 audio",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/voice/transcript": {
      "post": {
        "operationId": "saveVoiceTranscript",
        "tags": [
          "voice"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Save a call's transcript to the conversation and record its duration",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoiceTranscriptRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedCount"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/voice/transcribe": {
      "post": {
        "operationId": "transcribeAudio",
        "tags": [
          "voice"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Dictation: send recorded audio (raw body, audio/* content type, up to 10 MB)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "bot_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 10
            },
            "required": false,
            "name": "language",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transcription"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/voice/tool": {
      "post": {
        "operationId": "voiceTool",
        "tags": [
          "voice"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Run a tool call from a live call as an agent run (same approvals); waits up to 25 s",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoiceToolRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/local-devices": {
      "post": {
        "operationId": "createLocalDevice",
        "tags": [
          "local computer"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Pair this machine as a bot computer (desktop companion); returns a device token once",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLocalDeviceRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Paired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedLocalDevice"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listLocalDevices",
        "tags": [
          "local computer"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Your devices (admins see all)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LocalDeviceList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/local-devices/{id}": {
      "delete": {
        "operationId": "deleteLocalDevice",
        "tags": [
          "local computer"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Unpaired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedDevice"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateLocalDevice",
        "tags": [
          "local computer"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Change capabilities, shared folders, allowed bots or turn the device off",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateLocalDeviceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LocalDevice"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/local-computer/connect": {
      "get": {
        "operationId": "localComputerConnect",
        "tags": [
          "local computer"
        ],
        "summary": "WebSocket for the desktop companion (authorization: Device <token>, or ?token=). The API sends tool requests; the app answers from its embedded computerd.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "token",
            "in": "query"
          }
        ],
        "responses": {
          "101": {
            "description": "Switching to WebSocket"
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/local-devices/{id}/mcp-servers": {
      "put": {
        "operationId": "setLocalMcpServers",
        "tags": [
          "local computer"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Register the local MCP servers on this computer (no secrets); each becomes a local_mcp integration",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetLocalMcpServersRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The device's local MCP integrations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LocalMcpIntegrationList"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/abuse": {
      "get": {
        "operationId": "adminAbuseEvents",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Recent abuse signals and actions (owner only)",
        "responses": {
          "200": {
            "description": "Recent abuse signals and actions (owner only)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AbuseEventList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/capacity": {
      "get": {
        "operationId": "adminCapacity",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Server capacity: host memory, computers' share of their budget, 30-day peaks and a forecast (owner only)",
        "responses": {
          "200": {
            "description": "Server capacity: host memory, computers' share of their budget, 30-day peaks and a forecast (owner only)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServerCapacity"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/models": {
      "get": {
        "operationId": "adminCloudModels",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The models Casama Cloud runs (owner only)",
        "responses": {
          "200": {
            "description": "The models Casama Cloud runs (owner only)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CloudModels"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setAdminCloudModels",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Change the models Casama Cloud runs (owner only)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CloudModels"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CloudModels"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/connections": {
      "get": {
        "operationId": "adminConnectionSettings",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "How apps without their own sign-in connect (owner only)",
        "responses": {
          "200": {
            "description": "How apps without their own sign-in connect (owner only)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionSettings"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setAdminConnectionSettings",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Choose how apps without their own sign-in connect (owner only)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetConnectionSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionSettings"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/orgs": {
      "get": {
        "operationId": "adminOrgs",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Workspaces with their limits and spend",
        "responses": {
          "200": {
            "description": "Workspaces with their limits and spend",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminOrgList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/overview": {
      "get": {
        "operationId": "adminOverview",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Instance totals (owner only)",
        "responses": {
          "200": {
            "description": "Instance totals (owner only)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminOverview"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/pricing": {
      "get": {
        "operationId": "adminPricing",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Plans, credit packs and the usage markup (owner only)",
        "responses": {
          "200": {
            "description": "Plans, credit packs and the usage markup (owner only)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminPricing"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/services": {
      "get": {
        "operationId": "adminServices",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Configured providers and system health",
        "responses": {
          "200": {
            "description": "Configured providers and system health",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminServiceList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/updates": {
      "get": {
        "operationId": "adminUpdates",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Whether a newer Casama release exists",
        "responses": {
          "200": {
            "description": "Whether a newer Casama release exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateNotice"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/users": {
      "get": {
        "operationId": "adminUsers",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Everyone on this instance",
        "responses": {
          "200": {
            "description": "Everyone on this instance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminUserList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/reports": {
      "get": {
        "operationId": "listReportedCreations",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Public links people reported, most reported first (owner only; D-281)",
        "responses": {
          "200": {
            "description": "Reports",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportedCreationList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/credit-packs/{code}": {
      "put": {
        "operationId": "saveCreditPack",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create or change a credit pack",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,40}$"
            },
            "required": true,
            "name": "code",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveCreditPackRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminCreditPack"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/plans/{code}": {
      "put": {
        "operationId": "savePlan",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create or change a plan; workspaces on it get the new limits right away",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,40}$"
            },
            "required": true,
            "name": "code",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SavePlanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminPlan"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/billing-settings": {
      "patch": {
        "operationId": "setBillingSettings",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Change the markup on usage paid with Casama's keys",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillingSettings"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingSettings"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/orgs/{id}/limits": {
      "patch": {
        "operationId": "setOrgLimits",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Set a workspace's quotas",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetOrgLimitsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminOrg"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/orgs/{id}/suspend": {
      "post": {
        "operationId": "suspendOrg",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Suspend a workspace: stops its computers and runs, keeps its data",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SuspendOrgRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Suspended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminOrg"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "unsuspendOrg",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Lift a workspace's suspension",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Unsuspended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminOrg"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/creations/{id}/takedown": {
      "post": {
        "operationId": "takeDownCreation",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Stop a creation's public link at once, or lift that (owner only; D-281)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TakeDownRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportedCreation"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/billing/portal": {
      "post": {
        "operationId": "billingPortal",
        "tags": [
          "billing"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Open the customer portal for a web subscription",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Portal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedirectUrl"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/billing/usage": {
      "get": {
        "operationId": "billingUsage",
        "tags": [
          "billing"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "This month's bill: billable usage by kind and instance, and recent credit entries",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Usage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingUsage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/billing/checkout": {
      "post": {
        "operationId": "createCheckout",
        "tags": [
          "billing"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Start a web checkout (Dodo Payments) for a plan or credit pack",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Checkout page, or the plan changed in place",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/link/keys": {
      "post": {
        "operationId": "createLinkKey",
        "tags": [
          "billing"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create a Casama Link key (shown once)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLinkKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedLinkKey"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listLinkKeys",
        "tags": [
          "billing"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Casama Link keys for self-hosted instances",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Keys",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkKeyList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/billing": {
      "get": {
        "operationId": "getBilling",
        "tags": [
          "billing"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The workspace's plan, entitlement, subscriptions and credits",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Billing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingSummary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing/plans": {
      "get": {
        "operationId": "listPlans",
        "tags": [
          "billing"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Plans and credit packs on this server",
        "responses": {
          "200": {
            "description": "Catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanCatalog"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/link/keys/{key_id}": {
      "delete": {
        "operationId": "revokeLinkKey",
        "tags": [
          "billing"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "key_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevokedLinkKey"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/billing/seats": {
      "put": {
        "operationId": "setBillingSeats",
        "tags": [
          "billing"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Pay for more or fewer people than the plan includes (web subscriptions on Pro or Max)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeatsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Billing after the change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingSummary"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/billing/purchases": {
      "post": {
        "operationId": "verifyPurchase",
        "tags": [
          "billing"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Verify an App Store or Google Play purchase (also used by Restore Purchases)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Billing after the purchase",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingSummary"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/link/servers": {
      "get": {
        "operationId": "adminLinkServers",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Every linked server on this cloud (owner only)",
        "responses": {
          "200": {
            "description": "Servers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminLinkServerList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/remote-access": {
      "get": {
        "operationId": "adminRemoteAccess",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "This server's public address through Casama Link, and whether it works (owner only)",
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteAccessStatus"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/link/sign-ins/approve": {
      "post": {
        "operationId": "approveLinkSignIn",
        "tags": [
          "casama-link"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Link the server that shows this code to the workspace (admins)",
        "description": "The server then receives a key that can hold an address and send push notifications. It can't spend the workspace's credits.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApproveLinkSignInRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Linked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovedLinkSignIn"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/remote-access/check": {
      "post": {
        "operationId": "checkRemoteAccess",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Check the address now: Casama Cloud, the connector, and the address from outside",
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteAccessStatus"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/pairing-codes": {
      "post": {
        "operationId": "createSignInCode",
        "tags": [
          "auth"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A one-time code that signs another device in to this account (shown as a QR code)",
        "responses": {
          "201": {
            "description": "Code",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignInCode"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/link/sign-ins/{user_code}": {
      "get": {
        "operationId": "getLinkSignIn",
        "tags": [
          "casama-link"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The server a link code belongs to, shown before approving",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 16
            },
            "required": true,
            "name": "user_code",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Link request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkSignInRequest"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/link/servers": {
      "get": {
        "operationId": "listLinkServers",
        "tags": [
          "casama-link"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Servers linked to the workspace and their addresses (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Servers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkServerList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/pairing-codes/redeem": {
      "post": {
        "operationId": "redeemSignInCode",
        "tags": [
          "auth"
        ],
        "summary": "Trade a scanned code for a one-time sign-in token (no sign-in needed)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedeemSignInCodeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedeemedSignInCode"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/link/servers/{server_id}": {
      "delete": {
        "operationId": "removeLinkServer",
        "tags": [
          "casama-link"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Remove a server's address, also when the server is offline or gone",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "server_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Removed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemovedLinkServer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/remote-access/settings": {
      "put": {
        "operationId": "setRemoteAccessSettings",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Casama Link settings on this server: private notifications (owner only)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetRemoteAccessSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteAccessStatus"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/link/servers/{id}/suspend": {
      "post": {
        "operationId": "suspendLinkServer",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Take a server's address down until the suspension is lifted (owner only)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SuspendLinkServerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Suspended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminLinkServer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "unsuspendLinkServer",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Lift a server's suspension; it gets its tunnel back when it next checks in",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Unsuspended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminLinkServer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/export": {
      "get": {
        "operationId": "exportMyData",
        "tags": [
          "privacy"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Download everything you can see as a ZIP of JSON files",
        "responses": {
          "200": {
            "description": "ZIP archive",
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/settings": {
      "get": {
        "operationId": "getOrgSettings",
        "tags": [
          "privacy"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgSettings"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateOrgSettings",
        "tags": [
          "privacy"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Change workspace settings such as run event retention (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrgSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgSettings"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/two-step/{id}": {
      "patch": {
        "operationId": "renameTwoStepFactor",
        "tags": [
          "privacy"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Rename one of your authenticator apps (two-step sign-in)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Renamed"
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/analytics-opt-out": {
      "post": {
        "operationId": "setAnalyticsOptOut",
        "tags": [
          "privacy"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Update the user's analytics opt-out preference",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "opt_out": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "opt_out"
                ]
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Updated"
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/wallpapers": {
      "get": {
        "operationId": "searchWallpapers",
        "tags": [
          "appearance"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Search wallpaper photos. Only when the server has a photo source configured (config.wallpapers_enabled); 404 otherwise",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "required": false,
            "name": "q",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "required": false,
            "name": "page",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Photos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WallpaperPhotoList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/wallpapers/download": {
      "post": {
        "operationId": "trackWallpaperDownload",
        "tags": [
          "appearance"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Tell the photo source a photo was chosen (Unsplash requires this)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WallpaperDownloadRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Recorded"
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/connect": {
      "post": {
        "operationId": "connectApp",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Connect a built-in app: with an API key at once, or start an OAuth sign-in",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectAppRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Connected, or a sign-in to open",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectAppResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/{id}/provider/connect": {
      "post": {
        "operationId": "connectProviderApp",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Add an app to a Composio or Pipedream connection and start signing in to it",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProviderConnectRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sign-in page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderConnectResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/connect/{id}": {
      "get": {
        "operationId": "connectStatus",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Whether an OAuth sign-in has finished",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectFlowStatus"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/{id}": {
      "delete": {
        "operationId": "deleteIntegration",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Disconnect: removes it from every bot and deletes its stored credential",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateIntegration",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIntegrationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Integration"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps": {
      "get": {
        "operationId": "listApps",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Built-in apps (vendors' hosted MCP servers) people can connect in one step",
        "responses": {
          "200": {
            "description": "Catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppCatalog"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/{id}/provider/accounts": {
      "get": {
        "operationId": "listProviderAccounts",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Accounts signed in through a Composio or Pipedream connection",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Accounts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderAccountList"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/{id}/provider/apps": {
      "get": {
        "operationId": "listProviderApps",
        "tags": [
          "integrations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Search a Composio or Pipedream connection's app directory",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "required": false,
            "name": "q",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Apps",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderAppList"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/search": {
      "get": {
        "operationId": "search",
        "tags": [
          "search"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Search messages, chats, memories, skills, routines, tickets and files in a workspace",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 200
            },
            "required": true,
            "name": "q",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "Also search file names and contents on awake computers (default true)"
            },
            "required": false,
            "description": "Also search file names and contents on awake computers (default true)",
            "name": "files",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^(message|chat|memory|skill|routine|ticket|file)(,(message|chat|memory|skill|routine|ticket|file))*$",
              "description": "Only these kinds, comma-separated (message, chat, memory, skill, routine, ticket, file). A scoped search returns up to 25 of each kind instead of 8; files are searched only when `file` is listed."
            },
            "required": false,
            "description": "Only these kinds, comma-separated (message, chat, memory, skill, routine, ticket, file). A scoped search returns up to 25 of each kind instead of 8; files are searched only when `file` is listed.",
            "name": "kinds",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Results grouped by kind",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/skills/{id}/update": {
      "post": {
        "operationId": "applySkillUpdate",
        "tags": [
          "skills"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Update a GitHub skill to a newer commit (after reviewing the diff)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplySkillUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstalledSkill"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "checkSkillUpdate",
        "tags": [
          "skills"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Compare a GitHub skill with its source's latest commit (diff before updating)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Update check",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillUpdateCheck"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/skills/catalog": {
      "get": {
        "operationId": "getSkillCatalog",
        "tags": [
          "skills"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The curated skills that ship with this server",
        "responses": {
          "200": {
            "description": "Catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillCatalog"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/skills/install": {
      "post": {
        "operationId": "installCatalogSkill",
        "tags": [
          "skills"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Install a catalog skill to the workspace (admins) or one bot (its managers)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InstallCatalogSkillRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Installed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstalledSkill"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/skills/github/install": {
      "post": {
        "operationId": "installGitHubSkill",
        "tags": [
          "skills"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Install a GitHub skill pinned to the previewed commit",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InstallGitHubSkillRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Installed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstalledSkill"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/skills/github/preview": {
      "post": {
        "operationId": "previewGitHubSkill",
        "tags": [
          "skills"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Read a skill folder from GitHub at its latest commit and show its files before installing",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GitHubSkillPreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preview",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubSkillPreview"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/share": {
      "post": {
        "operationId": "createBotShare",
        "tags": [
          "bots"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Make a share link for a bot template (a snapshot; anyone signed in with the link can import it)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBotShareRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotShareLink"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/export": {
      "get": {
        "operationId": "exportBot",
        "tags": [
          "bots"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A bot as a shareable template file (no secrets; memories only when asked)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "required": false,
            "name": "memories",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotTemplateFile"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bot-shares/{token}": {
      "get": {
        "operationId": "getBotShare",
        "tags": [
          "bots"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Read a shared bot template, to preview before importing",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 100
            },
            "required": true,
            "name": "token",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotTemplateFile"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/import": {
      "post": {
        "operationId": "importBot",
        "tags": [
          "bots"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create a bot from a template file",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportBotRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Imported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportBotResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/projects/{id}/plan/approve": {
      "post": {
        "operationId": "approveProjectPlan",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Approve the proposed plan; sessions start",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Project",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/projects": {
      "post": {
        "operationId": "createProject",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Start a project: one you work on together in its chat, or one its lead bot plans for your approval and then works on by itself",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listProjects",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Projects",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/projects/{id}": {
      "get": {
        "operationId": "getProject",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Project",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectDetail"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateProject",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Pause, resume, cancel or finish a project, change its goal, budget, deadline or plan, or switch working by itself on or off",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Project",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/projects/{id}/milestones/{milestone_id}/signoff": {
      "post": {
        "operationId": "signOffMilestone",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Sign off a finished milestone so the next one begins",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "milestone_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Project",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/suggestions/{id}/accept": {
      "post": {
        "operationId": "acceptSuggestion",
        "tags": [
          "checkins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Have the bot do it, through normal approvals",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "202": {
            "description": "Started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AcceptedSuggestion"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/suggestions/{id}/dismiss": {
      "post": {
        "operationId": "dismissSuggestion",
        "tags": [
          "checkins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DismissSuggestionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dismissed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/checkins": {
      "get": {
        "operationId": "getBotCheckins",
        "tags": [
          "checkins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Check-in settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotCheckins"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setBotCheckins",
        "tags": [
          "checkins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Turn a bot's morning brief and scans on or off, and set their times and daily cap",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BotCheckins"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Check-in settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotCheckins"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/for-you": {
      "get": {
        "operationId": "getForYou",
        "tags": [
          "checkins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Your feed in a workspace: the latest briefs, pending suggestions and approvals",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Feed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForYou"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/action-rules": {
      "post": {
        "operationId": "createActionRule",
        "tags": [
          "action-rules"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateActionRuleRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionRule"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listActionRules",
        "tags": [
          "action-rules"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A bot's rules plus the workspace's (or only the workspace's without bot_id)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": false,
            "name": "bot_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Rules",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionRuleList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/action-rules/{id}": {
      "delete": {
        "operationId": "deleteActionRule",
        "tags": [
          "action-rules"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedRule"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/memory-import/prompt": {
      "get": {
        "operationId": "getMemoryImportPrompt",
        "tags": [
          "import"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The prompt to paste into ChatGPT or Claude to get your saved memories",
        "responses": {
          "200": {
            "description": "Prompt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryImportPrompt"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/memory-import/parse": {
      "post": {
        "operationId": "parseMemoryImport",
        "tags": [
          "import"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ParseMemoryImportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Memories",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ParsedMemoryImport"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/memories/import": {
      "post": {
        "operationId": "saveImportedMemories",
        "tags": [
          "import"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Add the memories the person kept",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveImportedMemoriesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedImportedMemories"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agent-imports": {
      "post": {
        "operationId": "startAgentImport",
        "tags": [
          "import"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Read an OpenClaw or Hermes Agent folder into a bot template for review",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartAgentImportRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The mapping",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentImportPlan"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agent-imports/{id}/files": {
      "post": {
        "operationId": "writeAgentImportFiles",
        "tags": [
          "import"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Copy the files nothing mapped to into ~/imported/ on the bot's computer",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WriteAgentImportFilesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Written",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAgentImportFilesResponse"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/knowledge-sources": {
      "post": {
        "operationId": "createKnowledgeSource",
        "tags": [
          "knowledge"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Add files, a website, a GitHub repository or documents from a connection; the worker reads it within a minute",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateKnowledgeSourceRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Source",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeSource"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listKnowledgeSources",
        "tags": [
          "knowledge"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A bot's knowledge sources and the workspace's shared ones",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": false,
            "name": "bot_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Sources",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeSourceList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/knowledge-sources/{id}": {
      "delete": {
        "operationId": "deleteKnowledgeSource",
        "tags": [
          "knowledge"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedKnowledgeSource"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/knowledge-sources/{id}/sync": {
      "post": {
        "operationId": "resyncKnowledgeSource",
        "tags": [
          "knowledge"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Source",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeSource"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/access": {
      "get": {
        "operationId": "getBotAccess",
        "tags": [
          "bots"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Who can chat with, edit or administer this bot",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotAccess"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setBotAccess",
        "tags": [
          "bots"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Replace the bot's visibility and access list",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetBotAccessRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotAccess"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/members": {
      "get": {
        "operationId": "listMembers",
        "tags": [
          "workspaces"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The people in a workspace",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Members",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceMemberList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/channels": {
      "post": {
        "operationId": "createChannel",
        "tags": [
          "channels"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Connect a chat app to a bot",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateChannelRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Channel",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Channel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listChannels",
        "tags": [
          "channels"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A bot's chat apps",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "bot_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Channels",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChannelList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/channels/{id}": {
      "delete": {
        "operationId": "deleteChannel",
        "tags": [
          "channels"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedChannel"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateChannel",
        "tags": [
          "channels"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateChannelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Channel",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Channel"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/channels/{id}/events": {
      "get": {
        "operationId": "listChannelEvents",
        "tags": [
          "channels"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Recent messages in and out, including ignored senders",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Events",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChannelEventList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/channels/slack/install": {
      "get": {
        "operationId": "startSlackInstall",
        "tags": [
          "channels"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Add Casama's Slack app to a Slack workspace for this bot (D-277)",
        "description": "Returns the Slack sign-in address to open. After the person allows it, the bot answers @mentions and direct messages in that Slack workspace, and approvals show buttons in the thread. 409 when this server has no Slack app (self-hosters connect their own app with a bot token instead).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "bot_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Slack sign-in",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlackInstallLink"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/encryption/replace-keys": {
      "post": {
        "operationId": "adminReplaceDataKeys",
        "tags": [
          "admin",
          "encryption"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Replace every data key on this server (instance owner), after a database leak; rows are resealed in the background",
        "responses": {
          "200": {
            "description": "Replaced",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplacedDataKeys"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/encryption": {
      "get": {
        "operationId": "getEncryption",
        "tags": [
          "encryption"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Encryption at rest for a workspace",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EncryptionStatus"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setEncryption",
        "tags": [
          "encryption"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Turn encryption at rest on or off (owners); existing rows are sealed or opened in the background",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetEncryptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EncryptionStatus"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/encryption/replace-key": {
      "post": {
        "operationId": "replaceEncryptionKey",
        "tags": [
          "encryption"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Replace the workspace's data key (owners); rows are resealed onto the new key in the background",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EncryptionStatus"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/encryption/rotate": {
      "post": {
        "operationId": "rotateEncryptionKey",
        "tags": [
          "encryption"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Rewrap the workspace's data key with the server's current key (rows are not rewritten)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EncryptionStatus"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/requests": {
      "post": {
        "operationId": "createGalleryRequest",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Ask for something the gallery doesn't have (a similar request is returned instead)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGalleryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A similar request that already exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryRequest"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryRequest"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listGalleryRequests",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "What people asked the gallery to have",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "top",
                "new"
              ]
            },
            "required": false,
            "name": "sort",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "planned",
                "done",
                "declined"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryRequestList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/submissions": {
      "post": {
        "operationId": "createGallerySubmission",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Submit a look, skill, routine or bot to the gallery (opens a pull request for review)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGallerySubmission"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Submitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GallerySubmission"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Not available on this server",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listGallerySubmissions",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "My gallery submissions and their review status",
        "responses": {
          "200": {
            "description": "Submissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GallerySubmissionList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery-approvals/{id}/decision": {
      "post": {
        "operationId": "decideGalleryApproval",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Approve (which adds the item) or deny a gallery request (owners and admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GalleryApprovalDecision"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Decided",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryApproval"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/{type}/{id}": {
      "get": {
        "operationId": "getGalleryItem",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "One gallery item, including the document the app applies",
        "parameters": [
          {
            "schema": {
              "$ref": "#/components/schemas/GalleryAnyKind"
            },
            "required": true,
            "name": "type",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryDetail"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/gallery-policy": {
      "get": {
        "operationId": "getGalleryPolicy",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "What members may add from the gallery",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryPolicy"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setGalleryPolicy",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Change what members may add from the gallery (owners and admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GalleryPolicy"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/stats": {
      "get": {
        "operationId": "getGalleryStats",
        "tags": [
          "gallery"
        ],
        "summary": "How many people use each gallery item, aggregate only (no sign-in)",
        "responses": {
          "200": {
            "description": "Stats",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryStatsList"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/install": {
      "post": {
        "operationId": "installGalleryItem",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Add a gallery item with its install questions; needed skills come along, needed apps come back in missing",
        "description": "201 installed, or 202 approval_pending (an admin was asked; approval_id set). 400 inputs_invalid: the Problem's `errors` are `{path: <input key>, message}`, one per bad answer. 400 bot_required: a routine or plugin needs bot_id. 403 gallery_blocked: the workspace's rules don't allow it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GalleryInstallRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Installed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryInstallResult"
                }
              }
            }
          },
          "202": {
            "description": "Waiting for an admin to approve",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryInstallResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/sets/{id}/install": {
      "post": {
        "operationId": "installGallerySet",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Add every workspace item of a starter set",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GallerySetInstallRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-item results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GallerySetInstallResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery": {
      "get": {
        "operationId": "listGallery",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Themes, color schemes, wallpapers and skills from the open gallery (D-184)",
        "parameters": [
          {
            "schema": {
              "$ref": "#/components/schemas/GalleryAnyKind"
            },
            "required": false,
            "name": "type",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "all"
              ],
              "description": "all: every kind in one list (apps, bots, routines, plugins, sets too, D-315)"
            },
            "required": false,
            "description": "all: every kind in one list (apps, bots, routines, plugins, sets too, D-315)",
            "name": "kinds",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 80
            },
            "required": false,
            "name": "q",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 24
            },
            "required": false,
            "name": "tag",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "required": false,
            "name": "featured",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Gallery",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/gallery-approvals": {
      "get": {
        "operationId": "listGalleryApprovals",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Gallery items members asked to add (admins see all, members their own)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "approved",
                "denied",
                "failed"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Approvals",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryApprovalList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/authors": {
      "get": {
        "operationId": "listGalleryAuthors",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The gallery's authors and what each made",
        "responses": {
          "200": {
            "description": "Authors",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryAuthorList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/installed": {
      "get": {
        "operationId": "listGalleryInstalled",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "What this workspace added from the gallery, with updates and retired items",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Installed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryInstalledList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/sets": {
      "get": {
        "operationId": "listGallerySets",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Starter sets: a few gallery items that go well together",
        "responses": {
          "200": {
            "description": "Sets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GallerySetList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/me/items": {
      "get": {
        "operationId": "listMyGalleryItems",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Gallery items I made (from merged submissions), with their full stats",
        "responses": {
          "200": {
            "description": "My items",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryAuthorItemList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/{type}/{id}/used": {
      "post": {
        "operationId": "markGalleryItemUsed",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Count a look as used on this device (counted once per person, aggregate only)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "theme",
                "scheme",
                "wallpaper"
              ]
            },
            "required": true,
            "name": "type",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Counted"
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/installed/{type}/{id}": {
      "delete": {
        "operationId": "removeGalleryInstalled",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Remove what this workspace added from a gallery item",
        "parameters": [
          {
            "schema": {
              "$ref": "#/components/schemas/GalleryWorkspaceKind"
            },
            "required": true,
            "name": "type",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "204": {
            "description": "Removed"
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/requests/{id}/vote": {
      "delete": {
        "operationId": "unvoteGalleryRequest",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Take back a vote",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryRequest"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "voteGalleryRequest",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Vote for a request",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryRequest"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/installed/update": {
      "post": {
        "operationId": "updateGalleryInstalled",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Update an installed item to the gallery's latest (409 access_changed when it can touch more or is breaking)",
        "description": "409 access_changed: the Problem's `errors` list what's new, one entry each: `{path: \"reads\"|\"writes\", message: <the added thing>}`, `{path: \"runs_code\"|\"computer\"|\"breaking\", message: \"true\"}`. Send accept_access: true after the person agrees. The Installed list's access_added and breaking say the same up front.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GalleryUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryUpdateResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gallery/requests/{id}": {
      "patch": {
        "operationId": "updateGalleryRequest",
        "tags": [
          "gallery"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Set a request's status (instance owners)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateGalleryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GalleryRequest"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/app-config": {
      "get": {
        "operationId": "adminAppConfig",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Remote app settings (owner only)",
        "responses": {
          "200": {
            "description": "Remote app settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteAppConfig"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "adminSetAppConfig",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Replace the remote app settings (owner only)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetRemoteAppConfigRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Remote app settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteAppConfig"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/app-config": {
      "get": {
        "operationId": "getAppConfig",
        "tags": [
          "system"
        ],
        "summary": "Remote app settings: minimum versions, maintenance, announcements, flags (no auth)",
        "responses": {
          "200": {
            "description": "Remote app settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteAppConfig"
                }
              }
            }
          }
        }
      }
    },
    "/v1/plugin-directory": {
      "get": {
        "operationId": "listPluginDirectory",
        "tags": [
          "plugins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Reviewed plugins from the gallery, each pinned to the commit that was reviewed",
        "responses": {
          "200": {
            "description": "Plugins",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PluginDirectory"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/routine-ideas": {
      "get": {
        "operationId": "listRoutineIdeas",
        "tags": [
          "routines"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Routine ideas from the gallery, to fill in a new routine",
        "responses": {
          "200": {
            "description": "Routine ideas",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutineIdeaList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/telephony": {
      "delete": {
        "operationId": "deleteTelephony",
        "tags": [
          "telephony"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TelephonySettings"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getTelephony",
        "tags": [
          "telephony"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TelephonySettings"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setTelephony",
        "tags": [
          "telephony"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Connect the workspace's Twilio account for calls bots place",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetTelephonyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TelephonySettings"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/outbound-calls/{id}/end": {
      "post": {
        "operationId": "endOutboundCall",
        "tags": [
          "telephony"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundCall"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/outbound-calls/{id}": {
      "get": {
        "operationId": "getOutboundCall",
        "tags": [
          "telephony"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A call a bot placed, with its live transcript",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundCall"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/outbound-calls/{id}/take-over": {
      "post": {
        "operationId": "takeOverOutboundCall",
        "tags": [
          "telephony"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Move the call to your own phone (saves the number to your profile)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TakeOverCallRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundCall"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/payments": {
      "delete": {
        "operationId": "deletePaymentSettings",
        "tags": [
          "payments"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentSettings"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getPaymentSettings",
        "tags": [
          "payments"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentSettings"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setPaymentSettings",
        "tags": [
          "payments"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Connect the workspace's card issuing account for single-use cards (owners)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPaymentSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentSettings"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/payments/requests": {
      "get": {
        "operationId": "listPaymentRequests",
        "tags": [
          "payments"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Cards bots asked for (owners see all; others their own)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequestList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/accept": {
      "post": {
        "operationId": "acceptBotLink",
        "tags": [
          "links"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Accept a contact's invite with one of your bots (works across Casama servers)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcceptBotLinkRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotLink"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bots/{id}/links": {
      "post": {
        "operationId": "createBotLink",
        "tags": [
          "links"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Invite a trusted contact's bot to link with this one",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBotLinkRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Invite",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedBotLink"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listBotLinks",
        "tags": [
          "links"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Links",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotLinkList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{id}/exchanges": {
      "get": {
        "operationId": "listLinkExchanges",
        "tags": [
          "links"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Exchanges",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkExchangeList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{id}": {
      "delete": {
        "operationId": "revokeBotLink",
        "tags": [
          "links"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotLink"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/secret-store": {
      "delete": {
        "operationId": "deleteSecretStore",
        "tags": [
          "secrets"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Go back to Vault (secrets kept in Infisical are copied back first)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretStoreSettings"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getSecretStore",
        "tags": [
          "secrets"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretStoreSettings"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setSecretStore",
        "tags": [
          "secrets"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Keep bots' named secrets in the workspace's Infisical project (admins)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetSecretStoreRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretStoreSettings"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/device-requests/{id}/result": {
      "post": {
        "operationId": "answerDeviceRequest",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceRequestResult"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Answered",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/device-places/{id}": {
      "delete": {
        "operationId": "deleteDevicePlace",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/device-sources/{key}": {
      "delete": {
        "operationId": "deleteDeviceSource",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Forget this device and everything it shared",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            },
            "required": true,
            "name": "key",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "saveDeviceSource",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Register this device and the kinds it shares; kinds turned off lose their data",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            },
            "required": true,
            "name": "key",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveDeviceSourceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Device",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceSource"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/device-grants": {
      "get": {
        "operationId": "listDeviceGrants",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Which bots may read which kinds of your device data",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": false,
            "name": "bot_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Grants",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeviceGrant"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setDeviceGrant",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Allow or stop a bot reading one kind of your device data",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetDeviceGrantRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Grants",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeviceGrant"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/device-places": {
      "get": {
        "operationId": "listDevicePlaces",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Your named places",
        "responses": {
          "200": {
            "description": "Places",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DevicePlace"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "saveDevicePlace",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Add or update a named place (up to 20)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveDevicePlaceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Place",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevicePlace"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/device-readings": {
      "get": {
        "operationId": "listDeviceReadings",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "What your devices have shared",
        "parameters": [
          {
            "schema": {
              "$ref": "#/components/schemas/DeviceKind"
            },
            "required": false,
            "name": "kind",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "required": false,
            "name": "limit",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Readings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeviceReading"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/device-sources/{key}/requests": {
      "get": {
        "operationId": "listDeviceRequests",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Work waiting for this device",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            },
            "required": true,
            "name": "key",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Requests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeviceRequest"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/device-sources": {
      "get": {
        "operationId": "listDeviceSources",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Your devices that share data",
        "responses": {
          "200": {
            "description": "Devices",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeviceSource"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/device-sources/{key}/events": {
      "post": {
        "operationId": "reportDeviceEvents",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Report events that start device-triggered routines",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            },
            "required": true,
            "name": "key",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportDeviceEventsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "integer"
                    },
                    "runs": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "accepted",
                    "runs"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/device-sources/{key}/readings": {
      "post": {
        "operationId": "uploadDeviceReadings",
        "tags": [
          "devices"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Upload summaries (re-uploading the same external_id replaces it)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            },
            "required": true,
            "name": "key",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadDeviceReadingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "stored": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "stored"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/notifications/{id}/less-like-this": {
      "post": {
        "operationId": "lessLikeThis",
        "tags": [
          "notifications"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Tell the bot to send fewer messages like this one",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/facts": {
      "post": {
        "operationId": "addUserFacts",
        "tags": [
          "about-you"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddUserFactsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Added",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserFactList"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listUserFacts",
        "tags": [
          "about-you"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Facts bots learned about you, pinned and newest first",
        "responses": {
          "200": {
            "description": "Facts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserFactList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/photo": {
      "delete": {
        "operationId": "deleteProfilePhoto",
        "tags": [
          "about-you"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Remove your profile photo",
        "responses": {
          "200": {
            "description": "About you",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AboutYou"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setProfilePhoto",
        "tags": [
          "about-you"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Set your profile photo",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetProfilePhotoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "About you",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AboutYou"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/facts/{id}": {
      "delete": {
        "operationId": "deleteUserFact",
        "tags": [
          "about-you"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedUserFact"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateUserFact",
        "tags": [
          "about-you"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUserFactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Fact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserFact"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/about": {
      "get": {
        "operationId": "getAboutYou",
        "tags": [
          "about-you"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "What bots call you and what you shared about yourself",
        "responses": {
          "200": {
            "description": "About you",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AboutYou"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateAboutYou",
        "tags": [
          "about-you"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAboutYouRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "About you",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AboutYou"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/photos/{id}": {
      "get": {
        "operationId": "getProfilePhoto",
        "tags": [
          "about-you"
        ],
        "summary": "A profile photo (no token: the id is random and changes with every new photo; cached for good)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Photo",
            "content": {
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/profile-spaces/{org_id}": {
      "get": {
        "operationId": "getProfileSpace",
        "tags": [
          "about-you"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Whether bots in this workspace use About me and learned facts",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Sharing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileSpace"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setProfileSpace",
        "tags": [
          "about-you"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetProfileSpaceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sharing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileSpace"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/photo/import": {
      "post": {
        "operationId": "importProfilePhoto",
        "tags": [
          "about-you"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Copy the photo your sign-in provider shares (Google) as your profile photo",
        "description": "Without replace it only copies once, and only while you have no photo. It finishes quietly when there's nothing to copy or the provider can't be reached.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportProfilePhotoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "About you",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AboutYou"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pages/{id}/view-link": {
      "post": {
        "operationId": "createPageViewLink",
        "tags": [
          "pages"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A single-use link (60 s) that opens the page in a browser",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PageViewLinkRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "View link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageViewLink"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pages/{id}": {
      "delete": {
        "operationId": "deletePage",
        "tags": [
          "pages"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedPage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getPage",
        "tags": [
          "pages"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotPageDetail"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updatePage",
        "tags": [
          "pages"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Change who can open a page; making it public returns a new link",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdatePageResponse"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pages": {
      "get": {
        "operationId": "listPages",
        "tags": [
          "pages"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Pages you can open in a workspace",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": false,
            "name": "bot_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Pages",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pages/{id}/revert": {
      "post": {
        "operationId": "revertPage",
        "tags": [
          "pages"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Bring back an earlier version (as a new version)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevertPageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotPage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/password-managers": {
      "post": {
        "operationId": "createPasswordManager",
        "tags": [
          "password-managers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Connect 1Password or Bitwarden; then choose which vaults bots may use",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePasswordManagerRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Connected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordManager"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listPasswordManagers",
        "tags": [
          "password-managers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The workspace's password managers and your own",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Password managers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordManagerList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/password-managers/{id}": {
      "delete": {
        "operationId": "deletePasswordManager",
        "tags": [
          "password-managers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedPasswordManager"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updatePasswordManager",
        "tags": [
          "password-managers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePasswordManagerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Password manager",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordManager"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/password-managers/{id}/vaults": {
      "get": {
        "operationId": "listPasswordManagerVaults",
        "tags": [
          "password-managers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Vaults",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordManagerVaultList"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/replays/{id}": {
      "delete": {
        "operationId": "deleteReplay",
        "tags": [
          "replays"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedReplay"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/replays": {
      "get": {
        "operationId": "listReplays",
        "tags": [
          "replays"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A bot's saved replays",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "bot_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Replays",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplayList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/teach/{id}/replay": {
      "post": {
        "operationId": "replayFromTeach",
        "tags": [
          "replays"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Save a teach recording as a replay",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplayFromTeachRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Replay",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Replay"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/replays/{id}/run": {
      "post": {
        "operationId": "runReplay",
        "tags": [
          "replays"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Run a replay without the model; the bot takes over if a step fails",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunReplayRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunReplayResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/skill-proposals/{id}/accept": {
      "post": {
        "operationId": "acceptSkillProposal",
        "tags": [
          "skills"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Save the proposed skill or edit, optionally changed first",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcceptSkillProposalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillProposal"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/skill-proposals/{id}/dismiss": {
      "post": {
        "operationId": "dismissSkillProposal",
        "tags": [
          "skills"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Dismissed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillProposal"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/skills/{id}/stats": {
      "get": {
        "operationId": "getSkillStats",
        "tags": [
          "skills"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Uses, success rate, last failure and history of a skill",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Stats",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillStats"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/skill-proposals": {
      "get": {
        "operationId": "listSkillProposals",
        "tags": [
          "skills"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Skills and skill edits bots proposed from their runs",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "org_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": false,
            "name": "bot_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Proposals",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillProposalList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/plugins/{id}/update": {
      "get": {
        "operationId": "getPluginUpdate",
        "tags": [
          "plugins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The latest commit of the plugin's source and what changes",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Update",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PluginUpdatePreview"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "updatePlugin",
        "tags": [
          "plugins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePluginRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plugin"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/plugins": {
      "post": {
        "operationId": "installPlugin",
        "tags": [
          "plugins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Install a plugin for a bot, pinned to the previewed commit",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InstallPluginRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Installed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plugin"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listPlugins",
        "tags": [
          "plugins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "bot_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Plugins",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PluginList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/plugins/preview": {
      "post": {
        "operationId": "previewPlugin",
        "tags": [
          "plugins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "What an Agent Plugins 1.0 package from GitHub would add",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewPluginRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preview",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PluginPreview"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/plugins/{id}": {
      "delete": {
        "operationId": "uninstallPlugin",
        "tags": [
          "plugins"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Remove the plugin and everything it added",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Removed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedPlugin"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/teach/{id}/steps": {
      "post": {
        "operationId": "addTeachStep",
        "tags": [
          "teach"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Record a step; the server captures the screen's state after it",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddTeachStepRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Step",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeachStep"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/teach/{id}": {
      "delete": {
        "operationId": "cancelTeach",
        "tags": [
          "teach"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Discard a recording and everything it captured",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedTeach"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getTeach",
        "tags": [
          "teach"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Recording",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeachSession"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/teach/{id}/steps/{seq}/secret": {
      "post": {
        "operationId": "markTeachSecret",
        "tags": [
          "teach"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Mark a typed value as a secret: its text is deleted and it becomes a {{secret:NAME}} input",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "required": true,
            "name": "seq",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarkTeachSecretRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Step",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeachStep"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/teach/{id}/save": {
      "post": {
        "operationId": "saveTeach",
        "tags": [
          "teach"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Save the (edited) draft as one of the bot's skills, and optionally try it now",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveTeachRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveTeachResponse"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/teach": {
      "post": {
        "operationId": "startTeach",
        "tags": [
          "teach"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Start recording a task while you have control of a computer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartTeachRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recording",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeachSession"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/teach/{id}/stop": {
      "post": {
        "operationId": "stopTeach",
        "tags": [
          "teach"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Stop recording; the bot drafts a skill from it",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Recording",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeachSession"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/watchers/{id}": {
      "delete": {
        "operationId": "deleteWatcher",
        "tags": [
          "watchers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedWatcher"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateWatcher",
        "tags": [
          "watchers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Pause or resume a watcher",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWatcherRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Watcher",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Watcher"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/watchers": {
      "get": {
        "operationId": "listWatchers",
        "tags": [
          "watchers"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "bot_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Watchers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WatcherList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/git-sync": {
      "delete": {
        "operationId": "deleteGitSync",
        "tags": [
          "files"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Git sync",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitSyncStatus"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getGitSync",
        "tags": [
          "files"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Git sync",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitSyncStatus"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setGitSync",
        "tags": [
          "files"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetGitSyncRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Git sync",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitSyncStatus"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/files/export": {
      "post": {
        "operationId": "exportWorkspaceFiles",
        "tags": [
          "files"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Routines and skills as Markdown files, zipped",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "ZIP",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceFilesExport"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/files/import": {
      "post": {
        "operationId": "importWorkspaceFiles",
        "tags": [
          "files"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create and update routines and skills from files (dry_run shows what would change)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportWorkspaceFilesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceFilesResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/git-sync/run": {
      "post": {
        "operationId": "runGitSync",
        "tags": [
          "files"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Sync on the worker's next minute",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Git sync",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitSyncStatus"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/mcp-keys": {
      "post": {
        "operationId": "createMcpKey",
        "tags": [
          "mcp"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A workspace API key for the hosted MCP endpoint (admins); it acts as you in this workspace",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMcpKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedMcpKey"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listMcpKeys",
        "tags": [
          "mcp"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Keys",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpKeyList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/oauth/requests/{id}/consent": {
      "post": {
        "operationId": "decideMcpAuthRequest",
        "tags": [
          "mcp"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Allow or refuse an AI app's access to one workspace; returns where to send the browser",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpConsentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpConsentResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/oauth/requests/{id}": {
      "get": {
        "operationId": "getMcpAuthRequest",
        "tags": [
          "mcp"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "An AI app asking to connect, for the consent screen",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpAuthRequestInfo"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{id}/mcp-keys/{key_id}": {
      "delete": {
        "operationId": "revokeMcpKey",
        "tags": [
          "mcp"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "key_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevokedKey"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/referral": {
      "get": {
        "operationId": "getReferral",
        "tags": [
          "referrals"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Your invite code and link, what you've earned, and who invited you",
        "responses": {
          "200": {
            "description": "Invite friends",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Referral"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/referral/preview": {
      "get": {
        "operationId": "previewReferral",
        "tags": [
          "referrals"
        ],
        "summary": "Who an invite code is from (no sign-in)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "required": true,
            "name": "code",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Invite",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReferralPreview"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/referral/redeem": {
      "post": {
        "operationId": "redeemReferral",
        "tags": [
          "referrals"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Enter a friend's invite code (a few days after signing up)",
        "description": "Errors: 404 referral_not_found, 400 referral_own_code, 409 referral_already, 400 referral_window_closed, 400 referral_mutual, 404 referrals_off, 429 too_many_attempts.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedeemReferralRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Invite friends",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Referral"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {}
}
