{
  "openapi": "3.1.0",
  "info": {
    "title": "Lyra API",
    "version": "1",
    "summary": "Read and change pages, comments and databases in a Lyra workspace.",
    "description": "Lyra's REST API lets scripts and services work in a workspace with the same access as the person whose token they use. Send the token as `Authorization: Bearer <token>`. A self-hosted Lyra server serves the same API at its own address. Guides: https://lyra-docs.com/docs/api/",
    "contact": {
      "name": "Lyra support",
      "email": "support@lyra-docs.com",
      "url": "https://lyra-docs.com/docs/api/"
    }
  },
  "externalDocs": {
    "description": "API guides",
    "url": "https://lyra-docs.com/docs/api/"
  },
  "servers": [
    {
      "url": "https://app.lyra-docs.com",
      "description": "Lyra"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Account",
      "description": "The person a token belongs to, and their teamspaces."
    },
    {
      "name": "Search",
      "description": "Find pages and database rows by title and text."
    },
    {
      "name": "Pages",
      "description": "List, create, change, move and trash pages."
    },
    {
      "name": "Content",
      "description": "Read and write what is on a page as Markdown, or change it block by block without touching what others are typing."
    },
    {
      "name": "Comments",
      "description": "Comment threads on a page, their replies, and resolving them."
    },
    {
      "name": "Databases",
      "description": "Describe a database, query its rows with filters and sorts, and add, change or trash rows."
    },
    {
      "name": "Files",
      "description": "Upload files to a page and download them."
    }
  ],
  "paths": {
    "/api/v1/me": {
      "get": {
        "operationId": "getMe",
        "tags": [
          "Account"
        ],
        "summary": "Who the token acts as",
        "description": "Returns the person the token belongs to and the organization it works in. Use it to check a token works.",
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/teamspaces": {
      "get": {
        "operationId": "listTeamspaces",
        "tags": [
          "Account"
        ],
        "summary": "List teamspaces",
        "description": "Lists the teamspaces the person belongs to. List the pages at the top of one with GET /api/v1/pages?teamspaceId=.",
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "teamspaces": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Teamspace"
                      }
                    }
                  },
                  "required": [
                    "teamspaces"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/search": {
      "get": {
        "operationId": "search",
        "tags": [
          "Search"
        ],
        "summary": "Search pages and rows",
        "description": "Searches the titles and text of the pages and database rows the person can see, best matches first.",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "description": "The words to look for",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Only return this kind of page",
            "schema": {
              "type": "string",
              "enum": [
                "doc",
                "database",
                "row"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 10,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SearchResult"
                      }
                    }
                  },
                  "required": [
                    "results"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages": {
      "get": {
        "operationId": "listPages",
        "tags": [
          "Pages"
        ],
        "summary": "List pages",
        "description": "Lists the pages inside a page (parentId), at the top of a teamspace (teamspaceId), or, with neither, at the top of your private pages. Database rows are not listed here; query them with POST /api/v1/databases/{databaseId}/query. Pages come in the order the sidebar shows them, a page of results at a time.",
        "parameters": [
          {
            "name": "parentId",
            "in": "query",
            "required": false,
            "description": "List the pages inside this page",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "teamspaceId",
            "in": "query",
            "required": false,
            "description": "List the pages at the top of this teamspace",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The nextCursor of the previous page. Leave it out for the first page.",
            "schema": {
              "type": "string",
              "maxLength": 4000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "pages": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PageSummary"
                      }
                    },
                    "nextCursor": {
                      "description": "Pass it as cursor to get the next page, or null at the end",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "pages",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createPage",
        "tags": [
          "Pages"
        ],
        "summary": "Create a page",
        "description": "Creates a page from Markdown inside a page (parentId), at the top of a teamspace (teamspaceId), or, with neither, in your private pages. The Markdown can hold Lyra's own blocks, such as cards, columns and Mermaid diagrams. warnings lists each line Lyra read differently from what it looks like you meant; built counts the blocks other than plain text it made. With temporary: true the page moves to the trash on its own after expiresInDays days.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string, up to 200 characters. Send the same key when you retry, and Lyra answers with the first answer instead of doing it twice.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "default": "",
                    "type": "string",
                    "maxLength": 500
                  },
                  "markdown": {
                    "default": "",
                    "type": "string",
                    "maxLength": 200000
                  },
                  "icon": {
                    "type": "string",
                    "maxLength": 16,
                    "description": "An emoji"
                  },
                  "parentId": {
                    "description": "Create it inside this page",
                    "type": "string",
                    "format": "uuid"
                  },
                  "teamspaceId": {
                    "description": "Create it at the top of this teamspace",
                    "type": "string",
                    "format": "uuid"
                  },
                  "temporary": {
                    "default": false,
                    "type": "boolean"
                  },
                  "expiresInDays": {
                    "description": "Days from now until a temporary page moves to the trash, 3 if left out. Only with temporary: true.",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  }
                }
              },
              "example": {
                "title": "Weekly notes",
                "markdown": "# This week\n\n- Shipped the importer\n- Fixed the sign-in email",
                "parentId": "0193a7c2-4b10-7a2d-8e33-1c9f5a7b2d01"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "$ref": "#/components/schemas/Page"
                    },
                    "built": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "integer"
                      },
                      "description": "How many blocks other than plain text the Markdown made, by type, such as {\"card\": 3}"
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MarkdownWarning"
                      }
                    }
                  },
                  "required": [
                    "page",
                    "built",
                    "warnings"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages/{pageId}": {
      "get": {
        "operationId": "getPage",
        "tags": [
          "Pages"
        ],
        "summary": "Get a page",
        "description": "Returns a page's title, where it is and who changed it last. Read what is on it with GET /api/v1/pages/{pageId}/markdown.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updatePage",
        "tags": [
          "Pages"
        ],
        "summary": "Change a page",
        "description": "Changes a page's title or icon, or makes it temporary or keeps it. Only the fields you send change. temporary: true moves it to the trash on its own after expiresInDays days; on a page that is already temporary it starts the days again. temporary: false keeps it until someone deletes it.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "icon": {
                    "description": "An emoji, or null to remove it",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 16,
                        "description": "An emoji"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "temporary": {
                    "type": "boolean"
                  },
                  "expiresInDays": {
                    "description": "Days from now until a temporary page moves to the trash, 3 if left out. Only with temporary: true.",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  }
                }
              },
              "example": {
                "title": "Launch plan (final)",
                "icon": "✅"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages/{pageId}/move": {
      "post": {
        "operationId": "movePage",
        "tags": [
          "Pages"
        ],
        "summary": "Move a page",
        "description": "Moves a page, with everything inside it, to the end of another page (parentId), to the top of a teamspace (teamspaceId), or, with neither, to your private pages. Needs full access to the page and edit access where it goes.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string, up to 200 characters. Send the same key when you retry, and Lyra answers with the first answer instead of doing it twice.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "parentId": {
                    "description": "Move it inside this page",
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "teamspaceId": {
                    "description": "Move it to the top of this teamspace",
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "parentId": "0193a7c2-4b10-7a2d-8e33-1c9f5a7b2d01"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages/{pageId}/trash": {
      "post": {
        "operationId": "trashPage",
        "tags": [
          "Pages"
        ],
        "summary": "Move a page to the trash",
        "description": "Moves a page and everything inside it to the trash. People can restore it from the trash in Lyra, or with POST /api/v1/pages/{pageId}/restore.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string, up to 200 characters. Send the same key when you retry, and Lyra answers with the first answer instead of doing it twice.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages/{pageId}/restore": {
      "post": {
        "operationId": "restorePage",
        "tags": [
          "Pages"
        ],
        "summary": "Restore a page from the trash",
        "description": "Brings a page and everything inside it back from the trash. If the page it was in is still in the trash, it comes back at the top of its teamspace or private pages.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string, up to 200 characters. Send the same key when you retry, and Lyra answers with the first answer instead of doing it twice.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages/{pageId}/markdown": {
      "get": {
        "operationId": "getPageMarkdown",
        "tags": [
          "Content"
        ],
        "summary": "Read a page as Markdown",
        "description": "Returns what is on a page as Markdown. With withIds=true each block starts with a <!-- block:ID --> line, the ids that POST /api/v1/pages/{pageId}/edits takes; Lyra skips these lines in Markdown you send back. heading reads only the section under the first heading that matches, and blockId only that block (for a heading, the section under it).",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "withIds",
            "in": "query",
            "required": false,
            "description": "Start each block with a <!-- block:ID --> line",
            "schema": {
              "default": "false",
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "heading",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 500
            }
          },
          {
            "name": "blockId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "pageId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "markdown": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "pageId",
                    "markdown"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "pageId": "0193a7c2-5d41-7c3e-9a51-6f0d2b8e4a10",
                  "markdown": "# Launch plan\n\nWe launch on the 10th.\n"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "put": {
        "operationId": "replacePageMarkdown",
        "tags": [
          "Content"
        ],
        "summary": "Replace a page with Markdown",
        "description": "Replaces everything on a page with new Markdown, in one change. Comments attached to text that is gone are lost; to change part of a page while others are typing, use POST /api/v1/pages/{pageId}/edits instead. Lyra saves the page as a version first, so it can be put back from the page history.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "markdown": {
                    "type": "string",
                    "maxLength": 200000
                  }
                },
                "required": [
                  "markdown"
                ]
              },
              "example": {
                "markdown": "# Launch plan\n\n:::card\nWe launch on the 10th.\n:::\n"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppliedEdit"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages/{pageId}/edits": {
      "post": {
        "operationId": "editPageBlocks",
        "tags": [
          "Content"
        ],
        "summary": "Change a page block by block",
        "description": "Applies edits in order, by the block ids that GET /api/v1/pages/{pageId}/markdown?withIds=true shows, live and without touching what others are typing elsewhere. insert adds Markdown after or before a block, or at the end; replace swaps one block for new Markdown and keeps its id; delete removes a block; replace_all replaces the whole page. For tables, set_cells, insert_row and delete_row change cells and rows; rows and columns count from 0. The answer lists, for each edit, the top-level blocks it added or changed, the blocks other than plain text it made, and warnings. Lyra saves the page as a version first.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string, up to 200 characters. Send the same key when you retry, and Lyra answers with the first answer instead of doing it twice.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "edits": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "const": "insert"
                            },
                            "markdown": {
                              "type": "string",
                              "maxLength": 100000
                            },
                            "afterBlockId": {
                              "type": "string",
                              "maxLength": 100
                            },
                            "beforeBlockId": {
                              "type": "string",
                              "maxLength": 100
                            }
                          },
                          "required": [
                            "op",
                            "markdown"
                          ],
                          "description": "Add Markdown after or before a block, or at the end of the page"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "const": "replace"
                            },
                            "blockId": {
                              "type": "string",
                              "maxLength": 100
                            },
                            "markdown": {
                              "type": "string",
                              "maxLength": 100000
                            }
                          },
                          "required": [
                            "op",
                            "blockId",
                            "markdown"
                          ],
                          "description": "Replace one block with new Markdown, keeping its id"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "const": "delete"
                            },
                            "blockId": {
                              "type": "string",
                              "maxLength": 100
                            }
                          },
                          "required": [
                            "op",
                            "blockId"
                          ],
                          "description": "Delete one block"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "const": "replace_all"
                            },
                            "markdown": {
                              "type": "string",
                              "maxLength": 100000
                            }
                          },
                          "required": [
                            "op",
                            "markdown"
                          ],
                          "description": "Replace everything on the page with new Markdown"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "const": "set_cells"
                            },
                            "blockId": {
                              "type": "string",
                              "maxLength": 100
                            },
                            "cells": {
                              "minItems": 1,
                              "maxItems": 500,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "row": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "column": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "markdown": {
                                    "type": "string",
                                    "maxLength": 10000,
                                    "description": "One line of Markdown"
                                  }
                                },
                                "required": [
                                  "row",
                                  "column",
                                  "markdown"
                                ]
                              }
                            }
                          },
                          "required": [
                            "op",
                            "blockId",
                            "cells"
                          ],
                          "description": "Change cells of a table"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "const": "insert_row"
                            },
                            "blockId": {
                              "type": "string",
                              "maxLength": 100
                            },
                            "afterRow": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "cells": {
                              "maxItems": 100,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "maxLength": 10000
                              },
                              "description": "One line of Markdown per column; missing columns are left empty"
                            }
                          },
                          "required": [
                            "op",
                            "blockId",
                            "cells"
                          ],
                          "description": "Add a row to a table, after afterRow or at the end"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "const": "delete_row"
                            },
                            "blockId": {
                              "type": "string",
                              "maxLength": 100
                            },
                            "row": {
                              "type": "integer",
                              "minimum": 0
                            }
                          },
                          "required": [
                            "op",
                            "blockId",
                            "row"
                          ],
                          "description": "Remove a row from a table"
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "edits"
                ]
              },
              "example": {
                "edits": [
                  {
                    "op": "insert",
                    "markdown": "## Risks\n\n- The importer is slow on big pages",
                    "afterBlockId": "b2c1"
                  },
                  {
                    "op": "replace",
                    "blockId": "a9f0",
                    "markdown": "We launch on the **12th**."
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "edits": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AppliedEdit"
                      }
                    }
                  },
                  "required": [
                    "edits"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages/{pageId}/threads": {
      "get": {
        "operationId": "listThreads",
        "tags": [
          "Comments"
        ],
        "summary": "List comment threads",
        "description": "Lists up to 200 comment threads on a page, with the text each is attached to and every comment as Markdown. Resolved threads are left out unless includeResolved=true.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "includeResolved",
            "in": "query",
            "required": false,
            "schema": {
              "default": "false",
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "threads": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Thread"
                      }
                    }
                  },
                  "required": [
                    "threads"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createThread",
        "tags": [
          "Comments"
        ],
        "summary": "Start a comment thread",
        "description": "Starts a thread with one comment. Pass blockId, from GET /api/v1/pages/{pageId}/markdown?withIds=true, to attach it to that block's text, and quote to attach it to just that text inside the block, written as it reads without Markdown. Without blockId the comment is about the whole page.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string, up to 200 characters. Send the same key when you retry, and Lyra answers with the first answer instead of doing it twice.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "markdown": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000,
                    "description": "Paragraphs, links, bold, italic, strikethrough and code. Lists, headings and tables become plain paragraphs."
                  },
                  "blockId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "quote": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "markdown"
                ]
              },
              "example": {
                "markdown": "Can we make it **Thursday**?",
                "blockId": "a9f0",
                "quote": "ship on Friday"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommentRef"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages/{pageId}/threads/{threadId}/comments": {
      "post": {
        "operationId": "replyToThread",
        "tags": [
          "Comments"
        ],
        "summary": "Reply to a thread",
        "description": "Adds a comment to the end of a thread.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The thread's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string, up to 200 characters. Send the same key when you retry, and Lyra answers with the first answer instead of doing it twice.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "markdown": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000,
                    "description": "Paragraphs, links, bold, italic, strikethrough and code. Lists, headings and tables become plain paragraphs."
                  }
                },
                "required": [
                  "markdown"
                ]
              },
              "example": {
                "markdown": "Thursday works."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommentRef"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages/{pageId}/threads/{threadId}": {
      "patch": {
        "operationId": "resolveThread",
        "tags": [
          "Comments"
        ],
        "summary": "Resolve or reopen a thread",
        "description": "Marks a thread resolved, or opens it again with resolved: false.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The thread's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "resolved": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "resolved"
                ]
              },
              "example": {
                "resolved": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "threadId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "resolved": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "threadId",
                    "resolved"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteThread",
        "tags": [
          "Comments"
        ],
        "summary": "Delete a thread",
        "description": "Deletes a thread and all its comments for good. You can delete threads you started, and with full access to the page any thread.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The thread's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Done. There is no body.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages/{pageId}/threads/{threadId}/comments/{commentId}": {
      "patch": {
        "operationId": "editComment",
        "tags": [
          "Comments"
        ],
        "summary": "Edit a comment",
        "description": "Replaces the text of a comment you wrote, keeping its place in the thread.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The thread's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "commentId",
            "in": "path",
            "required": true,
            "description": "The comment's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "markdown": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000,
                    "description": "Paragraphs, links, bold, italic, strikethrough and code. Lists, headings and tables become plain paragraphs."
                  }
                },
                "required": [
                  "markdown"
                ]
              },
              "example": {
                "markdown": "Thursday or Friday both work."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommentRef"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteComment",
        "tags": [
          "Comments"
        ],
        "summary": "Delete a comment",
        "description": "Deletes one comment for good. You can delete comments you wrote, and with full access to the page anyone's. Deleting the last comment in a thread deletes the thread.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "description": "The thread's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "commentId",
            "in": "path",
            "required": true,
            "description": "The comment's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Done. There is no body.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/databases/{databaseId}": {
      "get": {
        "operationId": "getDatabase",
        "tags": [
          "Databases"
        ],
        "summary": "Describe a database",
        "description": "Returns a database's properties, with their ids, types, options and formulas, and its views. Rows use the property names as keys.",
        "parameters": [
          {
            "name": "databaseId",
            "in": "path",
            "required": true,
            "description": "The database's id, the same as its page id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Database"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/databases/{databaseId}/query": {
      "post": {
        "operationId": "queryRows",
        "tags": [
          "Databases"
        ],
        "summary": "Query rows",
        "description": "Reads rows a page at a time, optionally through a view, with a filter, sorts and text search. Filters and sorts name properties by name or id, and select options by label. With a viewId, the view's own filter and sorts apply too.",
        "parameters": [
          {
            "name": "databaseId",
            "in": "path",
            "required": true,
            "description": "The database's id, the same as its page id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string, up to 200 characters. Send the same key when you retry, and Lyra answers with the first answer instead of doing it twice.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "viewId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "filter": {
                    "$ref": "#/components/schemas/FilterGroup"
                  },
                  "sorts": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Sort"
                    }
                  },
                  "search": {
                    "description": "Only rows whose text contains these words",
                    "type": "string",
                    "maxLength": 200
                  },
                  "cursor": {
                    "description": "The nextCursor of the previous page. Leave it out for the first page.",
                    "type": "string",
                    "maxLength": 4000
                  },
                  "limit": {
                    "default": 25,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  }
                }
              },
              "example": {
                "filter": {
                  "op": "and",
                  "items": [
                    {
                      "propertyId": "Status",
                      "operator": "equals",
                      "value": "In progress"
                    },
                    {
                      "propertyId": "Due",
                      "operator": "lte",
                      "value": "2026-12-31"
                    }
                  ]
                },
                "sorts": [
                  {
                    "propertyId": "Due",
                    "direction": "asc"
                  }
                ],
                "limit": 25
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Row"
                      }
                    },
                    "nextCursor": {
                      "description": "Pass it as cursor to get the next page, or null at the end",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "rows",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/databases/{databaseId}/rows/{rowId}": {
      "get": {
        "operationId": "getRow",
        "tags": [
          "Databases"
        ],
        "summary": "Get a row",
        "description": "Returns one row's values, keyed by property name. Read the text on the row's page with GET /api/v1/pages/{pageId}/markdown.",
        "parameters": [
          {
            "name": "databaseId",
            "in": "path",
            "required": true,
            "description": "The database's id, the same as its page id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "rowId",
            "in": "path",
            "required": true,
            "description": "The row's id, the same as its page id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Row"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/databases/{databaseId}/rows": {
      "post": {
        "operationId": "addRows",
        "tags": [
          "Databases"
        ],
        "summary": "Add rows",
        "description": "Adds up to 100 rows in one request. Values are keyed by property name or id; computed properties such as formulas can't be set.",
        "parameters": [
          {
            "name": "databaseId",
            "in": "path",
            "required": true,
            "description": "The database's id, the same as its page id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string, up to 200 characters. Send the same key when you retry, and Lyra answers with the first answer instead of doing it twice.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rows": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "default": "",
                          "description": "The row's title, its title property",
                          "type": "string",
                          "maxLength": 2000
                        },
                        "values": {
                          "default": {},
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "additionalProperties": {},
                          "description": "Values keyed by property name or id. select and status: the option label. multi_select: a list of labels. person: a list of emails or user ids. relation: a list of row ids. date: \"2026-11-06\" or {\"start\",\"end\"}. checkbox: true or false."
                        }
                      }
                    }
                  }
                },
                "required": [
                  "rows"
                ]
              },
              "example": {
                "rows": [
                  {
                    "title": "Write the launch post",
                    "values": {
                      "Status": "Not started",
                      "Due": "2026-12-10"
                    }
                  },
                  {
                    "title": "Record the demo",
                    "values": {
                      "Status": "In progress",
                      "Owner": [
                        "sam@example.com"
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rowIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "description": "The new rows, in the order you sent them"
                    }
                  },
                  "required": [
                    "rowIds"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateRows",
        "tags": [
          "Databases"
        ],
        "summary": "Change rows",
        "description": "Changes values on up to 100 rows of the database. Only the properties you send change.",
        "parameters": [
          {
            "name": "databaseId",
            "in": "path",
            "required": true,
            "description": "The database's id, the same as its page id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "updates": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "rowId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "values": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "additionalProperties": {},
                          "description": "Values keyed by property name or id. select and status: the option label. multi_select: a list of labels. person: a list of emails or user ids. relation: a list of row ids. date: \"2026-11-06\" or {\"start\",\"end\"}. checkbox: true or false."
                        }
                      },
                      "required": [
                        "rowId",
                        "values"
                      ]
                    }
                  }
                },
                "required": [
                  "updates"
                ]
              },
              "example": {
                "updates": [
                  {
                    "rowId": "0193a7c5-3333-7aaa-8bbb-000000000004",
                    "values": {
                      "Status": "Done"
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "updated": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "updated"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/databases/{databaseId}/rows/trash": {
      "post": {
        "operationId": "trashRows",
        "tags": [
          "Databases"
        ],
        "summary": "Move rows to the trash",
        "description": "Moves up to 500 rows of the database to the trash, where people can restore them. Ids of rows that are not in this database are skipped; trashed counts the rows that moved.",
        "parameters": [
          {
            "name": "databaseId",
            "in": "path",
            "required": true,
            "description": "The database's id, the same as its page id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string, up to 200 characters. Send the same key when you retry, and Lyra answers with the first answer instead of doing it twice.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rowIds": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "required": [
                  "rowIds"
                ]
              },
              "example": {
                "rowIds": [
                  "0193a7c5-3333-7aaa-8bbb-000000000004"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "trashed": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "trashed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/pages/{pageId}/files": {
      "post": {
        "operationId": "uploadFile",
        "tags": [
          "Files"
        ],
        "summary": "Upload a file",
        "description": "Uploads one file, up to 50 MB, to a page, as multipart/form-data with the file in a field named file. People who can see the page can see the file. Put the markdown from the answer on a line of its own in the page to show it: images as images, and MP4, WebM, MOV, MP3, WAV and OGG files as players. On Lyra Cloud, an organization that has used all the file storage its plan allows gets 403 storage_limit_reached.",
        "parameters": [
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "The page's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The file to upload"
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/files/{fileId}": {
      "get": {
        "operationId": "downloadFile",
        "tags": [
          "Files"
        ],
        "summary": "Download a file",
        "description": "Sends a file's bytes, with its content type. Send a Range header to get part of it. This is the address that page Markdown uses for files, such as `![diagram.png](/api/files/<id>)`, so it is the same with or without /v1.",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "description": "The file's id",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "The part of the file the Range header asked for",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A personal API token from Settings → API tokens. It starts with lyra_pat_ and acts as you, in one organization."
      }
    },
    "headers": {
      "X-RateLimit-Limit": {
        "description": "How many requests the token can send in a minute",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Remaining": {
        "description": "How many it has left this minute",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Reset": {
        "description": "Seconds until the count starts again",
        "schema": {
          "type": "integer"
        }
      },
      "X-Request-Id": {
        "description": "The id of this request. Send it to support if something goes wrong.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The request does not match the schema: a missing field, a wrong type or a value out of range.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "invalid_request",
                "message": "The request is not valid.",
                "issues": [
                  {
                    "instancePath": "/title",
                    "message": "Too big: expected string to have <=500 characters"
                  }
                ]
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "The token is missing, wrong, revoked or expired.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "unauthorized",
                "message": "Please sign in."
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "The token's person can see this, but can't do this to it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "forbidden",
                "message": "You don't have access to do that."
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "It doesn't exist, or the token's person can't see it. The code names what, such as page_not_found.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "page_not_found",
                "message": "This page doesn't exist or you don't have access to it."
              }
            }
          }
        }
      },
      "Conflict": {
        "description": "A request with the same Idempotency-Key is still running.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "request_in_progress",
                "message": "A request with this key is still running."
              }
            }
          }
        }
      },
      "TooLarge": {
        "description": "The page, file or Markdown is too large: page_too_large, file_too_large, or markdown_too_complex for Markdown too long or too deeply nested to read in one go.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "file_too_large",
                "message": "Files can be up to 50 MB."
              }
            }
          }
        }
      },
      "Unprocessable": {
        "description": "The request is well formed but Lyra can't do it, such as a block id that isn't on the page (block_not_found), or an Idempotency-Key used before with a different body (idempotency_key_reused).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "block_not_found",
                "message": "Block 'a9f0' is not on this page"
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "Too many requests. Each token can send 120 requests a minute. Wait for the seconds in Retry-After.",
        "headers": {
          "Retry-After": {
            "description": "Seconds to wait before sending again",
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "rate_limited",
                "message": "Too many requests. Try again in 21 seconds."
              }
            }
          }
        }
      }
    },
    "schemas": {
      "AppliedEdit": {
        "type": "object",
        "properties": {
          "op": {
            "type": "string",
            "enum": [
              "insert",
              "replace",
              "delete",
              "replace_all",
              "set_cells",
              "insert_row",
              "delete_row"
            ]
          },
          "blockIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The top-level blocks the edit added or changed"
          },
          "built": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "integer"
            },
            "description": "How many blocks other than plain text the Markdown made, by type, such as {\"card\": 3}"
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MarkdownWarning"
            }
          }
        },
        "required": [
          "op",
          "blockIds",
          "built",
          "warnings"
        ],
        "additionalProperties": false,
        "description": "What one edit did."
      },
      "Comment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "author": {
            "$ref": "#/components/schemas/Person"
          },
          "markdown": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "author",
          "markdown",
          "createdAt"
        ],
        "additionalProperties": false,
        "description": "One comment in a thread, as Markdown."
      },
      "CommentRef": {
        "type": "object",
        "properties": {
          "threadId": {
            "type": "string",
            "format": "uuid"
          },
          "commentId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "threadId",
          "commentId"
        ],
        "additionalProperties": false
      },
      "Crumb": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "icon": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 16,
                "description": "An emoji"
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "doc",
              "database",
              "row"
            ]
          }
        },
        "required": [
          "id",
          "title",
          "icon",
          "kind"
        ],
        "additionalProperties": false,
        "description": "A page above this one that the token can see."
      },
      "Database": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "properties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Property"
            }
          },
          "views": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/View"
            }
          }
        },
        "required": [
          "id",
          "title",
          "properties",
          "views"
        ],
        "additionalProperties": false,
        "description": "A database's properties and views.",
        "examples": [
          {
            "id": "0193a7c2-5d41-7c3e-9a51-6f0d2b8e4a10",
            "title": "Tasks",
            "properties": [
              {
                "id": "title",
                "name": "Name",
                "type": "title"
              },
              {
                "id": "0193a7c4-1111-7aaa-8bbb-000000000001",
                "name": "Status",
                "type": "status",
                "options": [
                  "Not started",
                  "In progress",
                  "Done"
                ]
              },
              {
                "id": "0193a7c4-1111-7aaa-8bbb-000000000002",
                "name": "Due",
                "type": "date"
              }
            ],
            "views": [
              {
                "id": "0193a7c4-2222-7aaa-8bbb-000000000003",
                "name": "All tasks",
                "type": "table"
              }
            ]
          }
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "A stable code to check in your code, such as page_not_found"
              },
              "message": {
                "type": "string",
                "description": "A sentence for people, which can change"
              },
              "issues": {
                "description": "For invalid_request, each part of the request that was wrong",
                "type": "array",
                "items": {}
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "description": "What went wrong."
      },
      "File": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "description": "Where to download it, with the same token"
          },
          "markdown": {
            "type": "string",
            "description": "Put this on a line of its own in a page to show the file"
          }
        },
        "required": [
          "id",
          "name",
          "contentType",
          "sizeBytes",
          "url",
          "markdown"
        ],
        "additionalProperties": false,
        "description": "A file uploaded to a page.",
        "examples": [
          {
            "id": "0193a7c6-4444-7aaa-8bbb-000000000005",
            "name": "diagram.png",
            "contentType": "image/png",
            "sizeBytes": 48213,
            "url": "https://app.lyra-docs.com/api/files/0193a7c6-4444-7aaa-8bbb-000000000005",
            "markdown": "![diagram.png](/api/files/0193a7c6-4444-7aaa-8bbb-000000000005)"
          }
        ]
      },
      "FilterCondition": {
        "type": "object",
        "properties": {
          "propertyId": {
            "type": "string",
            "maxLength": 200,
            "description": "The property's name or id"
          },
          "operator": {
            "type": "string",
            "enum": [
              "equals",
              "not_equals",
              "contains",
              "not_contains",
              "starts_with",
              "ends_with",
              "is_empty",
              "is_not_empty",
              "gt",
              "gte",
              "lt",
              "lte",
              "any_of",
              "none_of",
              "all_of",
              "within"
            ]
          },
          "value": {
            "description": "For select, status and multi_select, option labels",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "maxItems": 200,
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 200
                }
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "propertyId",
          "operator"
        ],
        "description": "One condition on a property."
      },
      "FilterGroup": {
        "description": "Conditions joined by and or or. Groups can hold other groups.",
        "type": "object",
        "properties": {
          "op": {
            "type": "string",
            "enum": [
              "and",
              "or"
            ]
          },
          "items": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/FilterCondition"
                },
                {
                  "$ref": "#/components/schemas/FilterGroup"
                }
              ]
            }
          }
        },
        "required": [
          "op",
          "items"
        ]
      },
      "MarkdownWarning": {
        "type": "object",
        "properties": {
          "line": {
            "description": "The line of the Markdown it is about, counting from 1",
            "type": "integer"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "additionalProperties": false,
        "description": "A line of Markdown that Lyra read differently from what it looks like you meant, such as a block it does not have or a container that is never closed.",
        "examples": [
          {
            "line": 4,
            "message": "Lyra has no block named callout, so this line shows as text. Its blocks are card, columns, column, timeline, item, arrow, stat, choice."
          }
        ]
      },
      "Me": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": [
                  "admin",
                  "member",
                  "guest"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "role"
            ],
            "additionalProperties": false,
            "description": "The organization the token works in. A token only ever sees this one."
          },
          "token": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "expiresAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "When the token stops working, or null if it never does"
              }
            },
            "required": [
              "id",
              "expiresAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "name",
          "email",
          "organization",
          "token"
        ],
        "additionalProperties": false,
        "description": "The person a token acts as, and the organization it works in.",
        "examples": [
          {
            "id": "0193a7c0-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
            "name": "Sam Lee",
            "email": "sam@example.com",
            "organization": {
              "id": "0193a7bf-0000-7000-8000-00000000aa01",
              "name": "Example Inc",
              "role": "member"
            },
            "token": {
              "id": "0193a7c7-5555-7aaa-8bbb-000000000006",
              "expiresAt": "2027-03-02T09:30:00.000Z"
            }
          }
        ]
      },
      "Page": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "icon": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 16,
                "description": "An emoji"
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "doc",
              "database",
              "row"
            ],
            "description": "doc is a page, database a database, row a row of a database"
          },
          "url": {
            "type": "string",
            "description": "Where the page opens in Lyra"
          },
          "parentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "The page it is inside, or null at the top of a teamspace"
          },
          "teamspaceId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "The teamspace it is in, or null for a private page"
          },
          "databaseId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "For a row, the database it belongs to"
          },
          "role": {
            "type": "string",
            "enum": [
              "view",
              "comment",
              "edit",
              "full"
            ],
            "description": "What the token can do on the page: view < comment < edit < full"
          },
          "breadcrumbs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Crumb"
            },
            "description": "The pages above it, from the top down"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdBy": {
            "$ref": "#/components/schemas/Person"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedBy": {
            "$ref": "#/components/schemas/Person"
          },
          "inTrash": {
            "type": "boolean"
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When a temporary page moves to the trash on its own, or null for a page that stays"
          }
        },
        "required": [
          "id",
          "title",
          "icon",
          "kind",
          "url",
          "parentId",
          "teamspaceId",
          "databaseId",
          "role",
          "breadcrumbs",
          "createdAt",
          "createdBy",
          "updatedAt",
          "updatedBy",
          "inTrash",
          "expiresAt"
        ],
        "additionalProperties": false,
        "description": "A page, database or database row.",
        "examples": [
          {
            "id": "0193a7c2-5d41-7c3e-9a51-6f0d2b8e4a10",
            "title": "Launch plan",
            "icon": "🚀",
            "kind": "doc",
            "url": "https://app.lyra-docs.com/p/0193a7c2-5d41-7c3e-9a51-6f0d2b8e4a10",
            "parentId": "0193a7c2-4b10-7a2d-8e33-1c9f5a7b2d01",
            "teamspaceId": "0193a7c1-9e02-7f41-b6a8-3d5e7c9a1b22",
            "databaseId": null,
            "role": "full",
            "breadcrumbs": [
              {
                "id": "0193a7c2-4b10-7a2d-8e33-1c9f5a7b2d01",
                "title": "Projects",
                "icon": null,
                "kind": "doc"
              }
            ],
            "createdAt": "2026-12-02T09:30:00.000Z",
            "createdBy": {
              "id": "0193a7c0-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
              "name": "Sam Lee"
            },
            "updatedAt": "2026-12-02T09:30:00.000Z",
            "updatedBy": {
              "id": "0193a7c0-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
              "name": "Sam Lee"
            },
            "inTrash": false,
            "expiresAt": null
          }
        ]
      },
      "PageSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "icon": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 16,
                "description": "An emoji"
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "doc",
              "database",
              "row"
            ]
          },
          "url": {
            "type": "string"
          },
          "parentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "teamspaceId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "hasChildren": {
            "type": "boolean",
            "description": "Whether it has pages inside it"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "title",
          "icon",
          "kind",
          "url",
          "parentId",
          "teamspaceId",
          "hasChildren",
          "updatedAt",
          "expiresAt"
        ],
        "additionalProperties": false,
        "description": "A page in a list.",
        "examples": [
          {
            "id": "0193a7c2-5d41-7c3e-9a51-6f0d2b8e4a10",
            "title": "Launch plan",
            "icon": "🚀",
            "kind": "doc",
            "url": "https://app.lyra-docs.com/p/0193a7c2-5d41-7c3e-9a51-6f0d2b8e4a10",
            "parentId": "0193a7c2-4b10-7a2d-8e33-1c9f5a7b2d01",
            "teamspaceId": "0193a7c1-9e02-7f41-b6a8-3d5e7c9a1b22",
            "hasChildren": true,
            "updatedAt": "2026-12-02T09:30:00.000Z",
            "expiresAt": null
          }
        ]
      },
      "Person": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false,
        "description": "Someone in the workspace."
      },
      "Property": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "description": "title, text, number, select, multi_select, status, date, person, checkbox, url, email, phone, relation, formula, rollup, created_time, created_by, edited_time, edited_by, unique_id or files"
          },
          "options": {
            "description": "The option labels of a select, multi_select or status",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "formula": {
            "type": "string"
          },
          "formulaResult": {
            "type": "string"
          },
          "relatedDatabaseId": {
            "type": "string",
            "format": "uuid"
          },
          "rollup": {
            "type": "object",
            "properties": {
              "relationPropertyId": {
                "type": "string"
              },
              "targetPropertyId": {
                "type": "string"
              },
              "function": {
                "type": "string"
              }
            },
            "required": [
              "relationPropertyId",
              "targetPropertyId",
              "function"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "name",
          "type"
        ],
        "additionalProperties": false,
        "description": "A column of a database."
      },
      "Row": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "values": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Values keyed by property name. select and status: the option label. multi_select: a list of labels. person: a list of names when read; emails or user ids when written. relation: a list of {id, title} when read; row ids when written. date: a time such as \"2026-12-08T00:00:00.000Z\", or {\"start\",\"end\"} for a range. checkbox: true or false."
          }
        },
        "required": [
          "id",
          "values"
        ],
        "additionalProperties": false,
        "description": "A database row, with its values keyed by property name.",
        "examples": [
          {
            "id": "0193a7c5-3333-7aaa-8bbb-000000000004",
            "values": {
              "Name": "Write the launch post",
              "Status": "In progress",
              "Due": "2026-12-10T00:00:00.000Z",
              "Owner": [
                "Sam Lee"
              ]
            }
          }
        ]
      },
      "SearchResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "icon": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 16,
                "description": "An emoji"
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "doc",
              "database",
              "row"
            ]
          },
          "url": {
            "type": "string"
          },
          "breadcrumbs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Crumb"
            }
          },
          "snippet": {
            "type": "string",
            "description": "Text around the match, with the matched words inside <mark></mark>"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "title",
          "icon",
          "kind",
          "url",
          "breadcrumbs",
          "snippet",
          "updatedAt"
        ],
        "additionalProperties": false,
        "description": "A page or database row that matched.",
        "examples": [
          {
            "id": "0193a7c2-5d41-7c3e-9a51-6f0d2b8e4a10",
            "title": "Launch plan",
            "icon": "🚀",
            "kind": "doc",
            "url": "https://app.lyra-docs.com/p/0193a7c2-5d41-7c3e-9a51-6f0d2b8e4a10",
            "breadcrumbs": [],
            "snippet": "We <mark>launch</mark> on the 10th",
            "updatedAt": "2026-12-02T09:30:00.000Z"
          }
        ]
      },
      "Sort": {
        "type": "object",
        "properties": {
          "propertyId": {
            "type": "string",
            "maxLength": 200,
            "description": "The property's name or id"
          },
          "direction": {
            "type": "string",
            "enum": [
              "asc",
              "desc"
            ]
          }
        },
        "required": [
          "propertyId",
          "direction"
        ]
      },
      "Teamspace": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "icon": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 16,
                "description": "An emoji"
              },
              {
                "type": "null"
              }
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "member"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "icon",
          "role"
        ],
        "additionalProperties": false,
        "description": "A teamspace the person belongs to.",
        "examples": [
          {
            "id": "0193a7c1-9e02-7f41-b6a8-3d5e7c9a1b22",
            "name": "Engineering",
            "icon": "🛠️",
            "role": "member"
          }
        ]
      },
      "Thread": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "quotedText": {
            "description": "The text on the page the thread is attached to, or null for a comment on the whole page",
            "type": [
              "string",
              "null"
            ]
          },
          "resolved": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "comments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Comment"
            }
          }
        },
        "required": [
          "id",
          "quotedText",
          "resolved",
          "createdAt",
          "comments"
        ],
        "additionalProperties": false,
        "description": "A comment thread on a page, with its comments oldest first.",
        "examples": [
          {
            "id": "0193a7c3-0c11-7d22-9e33-4f5a6b7c8d90",
            "quotedText": "ship on Friday",
            "resolved": false,
            "createdAt": "2026-12-02T09:30:00.000Z",
            "comments": [
              {
                "id": "0193a7c3-0c12-7d22-9e33-4f5a6b7c8d91",
                "author": {
                  "id": "0193a7c0-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
                  "name": "Sam Lee"
                },
                "markdown": "Can we make it **Thursday**?",
                "createdAt": "2026-12-02T09:30:00.000Z"
              }
            ]
          }
        ]
      },
      "View": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "type"
        ],
        "additionalProperties": false
      }
    }
  }
}
