{
  "openapi": "3.1.0",
  "info": {
    "title": "Cloudtifact API",
    "version": "1",
    "description": "Generated from packages/contract. Auth: `Authorization: Bearer <token>`. Errors: non-2xx with { error: { code, message } }."
  },
  "servers": [
    {
      "url": "https://api.cloudtifact.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ],
  "paths": {
    "/v1/auth/dev-login": {
      "post": {
        "summary": "TESTS ONLY: 404 unless DEV_AUTH=true (never in production)",
        "tags": [
          "Auth API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "handle": {
                          "type": "string"
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "handle",
                        "name"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "token",
                    "user"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "handle": {
                    "type": "string",
                    "pattern": "^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$"
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "label": {
                    "default": "cli",
                    "type": "string",
                    "enum": [
                      "cli",
                      "web"
                    ]
                  }
                },
                "required": [
                  "handle"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/auth/cli/start": {
      "post": {
        "summary": "anonymous; begins CLI sign-in; 429 past 10 pending per IP (or 500 overall)",
        "tags": [
          "Auth API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "deviceCode": {
                      "type": "string"
                    },
                    "userCode": {
                      "type": "string"
                    },
                    "verificationUrl": {
                      "type": "string"
                    },
                    "expiresIn": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "interval": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "deviceCode",
                    "userCode",
                    "verificationUrl",
                    "expiresIn",
                    "interval"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "maxLength": 60
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/cli/requests/{userCode}": {
      "get": {
        "summary": "Clerk session only; what's being approved, and where from",
        "tags": [
          "Auth API"
        ],
        "parameters": [
          {
            "name": "userCode",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "userCode": {
                      "type": "string"
                    },
                    "label": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "number"
                    },
                    "expiresAt": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "approved",
                        "denied",
                        "expired"
                      ]
                    },
                    "requestedFrom": {
                      "default": null,
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "city": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "city",
                            "country"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "userAgent": {
                      "default": null,
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "userCode",
                    "label",
                    "createdAt",
                    "expiresAt",
                    "status",
                    "requestedFrom",
                    "userAgent"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/cli/decide": {
      "post": {
        "summary": "Clerk session only (API tokens: 403); approve or deny",
        "tags": [
          "Auth API"
        ],
        "parameters": [],
        "responses": {
          "204": {
            "description": "No content"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "userCode": {
                    "type": "string"
                  },
                  "approve": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "userCode",
                  "approve"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/auth/cli/poll": {
      "post": {
        "summary": "anonymous; 202 pending, 403 denied, 410 expired",
        "tags": [
          "Auth API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "pending"
                        }
                      },
                      "required": [
                        "status"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "approved"
                        },
                        "token": {
                          "type": "string"
                        },
                        "user": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status",
                        "token",
                        "user"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "deviceCode": {
                    "type": "string"
                  }
                },
                "required": [
                  "deviceCode"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "tags": [
          "Auth API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "handle": {
                          "type": "string"
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "handle",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "workspaces": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "admin",
                              "member",
                              "viewer"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "slug",
                          "name",
                          "role"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "invites": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "admin",
                              "member",
                              "viewer"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "slug",
                          "name",
                          "role"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "preferences": {
                      "default": {
                        "developerMode": false
                      },
                      "type": "object",
                      "properties": {
                        "developerMode": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "developerMode"
                      ],
                      "additionalProperties": false
                    },
                    "blocked": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "user",
                    "workspaces",
                    "invites",
                    "preferences",
                    "blocked"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "deletes your account: workspaces only you are in (with their rooms and data), your tokens and sign-ins; shared workspaces you own pass to the earliest other member; your chat messages show as \"Deleted user\"",
        "tags": [
          "Auth API"
        ],
        "parameters": [],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/me/blocks": {
      "post": {
        "summary": "idempotent; 400 yourself, 404 unknown user; their room chat stops reaching you from your next connect",
        "tags": [
          "Auth API"
        ],
        "parameters": [],
        "responses": {
          "204": {
            "description": "No content"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "userId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                },
                "required": [
                  "userId"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/me/blocks/{userId}": {
      "delete": {
        "summary": "idempotent",
        "tags": [
          "Auth API"
        ],
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/me/preferences": {
      "patch": {
        "summary": "your own view settings (developer mode)",
        "tags": [
          "Auth API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "developerMode": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "developerMode"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "developerMode": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/tokens": {
      "get": {
        "summary": "your CLI tokens (no hashes); current = this request's token",
        "tags": [
          "Auth API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "tokens": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "lastUsedAt": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "expiresAt": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "current": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "label",
                          "createdAt",
                          "lastUsedAt",
                          "expiresAt",
                          "current"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "tokens"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/tokens/current": {
      "delete": {
        "summary": "revokes the token making the request (400 with a Clerk session)",
        "tags": [
          "Auth API"
        ],
        "parameters": [],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/tokens/{id}": {
      "delete": {
        "summary": "revokes one of your own tokens; 404 otherwise",
        "tags": [
          "Auth API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/workspaces": {
      "get": {
        "summary": "yours (accepted), oldest first",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "role": {
                        "type": "string",
                        "enum": [
                          "owner",
                          "admin",
                          "member",
                          "viewer"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "slug",
                      "name",
                      "role"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "you become owner",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "admin",
                        "member",
                        "viewer"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "slug",
                    "name",
                    "role"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "pattern": "^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                },
                "required": [
                  "slug",
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/workspaces/{slug}": {
      "get": {
        "summary": "members only (404 otherwise)",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "admin",
                        "member",
                        "viewer"
                      ]
                    },
                    "members": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "user": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "handle": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "handle",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "admin",
                              "member",
                              "viewer"
                            ]
                          },
                          "pending": {
                            "type": "boolean"
                          },
                          "joinedAt": {
                            "type": [
                              "number",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "user",
                          "role",
                          "pending",
                          "joinedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "spaceCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "createdAt": {
                      "type": "number"
                    },
                    "seats": {
                      "type": "object",
                      "properties": {
                        "used": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "used",
                        "limit"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "slug",
                    "name",
                    "role",
                    "members",
                    "spaceCount",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "admin+; slug must stay unique",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "admin",
                        "member",
                        "viewer"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "slug",
                    "name",
                    "role"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "pattern": "^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/workspaces/{slug}/members": {
      "post": {
        "summary": "admin+ invites by handle (pending until accepted); only owners add owners",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "handle": {
                    "type": "string",
                    "pattern": "^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$"
                  },
                  "role": {
                    "default": "member",
                    "type": "string",
                    "enum": [
                      "owner",
                      "admin",
                      "member",
                      "viewer"
                    ]
                  }
                },
                "required": [
                  "handle"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/workspaces/{slug}/members/{handle}": {
      "patch": {
        "summary": "admin+; only owners change owners; keeps >= 1 owner",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "handle",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "admin",
                      "member",
                      "viewer"
                    ]
                  }
                },
                "required": [
                  "role"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "summary": "admin+ (or yourself, to leave); keeps >= 1 owner",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "handle",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/workspaces/{slug}/invites": {
      "get": {
        "summary": "admin+; live invite links (not revoked, expired or used up)",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "invites": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "admin",
                              "member",
                              "viewer"
                            ]
                          },
                          "email": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "maxUses": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "uses": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "expiresAt": {
                            "type": "number"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "createdBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "handle": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "handle",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "role",
                          "email",
                          "maxUses",
                          "uses",
                          "expiresAt",
                          "createdAt",
                          "createdBy"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "invites"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "admin+; the link is returned once (stored hashed); only owners make owner links",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "invite": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "admin",
                            "member",
                            "viewer"
                          ]
                        },
                        "email": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "maxUses": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "uses": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "expiresAt": {
                          "type": "number"
                        },
                        "createdAt": {
                          "type": "number"
                        },
                        "createdBy": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "handle": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "handle",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "role",
                        "email",
                        "maxUses",
                        "uses",
                        "expiresAt",
                        "createdAt",
                        "createdBy"
                      ],
                      "additionalProperties": false
                    },
                    "url": {
                      "type": "string"
                    },
                    "emailed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "invite",
                    "url",
                    "emailed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "role": {
                    "default": "member",
                    "type": "string",
                    "enum": [
                      "owner",
                      "admin",
                      "member",
                      "viewer"
                    ]
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "maxUses": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expiresInDays": {
                    "default": 7,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 30
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/workspaces/{slug}/invites/{id}": {
      "delete": {
        "summary": "admin+; turns the link off",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/workspace-invites/preview": {
      "post": {
        "summary": "anyone with the link; 404 unknown, 410 revoked/expired/used up",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "slug",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "admin",
                        "member",
                        "viewer"
                      ]
                    },
                    "invitedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "memberCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "expiresAt": {
                      "type": "number"
                    },
                    "alreadyMember": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "workspace",
                    "role",
                    "invitedBy",
                    "memberCount",
                    "expiresAt",
                    "alreadyMember"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 200
                  }
                },
                "required": [
                  "token"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/workspace-invites/accept": {
      "post": {
        "summary": "signed in; joins with the link's role; 403 past the seat limit or wrong email",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "admin",
                            "member",
                            "viewer"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "slug",
                        "name",
                        "role"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "workspace"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 200
                  }
                },
                "required": [
                  "token"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/workspaces/{slug}/accept": {
      "post": {
        "summary": "accept your pending invite; 403 past the seat limit",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/workspaces/{slug}/decline": {
      "post": {
        "summary": "decline your pending invite",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/workspaces/{slug}/audit": {
      "get": {
        "summary": "admin+; newest first: members, invites, billing, sharing, going live",
        "tags": [
          "Workspaces API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "action": {
                            "type": "string",
                            "enum": [
                              "workspace.updated",
                              "member.invited",
                              "member.joined",
                              "member.declined",
                              "member.role_changed",
                              "member.removed",
                              "member.left",
                              "invite_link.created",
                              "invite_link.revoked",
                              "billing.checkout",
                              "space.created",
                              "space.updated",
                              "room.link_changed",
                              "room.person_added",
                              "room.person_changed",
                              "room.person_removed",
                              "app.went_live",
                              "app.updated_live",
                              "app.rolled_back",
                              "app.deleted"
                            ]
                          },
                          "actor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "handle": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "handle",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "targetId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "targetLabel": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "detail": {
                            "anyOf": [
                              {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {}
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "via": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "action",
                          "actor",
                          "targetId",
                          "targetLabel",
                          "detail",
                          "via",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next": {
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "events",
                    "next"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/spaces": {
      "get": {
        "summary": "?workspace=<slug>: that workspace's spaces you can see (unknown slug: empty); else all you can push to",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "workspace",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "spaces": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9a-z]{10}$"
                          },
                          "name": {
                            "type": "string"
                          },
                          "workspace": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "slug": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "slug",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "visibility": {
                            "type": "string",
                            "enum": [
                              "public",
                              "members"
                            ]
                          },
                          "guestComments": {
                            "type": "boolean"
                          },
                          "guestWrites": {
                            "type": "boolean"
                          },
                          "viewers": {
                            "type": "object",
                            "properties": {
                              "files": {
                                "type": "boolean"
                              },
                              "history": {
                                "type": "boolean"
                              },
                              "data": {
                                "type": "boolean"
                              },
                              "dbRead": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "files",
                              "history",
                              "data",
                              "dbRead"
                            ],
                            "additionalProperties": false
                          },
                          "latestVersion": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "path": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "shareUrl": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "kind": {
                            "default": "repo",
                            "type": "string",
                            "enum": [
                              "repo",
                              "room",
                              "app"
                            ]
                          },
                          "permissions": {
                            "type": "object",
                            "properties": {
                              "canView": {
                                "type": "boolean"
                              },
                              "canPush": {
                                "type": "boolean"
                              },
                              "canComment": {
                                "type": "boolean"
                              },
                              "canAdmin": {
                                "type": "boolean"
                              },
                              "canGuestComment": {
                                "type": "boolean"
                              },
                              "canGuestWrite": {
                                "type": "boolean"
                              },
                              "canSeeFiles": {
                                "type": "boolean"
                              },
                              "canSeeHistory": {
                                "type": "boolean"
                              },
                              "canSeeData": {
                                "type": "boolean"
                              },
                              "canReadDb": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "canView",
                              "canPush",
                              "canComment",
                              "canAdmin",
                              "canGuestComment",
                              "canGuestWrite",
                              "canSeeFiles",
                              "canSeeHistory",
                              "canSeeData",
                              "canReadDb"
                            ],
                            "additionalProperties": false
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "workspace",
                          "visibility",
                          "guestComments",
                          "guestWrites",
                          "viewers",
                          "latestVersion",
                          "path",
                          "url",
                          "shareUrl",
                          "kind",
                          "permissions",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "spaces"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Spaces API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "slug",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "visibility": {
                      "type": "string",
                      "enum": [
                        "public",
                        "members"
                      ]
                    },
                    "guestComments": {
                      "type": "boolean"
                    },
                    "guestWrites": {
                      "type": "boolean"
                    },
                    "viewers": {
                      "type": "object",
                      "properties": {
                        "files": {
                          "type": "boolean"
                        },
                        "history": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "boolean"
                        },
                        "dbRead": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "files",
                        "history",
                        "data",
                        "dbRead"
                      ],
                      "additionalProperties": false
                    },
                    "latestVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "path": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "shareUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kind": {
                      "default": "repo",
                      "type": "string",
                      "enum": [
                        "repo",
                        "room",
                        "app"
                      ]
                    },
                    "permissions": {
                      "type": "object",
                      "properties": {
                        "canView": {
                          "type": "boolean"
                        },
                        "canPush": {
                          "type": "boolean"
                        },
                        "canComment": {
                          "type": "boolean"
                        },
                        "canAdmin": {
                          "type": "boolean"
                        },
                        "canGuestComment": {
                          "type": "boolean"
                        },
                        "canGuestWrite": {
                          "type": "boolean"
                        },
                        "canSeeFiles": {
                          "type": "boolean"
                        },
                        "canSeeHistory": {
                          "type": "boolean"
                        },
                        "canSeeData": {
                          "type": "boolean"
                        },
                        "canReadDb": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "canView",
                        "canPush",
                        "canComment",
                        "canAdmin",
                        "canGuestComment",
                        "canGuestWrite",
                        "canSeeFiles",
                        "canSeeHistory",
                        "canSeeData",
                        "canReadDb"
                      ],
                      "additionalProperties": false
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "workspace",
                    "visibility",
                    "guestComments",
                    "guestWrites",
                    "viewers",
                    "latestVersion",
                    "path",
                    "url",
                    "shareUrl",
                    "kind",
                    "permissions",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "workspace": {
                    "type": "string",
                    "pattern": "^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "visibility": {
                    "default": "public",
                    "type": "string",
                    "enum": [
                      "public",
                      "members"
                    ]
                  }
                },
                "required": [
                  "workspace",
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}": {
      "get": {
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "slug",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "visibility": {
                      "type": "string",
                      "enum": [
                        "public",
                        "members"
                      ]
                    },
                    "guestComments": {
                      "type": "boolean"
                    },
                    "guestWrites": {
                      "type": "boolean"
                    },
                    "viewers": {
                      "type": "object",
                      "properties": {
                        "files": {
                          "type": "boolean"
                        },
                        "history": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "boolean"
                        },
                        "dbRead": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "files",
                        "history",
                        "data",
                        "dbRead"
                      ],
                      "additionalProperties": false
                    },
                    "latestVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "path": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "shareUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kind": {
                      "default": "repo",
                      "type": "string",
                      "enum": [
                        "repo",
                        "room",
                        "app"
                      ]
                    },
                    "permissions": {
                      "type": "object",
                      "properties": {
                        "canView": {
                          "type": "boolean"
                        },
                        "canPush": {
                          "type": "boolean"
                        },
                        "canComment": {
                          "type": "boolean"
                        },
                        "canAdmin": {
                          "type": "boolean"
                        },
                        "canGuestComment": {
                          "type": "boolean"
                        },
                        "canGuestWrite": {
                          "type": "boolean"
                        },
                        "canSeeFiles": {
                          "type": "boolean"
                        },
                        "canSeeHistory": {
                          "type": "boolean"
                        },
                        "canSeeData": {
                          "type": "boolean"
                        },
                        "canReadDb": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "canView",
                        "canPush",
                        "canComment",
                        "canAdmin",
                        "canGuestComment",
                        "canGuestWrite",
                        "canSeeFiles",
                        "canSeeHistory",
                        "canSeeData",
                        "canReadDb"
                      ],
                      "additionalProperties": false
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "workspace",
                    "visibility",
                    "guestComments",
                    "guestWrites",
                    "viewers",
                    "latestVersion",
                    "path",
                    "url",
                    "shareUrl",
                    "kind",
                    "permissions",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "slug",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "visibility": {
                      "type": "string",
                      "enum": [
                        "public",
                        "members"
                      ]
                    },
                    "guestComments": {
                      "type": "boolean"
                    },
                    "guestWrites": {
                      "type": "boolean"
                    },
                    "viewers": {
                      "type": "object",
                      "properties": {
                        "files": {
                          "type": "boolean"
                        },
                        "history": {
                          "type": "boolean"
                        },
                        "data": {
                          "type": "boolean"
                        },
                        "dbRead": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "files",
                        "history",
                        "data",
                        "dbRead"
                      ],
                      "additionalProperties": false
                    },
                    "latestVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "path": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "shareUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kind": {
                      "default": "repo",
                      "type": "string",
                      "enum": [
                        "repo",
                        "room",
                        "app"
                      ]
                    },
                    "permissions": {
                      "type": "object",
                      "properties": {
                        "canView": {
                          "type": "boolean"
                        },
                        "canPush": {
                          "type": "boolean"
                        },
                        "canComment": {
                          "type": "boolean"
                        },
                        "canAdmin": {
                          "type": "boolean"
                        },
                        "canGuestComment": {
                          "type": "boolean"
                        },
                        "canGuestWrite": {
                          "type": "boolean"
                        },
                        "canSeeFiles": {
                          "type": "boolean"
                        },
                        "canSeeHistory": {
                          "type": "boolean"
                        },
                        "canSeeData": {
                          "type": "boolean"
                        },
                        "canReadDb": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "canView",
                        "canPush",
                        "canComment",
                        "canAdmin",
                        "canGuestComment",
                        "canGuestWrite",
                        "canSeeFiles",
                        "canSeeHistory",
                        "canSeeData",
                        "canReadDb"
                      ],
                      "additionalProperties": false
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "workspace",
                    "visibility",
                    "guestComments",
                    "guestWrites",
                    "viewers",
                    "latestVersion",
                    "path",
                    "url",
                    "shareUrl",
                    "kind",
                    "permissions",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "public",
                      "members"
                    ]
                  },
                  "guestComments": {
                    "type": "boolean"
                  },
                  "guestWrites": {
                    "type": "boolean"
                  },
                  "viewers": {
                    "type": "object",
                    "properties": {
                      "files": {
                        "type": "boolean"
                      },
                      "history": {
                        "type": "boolean"
                      },
                      "data": {
                        "type": "boolean"
                      },
                      "dbRead": {
                        "type": "boolean"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/head": {
      "get": {
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "latestVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "commentsUpdatedAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "latestVersion",
                    "commentsUpdatedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/push/plan": {
      "post": {
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "baseVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      }
                    },
                    "diff": {
                      "type": "object",
                      "properties": {
                        "added": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "changed": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "removed": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "added",
                        "changed",
                        "removed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "baseVersion",
                    "missing",
                    "diff"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "files": {
                    "maxItems": 5000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 512
                        },
                        "sha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 16777216
                        }
                      },
                      "required": [
                        "path",
                        "sha256",
                        "size"
                      ]
                    }
                  }
                },
                "required": [
                  "files"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/blobs/{sha256}": {
      "put": {
        "summary": "server verifies the hash",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sha256",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        },
        "description": "Request: raw file bytes"
      }
    },
    "/v1/spaces/{id}/versions": {
      "post": {
        "summary": "409 if a listed blob is missing",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "version": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "number": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "message": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "pushedBy": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "handle": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "handle",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "added": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "changed": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "removed": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "createdAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "number",
                            "message",
                            "pushedBy",
                            "added",
                            "changed",
                            "removed",
                            "createdAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "diff": {
                      "type": "object",
                      "properties": {
                        "added": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "changed": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "removed": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "added",
                        "changed",
                        "removed"
                      ],
                      "additionalProperties": false
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "version",
                    "diff",
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "files": {
                    "maxItems": 5000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 512
                        },
                        "sha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 16777216
                        }
                      },
                      "required": [
                        "path",
                        "sha256",
                        "size"
                      ]
                    }
                  },
                  "message": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "files"
                ]
              }
            }
          }
        }
      },
      "get": {
        "summary": "newest first",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "versions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "number": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "message": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "pushedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "handle": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "handle",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "added": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "changed": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "removed": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "number",
                          "message",
                          "pushedBy",
                          "added",
                          "changed",
                          "removed",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "versions"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/versions/{n}": {
      "get": {
        "summary": "n = number or \"latest\"",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "n",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "message": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "pushedBy": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        "added": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "changed": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "removed": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "createdAt": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "number",
                        "message",
                        "pushedBy",
                        "added",
                        "changed",
                        "removed",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    },
                    "files": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string"
                          },
                          "sha256": {
                            "type": "string"
                          },
                          "size": {
                            "type": "number"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "markdown",
                              "html",
                              "asset"
                            ]
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "path",
                          "sha256",
                          "size",
                          "kind",
                          "title"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "diff": {
                      "type": "object",
                      "properties": {
                        "added": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "changed": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "removed": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "added",
                        "changed",
                        "removed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "version",
                    "files",
                    "diff"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/files/{path}": {
      "get": {
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "versionNumber": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "file": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string"
                        },
                        "sha256": {
                          "type": "string"
                        },
                        "size": {
                          "type": "number"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "markdown",
                            "html",
                            "asset"
                          ]
                        },
                        "title": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "path",
                        "sha256",
                        "size",
                        "kind",
                        "title"
                      ],
                      "additionalProperties": false
                    },
                    "content": {
                      "type": "string"
                    },
                    "rawUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "versionNumber",
                    "file",
                    "content",
                    "rawUrl"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "description": "Request: ?v=<n>"
      }
    },
    "/v1/spaces/{id}/history/{path}": {
      "get": {
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "versionNumber": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "change": {
                            "type": "string",
                            "enum": [
                              "added",
                              "changed",
                              "removed"
                            ]
                          },
                          "sha256": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "pushedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "handle": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "handle",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "versionNumber",
                          "change",
                          "sha256",
                          "pushedBy",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "entries"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/comments": {
      "get": {
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "default": "open",
              "type": "string",
              "enum": [
                "open",
                "resolved",
                "all"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "threads": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "versionNumber": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "parentId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "author": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "handle": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "handle",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "guestName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "origin": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "ip": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 64
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "country": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 8
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "region": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 120
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "city": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 120
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "colo": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 8
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "asn": {
                                    "anyOf": [
                                      {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "userAgent": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 200
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "ip",
                                  "country",
                                  "region",
                                  "city",
                                  "colo",
                                  "asn",
                                  "userAgent"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "body": {
                            "type": "string"
                          },
                          "quote": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "anchor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "exact": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  },
                                  "prefix": {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  "suffix": {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  "start": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "exact",
                                  "prefix",
                                  "suffix",
                                  "start"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "via": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "resolvedAt": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "resolvedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "handle": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "handle",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "resolvedVia": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "editedAt": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "editedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "handle": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "handle",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "editedVia": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "revisions": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "replies": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "path": {
                                  "type": "string"
                                },
                                "versionNumber": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "parentId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "author": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "handle": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "handle",
                                    "name"
                                  ],
                                  "additionalProperties": false
                                },
                                "guestName": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "origin": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "ip": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 64
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "country": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 8
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "region": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 120
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "city": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 120
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "colo": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 8
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "asn": {
                                          "anyOf": [
                                            {
                                              "type": "integer",
                                              "minimum": -9007199254740991,
                                              "maximum": 9007199254740991
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "userAgent": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 200
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      },
                                      "required": [
                                        "ip",
                                        "country",
                                        "region",
                                        "city",
                                        "colo",
                                        "asn",
                                        "userAgent"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "body": {
                                  "type": "string"
                                },
                                "quote": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "anchor": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "exact": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 2000
                                        },
                                        "prefix": {
                                          "type": "string",
                                          "maxLength": 64
                                        },
                                        "suffix": {
                                          "type": "string",
                                          "maxLength": 64
                                        },
                                        "start": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "exact",
                                        "prefix",
                                        "suffix",
                                        "start"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "via": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "resolvedAt": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "resolvedBy": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "handle": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "handle",
                                        "name"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "resolvedVia": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "editedAt": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "editedBy": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "handle": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "handle",
                                        "name"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "editedVia": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "revisions": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "createdAt": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "id",
                                "path",
                                "versionNumber",
                                "parentId",
                                "author",
                                "guestName",
                                "origin",
                                "body",
                                "quote",
                                "anchor",
                                "via",
                                "resolvedAt",
                                "resolvedBy",
                                "resolvedVia",
                                "editedAt",
                                "editedBy",
                                "editedVia",
                                "revisions",
                                "createdAt"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "id",
                          "path",
                          "versionNumber",
                          "parentId",
                          "author",
                          "guestName",
                          "origin",
                          "body",
                          "quote",
                          "anchor",
                          "via",
                          "resolvedAt",
                          "resolvedBy",
                          "resolvedVia",
                          "editedAt",
                          "editedBy",
                          "editedVia",
                          "revisions",
                          "createdAt",
                          "replies"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "threads"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "signed in + canComment, or a `guest` when the space allows guest comments (20 per ip per 10 min)",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string"
                    },
                    "versionNumber": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "parentId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "author": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "handle": {
                          "type": "string"
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "handle",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "guestName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "origin": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ip": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 64
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "country": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 8
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "region": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 120
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "city": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 120
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "colo": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 8
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "asn": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "userAgent": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "ip",
                            "country",
                            "region",
                            "city",
                            "colo",
                            "asn",
                            "userAgent"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "body": {
                      "type": "string"
                    },
                    "quote": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "anchor": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "exact": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            },
                            "prefix": {
                              "type": "string",
                              "maxLength": 64
                            },
                            "suffix": {
                              "type": "string",
                              "maxLength": 64
                            },
                            "start": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "exact",
                            "prefix",
                            "suffix",
                            "start"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "via": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolvedAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "resolvedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "resolvedVia": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "editedAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "editedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "editedVia": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "revisions": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "path",
                    "versionNumber",
                    "parentId",
                    "author",
                    "guestName",
                    "origin",
                    "body",
                    "quote",
                    "anchor",
                    "via",
                    "resolvedAt",
                    "resolvedBy",
                    "resolvedVia",
                    "editedAt",
                    "editedBy",
                    "editedVia",
                    "revisions",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "minLength": 1
                  },
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "quote": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "anchor": {
                    "type": "object",
                    "properties": {
                      "exact": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      },
                      "prefix": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "suffix": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "start": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "exact",
                      "prefix",
                      "suffix",
                      "start"
                    ]
                  },
                  "parentId": {
                    "type": "string"
                  },
                  "versionNumber": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "guest": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      },
                      "key": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{22,64}$"
                      }
                    },
                    "required": [
                      "name",
                      "key"
                    ]
                  }
                },
                "required": [
                  "path",
                  "body"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/comments/{id}": {
      "patch": {
        "summary": "author only (a guest: with their key); old text kept as a revision",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string"
                    },
                    "versionNumber": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "parentId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "author": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "handle": {
                          "type": "string"
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "handle",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "guestName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "origin": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ip": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 64
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "country": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 8
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "region": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 120
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "city": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 120
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "colo": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 8
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "asn": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "userAgent": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "ip",
                            "country",
                            "region",
                            "city",
                            "colo",
                            "asn",
                            "userAgent"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "body": {
                      "type": "string"
                    },
                    "quote": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "anchor": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "exact": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            },
                            "prefix": {
                              "type": "string",
                              "maxLength": 64
                            },
                            "suffix": {
                              "type": "string",
                              "maxLength": 64
                            },
                            "start": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "exact",
                            "prefix",
                            "suffix",
                            "start"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "via": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolvedAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "resolvedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "resolvedVia": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "editedAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "editedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "editedVia": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "revisions": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "path",
                    "versionNumber",
                    "parentId",
                    "author",
                    "guestName",
                    "origin",
                    "body",
                    "quote",
                    "anchor",
                    "via",
                    "resolvedAt",
                    "resolvedBy",
                    "resolvedVia",
                    "editedAt",
                    "editedBy",
                    "editedVia",
                    "revisions",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "guest": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{22,64}$"
                      }
                    },
                    "required": [
                      "key"
                    ]
                  }
                },
                "required": [
                  "body"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "summary": "author (a guest: with their key), or canPush; deletes the replies too",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "guest": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{22,64}$"
                      }
                    },
                    "required": [
                      "key"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/comments/{id}/revisions": {
      "get": {
        "summary": "every version, oldest first (empty if never edited)",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "revisions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "number": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "body": {
                            "type": "string"
                          },
                          "author": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "handle": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "handle",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "via": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "number",
                          "body",
                          "author",
                          "via",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "revisions"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/comments/{id}/resolve": {
      "post": {
        "summary": "thread author, or canPush on the space (403 otherwise)",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string"
                    },
                    "versionNumber": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "parentId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "author": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "handle": {
                          "type": "string"
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "handle",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "guestName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "origin": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ip": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 64
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "country": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 8
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "region": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 120
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "city": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 120
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "colo": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 8
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "asn": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "userAgent": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "ip",
                            "country",
                            "region",
                            "city",
                            "colo",
                            "asn",
                            "userAgent"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "body": {
                      "type": "string"
                    },
                    "quote": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "anchor": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "exact": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            },
                            "prefix": {
                              "type": "string",
                              "maxLength": 64
                            },
                            "suffix": {
                              "type": "string",
                              "maxLength": 64
                            },
                            "start": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "exact",
                            "prefix",
                            "suffix",
                            "start"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "via": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolvedAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "resolvedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "resolvedVia": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "editedAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "editedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "editedVia": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "revisions": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "path",
                    "versionNumber",
                    "parentId",
                    "author",
                    "guestName",
                    "origin",
                    "body",
                    "quote",
                    "anchor",
                    "via",
                    "resolvedAt",
                    "resolvedBy",
                    "resolvedVia",
                    "editedAt",
                    "editedBy",
                    "editedVia",
                    "revisions",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/comments/{id}/unresolve": {
      "post": {
        "summary": "thread author, or canPush on the space (403 otherwise)",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string"
                    },
                    "versionNumber": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "parentId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "author": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "handle": {
                          "type": "string"
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "handle",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "guestName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "origin": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ip": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 64
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "country": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 8
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "region": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 120
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "city": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 120
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "colo": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 8
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "asn": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "userAgent": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "ip",
                            "country",
                            "region",
                            "city",
                            "colo",
                            "asn",
                            "userAgent"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "body": {
                      "type": "string"
                    },
                    "quote": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "anchor": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "exact": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            },
                            "prefix": {
                              "type": "string",
                              "maxLength": 64
                            },
                            "suffix": {
                              "type": "string",
                              "maxLength": 64
                            },
                            "start": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "exact",
                            "prefix",
                            "suffix",
                            "start"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "via": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolvedAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "resolvedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "resolvedVia": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "editedAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "editedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "editedVia": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "revisions": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "path",
                    "versionNumber",
                    "parentId",
                    "author",
                    "guestName",
                    "origin",
                    "body",
                    "quote",
                    "anchor",
                    "via",
                    "resolvedAt",
                    "resolvedBy",
                    "resolvedVia",
                    "editedAt",
                    "editedBy",
                    "editedVia",
                    "revisions",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/db/query": {
      "post": {
        "summary": "view; write: true needs push (401 signed out / 403, never downgraded)",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "columns": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "$blob": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "$blob"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      }
                    },
                    "rowsRead": {
                      "type": "number"
                    },
                    "rowsWritten": {
                      "type": "number"
                    },
                    "truncated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "columns",
                    "rows",
                    "rowsRead",
                    "rowsWritten",
                    "truncated"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "sql": {
                    "type": "string",
                    "minLength": 1
                  },
                  "params": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "$blob": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "$blob"
                          ]
                        }
                      ]
                    }
                  },
                  "write": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "sql"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/db": {
      "get": {
        "summary": "view; tables, columns, row counts, size",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "tables": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "columns": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "string"
                                },
                                "notnull": {
                                  "type": "boolean"
                                },
                                "pk": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "name",
                                "type",
                                "notnull",
                                "pk"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "rowCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "name",
                          "columns",
                          "rowCount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "databaseSize": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "tables",
                    "databaseSize"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/db/exists": {
      "get": {
        "summary": "view; { hasTables }, no row counts",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "hasTables": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "hasTables"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/db/guest-writes": {
      "get": {
        "summary": "push; the named writes guests may run",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "statements": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[A-Za-z][A-Za-z0-9_]{0,63}$"
                          },
                          "sql": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "name",
                          "sql"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "statements"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "push; replaces the set; each must be one write statement",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "statements": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[A-Za-z][A-Za-z0-9_]{0,63}$"
                          },
                          "sql": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "name",
                          "sql"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "statements"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "statements": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[A-Za-z][A-Za-z0-9_]{0,63}$"
                        },
                        "sql": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "name",
                        "sql"
                      ]
                    }
                  }
                },
                "required": [
                  "statements"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/db/writes": {
      "get": {
        "summary": "push; the write log, newest first, with guest name and origin",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "writes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "at": {
                            "type": "number"
                          },
                          "user": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "handle": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "handle",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "api",
                              "cli",
                              "app",
                              "page",
                              "guest"
                            ]
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "query",
                              "reset",
                              "restore"
                            ]
                          },
                          "statement": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rowsWritten": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "guestName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "guestId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "origin": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "ip": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 64
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "country": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 8
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "region": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 120
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "city": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 120
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "colo": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 8
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "asn": {
                                    "anyOf": [
                                      {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "userAgent": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 200
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "ip",
                                  "country",
                                  "region",
                                  "city",
                                  "colo",
                                  "asn",
                                  "userAgent"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "at",
                          "user",
                          "source",
                          "kind",
                          "statement",
                          "rowsWritten",
                          "guestName",
                          "guestId",
                          "origin"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "writes"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/db/export": {
      "get": {
        "summary": "push; attachment <spaceId>.sql, replays via db/query with write: true",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "text/plain .sql dump"
          }
        }
      }
    },
    "/v1/spaces/{id}/db/reset": {
      "post": {
        "summary": "admin; wipes every table; { before } undoes it via restore",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "before": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "before"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{id}/db/restore": {
      "post": {
        "summary": "admin; point-in-time restore, last 30 days",
        "tags": [
          "Spaces API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "restoredTo": {
                      "type": "number"
                    },
                    "undoBookmark": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "restoredTo",
                    "undoBookmark"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    ]
                  }
                },
                "required": [
                  "at"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/rooms": {
      "get": {
        "summary": "rooms you can view; ?workspace=<slug>",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "workspace",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "rooms": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9a-z]{10}$"
                          },
                          "name": {
                            "type": "string"
                          },
                          "icon": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "template": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "workspace": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "slug": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "slug",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "editor",
                              "commenter",
                              "viewer"
                            ]
                          },
                          "caps": {
                            "type": "object",
                            "properties": {
                              "view": {
                                "type": "boolean"
                              },
                              "comment": {
                                "type": "boolean"
                              },
                              "edit": {
                                "type": "boolean"
                              },
                              "manage": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "view",
                              "comment",
                              "edit",
                              "manage"
                            ],
                            "additionalProperties": false
                          },
                          "linkAccess": {
                            "type": "string",
                            "enum": [
                              "none",
                              "viewer",
                              "commenter",
                              "editor"
                            ]
                          },
                          "aiSuggest": {
                            "type": "boolean"
                          },
                          "latestVersion": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "lastActivity": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lastActivityAt": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "appCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "path": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "icon",
                          "description",
                          "template",
                          "workspace",
                          "role",
                          "caps",
                          "linkAccess",
                          "aiSuggest",
                          "latestVersion",
                          "lastActivity",
                          "lastActivityAt",
                          "appCount",
                          "path",
                          "url",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "rooms"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "workspace member; plan room limit (403 past it)",
        "tags": [
          "Rooms API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "icon": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "template": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "slug",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "editor",
                        "commenter",
                        "viewer"
                      ]
                    },
                    "caps": {
                      "type": "object",
                      "properties": {
                        "view": {
                          "type": "boolean"
                        },
                        "comment": {
                          "type": "boolean"
                        },
                        "edit": {
                          "type": "boolean"
                        },
                        "manage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "view",
                        "comment",
                        "edit",
                        "manage"
                      ],
                      "additionalProperties": false
                    },
                    "linkAccess": {
                      "type": "string",
                      "enum": [
                        "none",
                        "viewer",
                        "commenter",
                        "editor"
                      ]
                    },
                    "aiSuggest": {
                      "type": "boolean"
                    },
                    "latestVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "lastActivity": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "lastActivityAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "appCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "path": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "icon",
                    "description",
                    "template",
                    "workspace",
                    "role",
                    "caps",
                    "linkAccess",
                    "aiSuggest",
                    "latestVersion",
                    "lastActivity",
                    "lastActivityAt",
                    "appCount",
                    "path",
                    "url",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "workspace": {
                    "type": "string",
                    "pattern": "^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$"
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "prompt": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "template": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "invites": {
                    "default": [],
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "to": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "role": {
                          "default": "editor",
                          "type": "string",
                          "enum": [
                            "editor",
                            "commenter",
                            "viewer"
                          ]
                        }
                      },
                      "required": [
                        "to"
                      ]
                    }
                  }
                },
                "required": [
                  "workspace"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/rooms/{id}": {
      "get": {
        "summary": "view",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "icon": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "template": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "slug",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "editor",
                        "commenter",
                        "viewer"
                      ]
                    },
                    "caps": {
                      "type": "object",
                      "properties": {
                        "view": {
                          "type": "boolean"
                        },
                        "comment": {
                          "type": "boolean"
                        },
                        "edit": {
                          "type": "boolean"
                        },
                        "manage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "view",
                        "comment",
                        "edit",
                        "manage"
                      ],
                      "additionalProperties": false
                    },
                    "linkAccess": {
                      "type": "string",
                      "enum": [
                        "none",
                        "viewer",
                        "commenter",
                        "editor"
                      ]
                    },
                    "aiSuggest": {
                      "type": "boolean"
                    },
                    "latestVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "lastActivity": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "lastActivityAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "appCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "path": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "icon",
                    "description",
                    "template",
                    "workspace",
                    "role",
                    "caps",
                    "linkAccess",
                    "aiSuggest",
                    "latestVersion",
                    "lastActivity",
                    "lastActivityAt",
                    "appCount",
                    "path",
                    "url",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "manage",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "icon": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "template": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "slug",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "editor",
                        "commenter",
                        "viewer"
                      ]
                    },
                    "caps": {
                      "type": "object",
                      "properties": {
                        "view": {
                          "type": "boolean"
                        },
                        "comment": {
                          "type": "boolean"
                        },
                        "edit": {
                          "type": "boolean"
                        },
                        "manage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "view",
                        "comment",
                        "edit",
                        "manage"
                      ],
                      "additionalProperties": false
                    },
                    "linkAccess": {
                      "type": "string",
                      "enum": [
                        "none",
                        "viewer",
                        "commenter",
                        "editor"
                      ]
                    },
                    "aiSuggest": {
                      "type": "boolean"
                    },
                    "latestVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "lastActivity": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "lastActivityAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "appCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "path": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "icon",
                    "description",
                    "template",
                    "workspace",
                    "role",
                    "caps",
                    "linkAccess",
                    "aiSuggest",
                    "latestVersion",
                    "lastActivity",
                    "lastActivityAt",
                    "appCount",
                    "path",
                    "url",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "icon": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 8
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "linkAccess": {
                    "type": "string",
                    "enum": [
                      "none",
                      "viewer",
                      "commenter",
                      "editor"
                    ]
                  },
                  "aiSuggest": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "manage",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/rooms/{id}/markdown": {
      "get": {
        "summary": "view; every page, for agents and export",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "text/markdown"
          }
        }
      }
    },
    "/v1/rooms/{id}/messages/{messageId}/report": {
      "post": {
        "summary": "view, signed in; keeps a copy of the message; 404 unknown message",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/rooms/{id}/messages/{messageId}": {
      "delete": {
        "summary": "the message's author, or manage; sockets get chat.deleted",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/rooms/{id}/ticket": {
      "post": {
        "summary": "view; short-lived signed ticket for the WebSocket",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "url",
                    "expiresAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/rooms/{id}/ws": {
      "get": {
        "summary": "Yjs doc sync, chat, presence, AI suggestions; access re-checked",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "WebSocket (RoomDO)"
          }
        },
        "description": "Request: ?ticket="
      }
    },
    "/v1/rooms/{id}/people": {
      "get": {
        "summary": "view; pending invites only for manage",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "members": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "user": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "handle": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "handle",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "editor",
                              "commenter",
                              "viewer"
                            ]
                          },
                          "via": {
                            "type": "string",
                            "enum": [
                              "workspace",
                              "room",
                              "link"
                            ]
                          }
                        },
                        "required": [
                          "user",
                          "role",
                          "via"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "invites": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "editor",
                              "commenter",
                              "viewer"
                            ]
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "expiresAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "email",
                          "role",
                          "createdAt",
                          "expiresAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "members",
                    "invites"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "manage; handle adds a member, email makes an invite link",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "member": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "user": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "handle": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "handle",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "owner",
                                "editor",
                                "commenter",
                                "viewer"
                              ]
                            },
                            "via": {
                              "type": "string",
                              "enum": [
                                "workspace",
                                "room",
                                "link"
                              ]
                            }
                          },
                          "required": [
                            "user",
                            "role",
                            "via"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "invite": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "owner",
                                "editor",
                                "commenter",
                                "viewer"
                              ]
                            },
                            "createdAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "url": {
                              "type": "string"
                            },
                            "emailed": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "id",
                            "email",
                            "role",
                            "createdAt",
                            "expiresAt",
                            "url",
                            "emailed"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "member",
                    "invite"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "role": {
                    "default": "editor",
                    "type": "string",
                    "enum": [
                      "editor",
                      "commenter",
                      "viewer"
                    ]
                  }
                },
                "required": [
                  "to"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/rooms/{id}/people/{handle}": {
      "patch": {
        "summary": "manage",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "handle",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "editor",
                      "commenter",
                      "viewer"
                    ]
                  }
                },
                "required": [
                  "role"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "summary": "manage, or yourself (leave)",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "handle",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/rooms/{id}/invites/{inviteId}": {
      "delete": {
        "summary": "manage",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "inviteId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/room-invites/accept": {
      "post": {
        "summary": "signed in; token stored hashed, single use",
        "tags": [
          "Rooms API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "roomId": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    }
                  },
                  "required": [
                    "roomId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 200
                  }
                },
                "required": [
                  "token"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/rooms/{id}/sources": {
      "get": {
        "summary": "view",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "sources": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "contentType": {
                            "type": "string"
                          },
                          "size": {
                            "type": "number"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "ready",
                              "unreadable"
                            ]
                          },
                          "summary": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "extractedChars": {
                            "type": "number"
                          },
                          "hiddenFromAi": {
                            "type": "boolean"
                          },
                          "uploadedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "handle": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "handle",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "contentType",
                          "size",
                          "status",
                          "summary",
                          "extractedChars",
                          "hiddenFromAi",
                          "uploadedBy",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "sources"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "comment; MAX_SOURCE_BYTES; bytes in R2, never on the content origin",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "contentType": {
                      "type": "string"
                    },
                    "size": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "unreadable"
                      ]
                    },
                    "summary": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "extractedChars": {
                      "type": "number"
                    },
                    "hiddenFromAi": {
                      "type": "boolean"
                    },
                    "uploadedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "contentType",
                    "size",
                    "status",
                    "summary",
                    "extractedChars",
                    "hiddenFromAi",
                    "uploadedBy",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "description": "Request: multipart file"
      }
    },
    "/v1/rooms/{id}/sources/{sourceId}/raw": {
      "get": {
        "summary": "view",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "file bytes"
          }
        }
      }
    },
    "/v1/rooms/{id}/sources/{sourceId}": {
      "patch": {
        "summary": "edit; { hiddenFromAi }",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "contentType": {
                      "type": "string"
                    },
                    "size": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "unreadable"
                      ]
                    },
                    "summary": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "extractedChars": {
                      "type": "number"
                    },
                    "hiddenFromAi": {
                      "type": "boolean"
                    },
                    "uploadedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "handle": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "handle",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "contentType",
                    "size",
                    "status",
                    "summary",
                    "extractedChars",
                    "hiddenFromAi",
                    "uploadedBy",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "hiddenFromAi": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "hiddenFromAi"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "summary": "edit, or the uploader",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/rooms/{id}/build": {
      "post": {
        "summary": "edit; new app, or { appId } to rebuild its preview",
        "tags": [
          "Rooms API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "app": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "draft",
                            "preview",
                            "live",
                            "paused"
                          ]
                        },
                        "room": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^[0-9a-z]{10}$"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        "previewSpaceId": {
                          "type": "string",
                          "pattern": "^[0-9a-z]{10}$"
                        },
                        "previewVersion": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "liveVersion": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "liveUrl": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "access": {
                          "type": "string",
                          "enum": [
                            "public",
                            "code",
                            "private"
                          ]
                        },
                        "joinCode": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "build": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": [
                                "idle",
                                "building",
                                "ready",
                                "error"
                              ]
                            },
                            "message": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "log": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "at": {
                                    "type": "number"
                                  },
                                  "text": {
                                    "type": "string"
                                  },
                                  "ok": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "at",
                                  "text",
                                  "ok"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "status",
                            "message",
                            "log"
                          ],
                          "additionalProperties": false
                        },
                        "canManage": {
                          "type": "boolean"
                        },
                        "createdAt": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "kind",
                        "slug",
                        "status",
                        "room",
                        "previewSpaceId",
                        "previewVersion",
                        "liveVersion",
                        "liveUrl",
                        "access",
                        "joinCode",
                        "build",
                        "canManage",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "app"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "pageId": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "instructions": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "appId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps": {
      "get": {
        "summary": "apps in rooms you can view",
        "tags": [
          "Apps API"
        ],
        "parameters": [
          {
            "name": "workspace",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$"
            }
          },
          {
            "name": "room",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-z]{10}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "apps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "preview",
                              "live",
                              "paused"
                            ]
                          },
                          "room": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^[0-9a-z]{10}$"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "previewSpaceId": {
                            "type": "string",
                            "pattern": "^[0-9a-z]{10}$"
                          },
                          "previewVersion": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "liveVersion": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "liveUrl": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "access": {
                            "type": "string",
                            "enum": [
                              "public",
                              "code",
                              "private"
                            ]
                          },
                          "joinCode": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "build": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string",
                                "enum": [
                                  "idle",
                                  "building",
                                  "ready",
                                  "error"
                                ]
                              },
                              "message": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "log": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "at": {
                                      "type": "number"
                                    },
                                    "text": {
                                      "type": "string"
                                    },
                                    "ok": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "at",
                                    "text",
                                    "ok"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "status",
                              "message",
                              "log"
                            ],
                            "additionalProperties": false
                          },
                          "canManage": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "kind",
                          "slug",
                          "status",
                          "room",
                          "previewSpaceId",
                          "previewVersion",
                          "liveVersion",
                          "liveUrl",
                          "access",
                          "joinCode",
                          "build",
                          "canManage",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "apps"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{id}": {
      "get": {
        "summary": "view on the room",
        "tags": [
          "Apps API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "preview",
                        "live",
                        "paused"
                      ]
                    },
                    "room": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[0-9a-z]{10}$"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "previewSpaceId": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    },
                    "previewVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "liveVersion": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "liveUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "access": {
                      "type": "string",
                      "enum": [
                        "public",
                        "code",
                        "private"
                      ]
                    },
                    "joinCode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "build": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "idle",
                            "building",
                            "ready",
                            "error"
                          ]
                        },
                        "message": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "log": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "at": {
                                "type": "number"
                              },
                              "text": {
                                "type": "string"
                              },
                              "ok": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "at",
                              "text",
                              "ok"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "status",
                        "message",
                        "log"
                      ],
                      "additionalProperties": false
                    },
                    "canManage": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "slug",
                    "status",
                    "room",
                    "previewSpaceId",
                    "previewVersion",
                    "liveVersion",
                    "liveUrl",
                    "access",
                    "joinCode",
                    "build",
                    "canManage",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "manage (name, access, join code)",
        "tags": [
          "Apps API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "preview",
                        "live",
                        "paused"
                      ]
                    },
                    "room": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[0-9a-z]{10}$"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "previewSpaceId": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    },
                    "previewVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "liveVersion": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "liveUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "access": {
                      "type": "string",
                      "enum": [
                        "public",
                        "code",
                        "private"
                      ]
                    },
                    "joinCode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "build": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "idle",
                            "building",
                            "ready",
                            "error"
                          ]
                        },
                        "message": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "log": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "at": {
                                "type": "number"
                              },
                              "text": {
                                "type": "string"
                              },
                              "ok": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "at",
                              "text",
                              "ok"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "status",
                        "message",
                        "log"
                      ],
                      "additionalProperties": false
                    },
                    "canManage": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "slug",
                    "status",
                    "room",
                    "previewSpaceId",
                    "previewVersion",
                    "liveVersion",
                    "liveUrl",
                    "access",
                    "joinCode",
                    "build",
                    "canManage",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "access": {
                    "type": "string",
                    "enum": [
                      "public",
                      "code",
                      "private"
                    ]
                  },
                  "newJoinCode": {
                    "type": "boolean"
                  },
                  "paused": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "manage",
        "tags": [
          "Apps API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/v1/apps/{id}/live": {
      "post": {
        "summary": "manage; first go-live, plan live-app limit",
        "tags": [
          "Apps API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "preview",
                        "live",
                        "paused"
                      ]
                    },
                    "room": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[0-9a-z]{10}$"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "previewSpaceId": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    },
                    "previewVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "liveVersion": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "liveUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "access": {
                      "type": "string",
                      "enum": [
                        "public",
                        "code",
                        "private"
                      ]
                    },
                    "joinCode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "build": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "idle",
                            "building",
                            "ready",
                            "error"
                          ]
                        },
                        "message": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "log": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "at": {
                                "type": "number"
                              },
                              "text": {
                                "type": "string"
                              },
                              "ok": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "at",
                              "text",
                              "ok"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "status",
                        "message",
                        "log"
                      ],
                      "additionalProperties": false
                    },
                    "canManage": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "slug",
                    "status",
                    "room",
                    "previewSpaceId",
                    "previewVersion",
                    "liveVersion",
                    "liveUrl",
                    "access",
                    "joinCode",
                    "build",
                    "canManage",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "access": {
                    "default": "code",
                    "type": "string",
                    "enum": [
                      "public",
                      "code",
                      "private"
                    ]
                  },
                  "copyData": {
                    "default": false,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{id}/promote": {
      "post": {
        "summary": "manage; live = latest preview version",
        "tags": [
          "Apps API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "preview",
                        "live",
                        "paused"
                      ]
                    },
                    "room": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[0-9a-z]{10}$"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "previewSpaceId": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    },
                    "previewVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "liveVersion": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "liveUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "access": {
                      "type": "string",
                      "enum": [
                        "public",
                        "code",
                        "private"
                      ]
                    },
                    "joinCode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "build": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "idle",
                            "building",
                            "ready",
                            "error"
                          ]
                        },
                        "message": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "log": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "at": {
                                "type": "number"
                              },
                              "text": {
                                "type": "string"
                              },
                              "ok": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "at",
                              "text",
                              "ok"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "status",
                        "message",
                        "log"
                      ],
                      "additionalProperties": false
                    },
                    "canManage": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "slug",
                    "status",
                    "room",
                    "previewSpaceId",
                    "previewVersion",
                    "liveVersion",
                    "liveUrl",
                    "access",
                    "joinCode",
                    "build",
                    "canManage",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{id}/rollback": {
      "post": {
        "summary": "manage",
        "tags": [
          "Apps API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "preview",
                        "live",
                        "paused"
                      ]
                    },
                    "room": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[0-9a-z]{10}$"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "previewSpaceId": {
                      "type": "string",
                      "pattern": "^[0-9a-z]{10}$"
                    },
                    "previewVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "liveVersion": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "liveUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "access": {
                      "type": "string",
                      "enum": [
                        "public",
                        "code",
                        "private"
                      ]
                    },
                    "joinCode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "build": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "idle",
                            "building",
                            "ready",
                            "error"
                          ]
                        },
                        "message": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "log": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "at": {
                                "type": "number"
                              },
                              "text": {
                                "type": "string"
                              },
                              "ok": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "at",
                              "text",
                              "ok"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "status",
                        "message",
                        "log"
                      ],
                      "additionalProperties": false
                    },
                    "canManage": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "slug",
                    "status",
                    "room",
                    "previewSpaceId",
                    "previewVersion",
                    "liveVersion",
                    "liveUrl",
                    "access",
                    "joinCode",
                    "build",
                    "canManage",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "deploy": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "deploy"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/apps/{id}/deploys": {
      "get": {
        "summary": "view",
        "tags": [
          "Apps API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "deploys": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "number": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "previewVersion": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "deployedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "handle": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "handle",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "number",
                          "previewVersion",
                          "deployedBy",
                          "note",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "deploys"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{id}/users": {
      "get": {
        "summary": "manage; the app's end users",
        "tags": [
          "Apps API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "users": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "user",
                              "admin"
                            ]
                          },
                          "lastSeenAt": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "role",
                          "lastSeenAt",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "users"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{id}/owner-link": {
      "post": {
        "summary": "edit; signed 10-minute admin link into the live app",
        "tags": [
          "Apps API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "url",
                    "expiresAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{id}/export": {
      "get": {
        "summary": "manage; Hono + D1 project, deploys with wrangler",
        "tags": [
          "Apps API"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "application/zip"
          }
        }
      }
    },
    "/v1/workspaces/{slug}/billing": {
      "get": {
        "summary": "workspace member",
        "tags": [
          "Billing API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": "string",
                      "enum": [
                        "free",
                        "pro",
                        "team",
                        "enterprise"
                      ]
                    },
                    "status": {
                      "type": "string"
                    },
                    "renewsAt": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "seats": {
                          "type": "number"
                        },
                        "rooms": {
                          "type": "number"
                        },
                        "aiMessages": {
                          "type": "number"
                        },
                        "builds": {
                          "type": "number"
                        },
                        "liveApps": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "seats",
                        "rooms",
                        "aiMessages",
                        "builds",
                        "liveApps"
                      ],
                      "additionalProperties": false
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "seats": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "rooms": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "aiMessages": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "builds": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "liveApps": {
                          "type": [
                            "number",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "seats",
                        "rooms",
                        "aiMessages",
                        "builds",
                        "liveApps"
                      ],
                      "additionalProperties": false
                    },
                    "provider": {
                      "type": "string",
                      "enum": [
                        "autumn",
                        "none"
                      ]
                    },
                    "billingConfigured": {
                      "type": "boolean"
                    },
                    "canManage": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "plan",
                    "status",
                    "renewsAt",
                    "usage",
                    "limits",
                    "provider",
                    "billingConfigured",
                    "canManage"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/workspaces/{slug}/billing/checkout": {
      "post": {
        "summary": "owner/admin; Autumn attach (Stripe Checkout URL, or back to Billing); 400 without AUTUMN_SECRET_KEY",
        "tags": [
          "Billing API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "plan": {
                    "type": "string",
                    "enum": [
                      "pro",
                      "team"
                    ]
                  }
                },
                "required": [
                  "plan"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/workspaces/{slug}/billing/portal": {
      "post": {
        "summary": "owner/admin; Stripe customer portal via Autumn; 400 without AUTUMN_SECRET_KEY",
        "tags": [
          "Billing API"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing/webhook": {
      "post": {
        "summary": "Svix signature; 404 while AUTUMN_WEBHOOK_SECRET is unset",
        "tags": [
          "Billing API"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "200"
          }
        },
        "description": "Request: Autumn event"
      }
    }
  }
}
