{"openapi":"3.1.0","info":{"title":"Lydie API","version":"2026-11-12","description":"Generated from @lydie/contract. Pin a version with the `Lydie-Version` header (YYYY-MM-DD). Errors use the `{error:{code,message,hint}}` envelope."},"servers":[{"url":"https://api.lydie.co/v1"}],"paths":{"/api-tokens/{tokenId}":{"delete":{"operationId":"apiToken.revoke","summary":"Revoke an API token","description":"The token stops working at once.","tags":["apiToken"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"tokenId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false,"x-lydie-session-only":true}},"/attachments":{"post":{"operationId":"attachment.create","summary":"Add an attachment","description":"Records an attachment whose bytes are already stored under their SHA-256 (the Blob port locally, an upload URL when hosted). Several attachments may share the same bytes.","tags":["attachment"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"id":{"description":"Client-minted id. Generated when omitted.","$ref":"#/components/schemas/Ulid"},"documentId":{"default":null,"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"filename":{"type":"string","minLength":1,"maxLength":255},"contentType":{"type":"string","minLength":1,"maxLength":255},"size":{"type":"integer","minimum":0,"maximum":9007199254740991},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"required":["workspaceId","filename","contentType","size","sha256"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attachment"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/attachments/uploads":{"post":{"operationId":"attachment.prepareUpload","summary":"Get an upload URL for a file","description":"Checks access and limits and returns a signed URL (15 minutes) to PUT the file's bytes to. `upload` is null when the same bytes are already stored. Then record the file with attachment.create. Needs edit access to the document (or membership for workspace files).","tags":["attachment"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"documentId":{"default":null,"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"contentType":{"type":"string","minLength":1,"maxLength":255},"size":{"type":"integer","minimum":0,"maximum":9007199254740991},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"required":["workspaceId","contentType","size","sha256"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"upload":{"anyOf":[{"$ref":"#/components/schemas/BlobUpload"},{"type":"null"}]},"maxBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["upload","maxBytes"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/attachments/{id}":{"delete":{"operationId":"attachment.delete","summary":"Delete an attachment","description":"Moves an attachment to the trash. Restore it with attachment.restore.","tags":["attachment"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attachment"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":true},"get":{"operationId":"attachment.get","summary":"Get an attachment","tags":["attachment"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attachment"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/attachments/{id}/download-url":{"get":{"operationId":"attachment.downloadUrl","summary":"Get a download URL for an attachment","description":"A signed URL valid for an hour, usable without a session (e.g. in <img src>).","tags":["attachment"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"expiresAt":{"$ref":"#/components/schemas/Timestamp"}},"required":["url","expiresAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/attachments/{id}/purge":{"post":{"operationId":"attachment.purge","summary":"Permanently delete an attachment","description":"Permanently deletes an attachment in the trash. Its bytes are removed when no other attachment uses them. Cannot be undone.","tags":["attachment"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"purgedIds":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"}}},"required":["purgedIds"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/attachments/{id}/restore":{"post":{"operationId":"attachment.restore","summary":"Restore an attachment","tags":["attachment"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attachment"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/connections/{id}":{"get":{"operationId":"connection.get","summary":"Get a connection","tags":["connection"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"connection":{"$ref":"#/components/schemas/Connection"}},"required":["connection"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true},"patch":{"operationId":"connection.update","summary":"Change a connection","description":"Renames a connection, changes its settings or replaces its credentials (checked with the destination first). Owners and admins only.","tags":["connection"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"credentials":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"connection":{"$ref":"#/components/schemas/Connection"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["connection","warnings"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false},"delete":{"operationId":"connection.delete","summary":"Remove a connection","description":"Removes a connection and its stored credentials. Refused while publications use it, unless `force` (they are removed too; what they published stays at the destination). Owners and admins only.","tags":["connection"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"force","in":"query","required":false,"schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"removedPublications":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","removedPublications"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/connections/{id}/test":{"post":{"operationId":"connection.test","summary":"Test a connection","description":"Checks the stored credentials with the destination and records the result.","tags":["connection"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"connection":{"$ref":"#/components/schemas/Connection"},"ok":{"type":"boolean"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["connection","ok","warnings"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/connectors":{"get":{"operationId":"connector.list","summary":"List publishing connectors","description":"Destinations documents can be published to, with their auth methods, the settings a connection needs and the config a publication takes (JSON Schema), and what they can do.","tags":["connector"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"connectors":{"type":"array","items":{"$ref":"#/components/schemas/ConnectorInfo"}}},"required":["connectors"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/database-properties/{id}":{"patch":{"operationId":"database.updateProperty","summary":"Update a database property","description":"Replaces the property's configuration and/or its key. A new key moves every row's value to it (one undo step).","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":128},"config":{"$ref":"#/components/schemas/PropertyConfigSpecInput"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseProperty"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true},"delete":{"operationId":"database.deleteProperty","summary":"Delete a database property","description":"Moves the property to the trash. Row values stay in the documents' properties, so restoring it brings them back. Deleting one side of a two-way relation makes the other side one-way.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseProperty"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/database-properties/{id}/move":{"post":{"operationId":"database.moveProperty","summary":"Reorder a database property","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"afterId":{"description":"Place directly after this sibling.","$ref":"#/components/schemas/Ulid"},"beforeId":{"description":"Place directly before this sibling.","$ref":"#/components/schemas/Ulid"},"sortKey":{"description":"Explicit fractional key (recorded so replays converge).","$ref":"#/components/schemas/SortKey"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseProperty"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/database-properties/{id}/rename":{"post":{"operationId":"database.renameProperty","summary":"Rename a database property","description":"Changes the display name only; the frontmatter key and row values stay (use database.updateProperty with key to rename the key).","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseProperty"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/database-properties/{id}/restore":{"post":{"operationId":"database.restoreProperty","summary":"Restore a database property","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseProperty"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/database-properties/{id}/type":{"post":{"operationId":"database.changePropertyType","summary":"Change a property's type","description":"Changes the type and converts every row's value (see the conversion table in the docs). convert: false keeps the values as they are.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/PropertyType"},"config":{"$ref":"#/components/schemas/PropertyConfigSpecInput"},"convert":{"default":true,"type":"boolean"}},"required":["type"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"property":{"$ref":"#/components/schemas/DatabaseProperty"},"converted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["property","converted"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/database-properties/{propertyId}/options":{"post":{"operationId":"database.addOption","summary":"Add a select option","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"propertyId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"option":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string","minLength":1,"maxLength":200},"color":{"default":"default","$ref":"#/components/schemas/Color"},"group":{"$ref":"#/components/schemas/StatusGroup"}},"required":["name"]},"index":{"description":"Default: last.","type":"integer","minimum":0,"maximum":9007199254740991}},"required":["option"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseProperty"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/database-properties/{propertyId}/options/{optionId}":{"patch":{"operationId":"database.updateOption","summary":"Rename or recolour a select option","description":"Rows store the option's name, so renaming rewrites the rows that use it (one undo step).","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"propertyId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"optionId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"color":{"default":"default","$ref":"#/components/schemas/Color"},"group":{"$ref":"#/components/schemas/StatusGroup"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"property":{"$ref":"#/components/schemas/DatabaseProperty"},"rewritten":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["property","rewritten"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true},"delete":{"operationId":"database.deleteOption","summary":"Delete a select option","description":"Removes the option and clears it from every row that uses it (one undo step).","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"propertyId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"optionId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"property":{"$ref":"#/components/schemas/DatabaseProperty"},"rewritten":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["property","rewritten"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/database-properties/{propertyId}/options/{optionId}/move":{"post":{"operationId":"database.moveOption","summary":"Reorder a select option","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"propertyId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"optionId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"index":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["index"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseProperty"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/database-rows/{rowId}/move":{"post":{"operationId":"database.moveRow","summary":"Move a database row","description":"Places a row after/before another (the manual order every unsorted view shows) and, with group/subGroup and a grouped viewId, moves it to that group by setting the grouped property.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"rowId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"viewId":{"$ref":"#/components/schemas/Ulid"},"afterId":{"$ref":"#/components/schemas/Ulid"},"beforeId":{"$ref":"#/components/schemas/Ulid"},"group":{"type":["string","null"]},"subGroup":{"type":["string","null"]},"fromGroup":{"description":"The group it was in (list-valued groups).","type":["string","null"]},"fromSubGroup":{"type":["string","null"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/database-views/{id}":{"patch":{"operationId":"database.updateView","summary":"Update a database view","description":"Changes the view's type and/or replaces the given top-level config fields (filter, sorts, groupBy, subGroupBy, columns, limit, summaries, layout); fields not given stay.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/ViewType"},"config":{"default":{},"$ref":"#/components/schemas/ViewConfigPatchInput"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseView"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true},"delete":{"operationId":"database.deleteView","summary":"Delete a database view","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseView"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/database-views/{id}/duplicate":{"post":{"operationId":"database.duplicateView","summary":"Duplicate a database view","description":"Copies a view right after itself. The name defaults to “<name> copy”.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"newId":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string","minLength":1,"maxLength":200},"sortKey":{"$ref":"#/components/schemas/SortKey"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseView"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/database-views/{id}/move":{"post":{"operationId":"database.moveView","summary":"Reorder a database view","description":"The first view opens by default (and is what a plain embed shows).","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"afterId":{"description":"Place directly after this sibling.","$ref":"#/components/schemas/Ulid"},"beforeId":{"description":"Place directly before this sibling.","$ref":"#/components/schemas/Ulid"},"sortKey":{"description":"Explicit fractional key (recorded so replays converge).","$ref":"#/components/schemas/SortKey"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseView"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/database-views/{id}/rename":{"post":{"operationId":"database.renameView","summary":"Rename a database view","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseView"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/database-views/{id}/restore":{"post":{"operationId":"database.restoreView","summary":"Restore a database view","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseView"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/databases":{"post":{"operationId":"database.create","summary":"Create a database","description":"Creates a database: a document whose children are its rows. With documentId, turns an existing document into a database (its children become rows). Starts with a title property and one view.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"id":{"description":"Client-minted id of the new database document.","$ref":"#/components/schemas/Ulid"},"documentId":{"description":"Turn this existing document into a database.","$ref":"#/components/schemas/Ulid"},"parentId":{"default":null,"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"title":{"default":"Untitled database","type":"string","minLength":1,"maxLength":255},"teamspaceId":{"description":"Hosted: the teamspace a new top-level database goes into (null or absent: the creator's private section). Ignored with parentId or documentId, and in local mode.","anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]},"afterId":{"description":"Place directly after this sibling.","$ref":"#/components/schemas/Ulid"},"beforeId":{"description":"Place directly before this sibling.","$ref":"#/components/schemas/Ulid"},"sortKey":{"description":"Explicit fractional key (recorded so replays converge).","$ref":"#/components/schemas/SortKey"},"viewType":{"default":"table","$ref":"#/components/schemas/ViewType"},"titlePropertyId":{"$ref":"#/components/schemas/Ulid"},"viewId":{"$ref":"#/components/schemas/Ulid"}},"required":["workspaceId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseDefinition"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/databases/{databaseId}/properties":{"post":{"operationId":"database.addProperty","summary":"Add a database property","description":"Adds a property. key defaults to the name (the frontmatter key in a folder). A two-way relation also adds the synced property on the related database (config.relation.reversePropertyId is its id). A uniqueId (config.prefix, e.g. LYD) numbers the existing rows in creation order; its key may not be \"id\".","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string","minLength":1,"maxLength":200},"type":{"$ref":"#/components/schemas/PropertyType"},"key":{"type":"string","minLength":1,"maxLength":128},"config":{"default":{},"$ref":"#/components/schemas/PropertyConfigSpecInput"},"reverseName":{"description":"Two-way relations.","type":"string","minLength":1,"maxLength":200},"afterId":{"description":"Place directly after this sibling.","$ref":"#/components/schemas/Ulid"},"beforeId":{"description":"Place directly before this sibling.","$ref":"#/components/schemas/Ulid"},"sortKey":{"description":"Explicit fractional key (recorded so replays converge).","$ref":"#/components/schemas/SortKey"}},"required":["name","type"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseProperty"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/databases/{databaseId}/query":{"post":{"operationId":"database.query","summary":"Query a database","description":"Returns one window of a view's rows (filtered, sorted, grouped), with the total and group counts. Pass viewId for a saved view, or view for an ad-hoc one (both: view overrides). uniqueId values are numbers (shown as prefix-number, e.g. LYD-12); filters take 12 or \"LYD-12\".","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"viewId":{"$ref":"#/components/schemas/Ulid"},"view":{"type":"object","properties":{"type":{"default":"table","$ref":"#/components/schemas/ViewType"},"config":{"default":{},"$ref":"#/components/schemas/ViewConfigPatchInput"}}},"window":{"default":{"offset":0,"limit":100},"type":"object","properties":{"offset":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991},"limit":{"default":100,"type":"integer","minimum":0,"maximum":1000},"group":{"type":["string","null"]},"subGroup":{"type":["string","null"]},"range":{"type":"object","properties":{"propertyId":{"description":"Default: the view's calendar property.","$ref":"#/components/schemas/Ulid"},"start":{"type":"string","description":"Inclusive, YYYY-MM-DD"},"end":{"type":"string","description":"Exclusive, YYYY-MM-DD"}},"required":["start","end"]}}},"today":{"description":"The caller's local date for relative date filters. Default: the server's.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ViewResult"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/databases/{databaseId}/rows":{"post":{"operationId":"database.createRow","summary":"Create a database row","description":"Creates a row (a document under the database). Values implied by the view's filter and by the group (group/subGroup keys) are filled in, as in Notion; values override them. With templateId, the template's properties and body are copied first. uniqueId properties get the next number unless values gives one (12 or \"LYD-12\").","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"title":{"default":"Untitled","type":"string","minLength":1,"maxLength":255},"values":{"default":{},"type":"object","propertyNames":{"$ref":"#/components/schemas/Ulid"},"additionalProperties":{"$ref":"#/components/schemas/PropertyValue"}},"viewId":{"$ref":"#/components/schemas/Ulid"},"group":{"type":["string","null"]},"subGroup":{"type":["string","null"]},"templateId":{"$ref":"#/components/schemas/Ulid"},"afterId":{"$ref":"#/components/schemas/Ulid"},"beforeId":{"$ref":"#/components/schemas/Ulid"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":true},"patch":{"operationId":"database.setValues","summary":"Set row values","description":"Sets property values on one or many rows in one step: rowIds with set/unset applies the same values to every row; updates gives each row its own. Values are checked against the property type; unknown select options are added. Relation changes update the two-way side. uniqueId values are positive whole numbers: pass 12 or \"LYD-12\".","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"rowIds":{"maxItems":10000,"type":"array","items":{"$ref":"#/components/schemas/Ulid"}},"set":{"default":{},"type":"object","propertyNames":{"$ref":"#/components/schemas/Ulid"},"additionalProperties":{"$ref":"#/components/schemas/PropertyValue"}},"unset":{"default":[],"type":"array","items":{"$ref":"#/components/schemas/Ulid"}},"updates":{"maxItems":10000,"type":"array","items":{"type":"object","properties":{"rowId":{"$ref":"#/components/schemas/Ulid"},"set":{"default":{},"type":"object","propertyNames":{"$ref":"#/components/schemas/Ulid"},"additionalProperties":{"$ref":"#/components/schemas/PropertyValue"}},"unset":{"default":[],"type":"array","items":{"$ref":"#/components/schemas/Ulid"}}},"required":["rowId"]}},"exact":{"default":false,"description":"Write the values as given: no type checks, no new options, no two-way relation updates. Undo uses it to restore earlier values exactly.","type":"boolean"},"newOptions":{"description":"Options this call adds (recorded by the client so replays mint the same ids).","type":"object","propertyNames":{"$ref":"#/components/schemas/Ulid"},"additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/SelectOptionInput"}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"}}},"required":["updated"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/databases/{databaseId}/rows/delete":{"post":{"operationId":"database.deleteRows","summary":"Delete database rows","description":"Moves rows to the trash (as doc.delete). Relations to them hide until restored.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rowIds":{"minItems":1,"maxItems":10000,"type":"array","items":{"$ref":"#/components/schemas/Ulid"}}},"required":["rowIds"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deletedIds":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"}},"deletedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]}},"required":["deletedIds","deletedAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/databases/{databaseId}/rows/duplicate":{"post":{"operationId":"database.duplicateRows","summary":"Duplicate database rows","description":"Copies rows (title, values and body), each right after its original.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rowIds":{"minItems":1,"maxItems":1000,"type":"array","items":{"$ref":"#/components/schemas/Ulid"}},"ids":{"description":"Client-minted ids for the copies, in order.","type":"array","items":{"$ref":"#/components/schemas/Ulid"}}},"required":["rowIds"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/Document"}}},"required":["rows"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/databases/{databaseId}/rows/restore":{"post":{"operationId":"database.restoreRows","summary":"Restore database rows","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rowIds":{"minItems":1,"maxItems":10000,"type":"array","items":{"$ref":"#/components/schemas/Ulid"}}},"required":["rowIds"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"restoredIds":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"}}},"required":["restoredIds"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/databases/{databaseId}/rows/write":{"post":{"operationId":"database.writeRows","summary":"Write database rows","description":"Creates, updates and deletes rows in one step. A row without id is created; with id it is updated (title renames it); delete: true moves it to the trash. values are keyed by property id, frontmatter key or name; relation values are row ids; select values are option names (new names become options); uniqueId values are numbers (pass 12 or \"LYD-12\"; new rows get the next number). unset clears properties.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rows":{"minItems":1,"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"description":"An existing row to update or delete.","$ref":"#/components/schemas/Ulid"},"title":{"type":"string","minLength":1,"maxLength":255},"values":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/components/schemas/PropertyValue"}},"unset":{"default":[],"type":"array","items":{"type":"string","minLength":1,"description":"A property's id, frontmatter key or name (case-insensitive)."}},"delete":{"default":false,"type":"boolean"}}}}},"required":["rows"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"}},"updated":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"}},"deleted":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"}}},"required":["created","updated","deleted"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/databases/{databaseId}/schema":{"post":{"operationId":"database.changeSchema","summary":"Change a database's properties","description":"Adds, changes and removes properties in one step. update can rename (name), change the type (values are converted), the frontmatter key or the config (options, relation, number format, formula expression). Removed properties keep their values in the rows.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"add":{"default":[],"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"type":{"$ref":"#/components/schemas/PropertyType"},"key":{"type":"string","minLength":1,"maxLength":128},"config":{"$ref":"#/components/schemas/PropertyConfigSpecInput"}},"required":["name","type"]}},"update":{"default":[],"type":"array","items":{"type":"object","properties":{"property":{"type":"string","minLength":1,"description":"A property's id, frontmatter key or name (case-insensitive)."},"name":{"type":"string","minLength":1,"maxLength":200},"type":{"$ref":"#/components/schemas/PropertyType"},"key":{"type":"string","minLength":1,"maxLength":128},"config":{"$ref":"#/components/schemas/PropertyConfigSpecInput"}},"required":["property"]}},"remove":{"default":[],"type":"array","items":{"type":"string","minLength":1,"description":"A property's id, frontmatter key or name (case-insensitive)."}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseOutline"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/databases/{databaseId}/templates":{"get":{"operationId":"database.listTemplates","summary":"List row templates","description":"The database's row templates (config.templateIds), in order, live ones only. Templates are left out of views, counts and relation pickers; pass one as createRow's templateId.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"templates":{"type":"array","items":{"$ref":"#/components/schemas/Document"}}},"required":["templates"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/databases/{databaseId}/views":{"post":{"operationId":"database.createView","summary":"Create a database view","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string","minLength":1,"maxLength":200},"type":{"$ref":"#/components/schemas/ViewType"},"config":{"default":{"filter":null,"sorts":[],"groupBy":null,"subGroupBy":null,"columns":[],"limit":null,"summaries":{},"layout":{},"extra":{}},"$ref":"#/components/schemas/ViewConfigInput"},"afterId":{"description":"Place directly after this sibling.","$ref":"#/components/schemas/Ulid"},"beforeId":{"description":"Place directly before this sibling.","$ref":"#/components/schemas/Ulid"},"sortKey":{"description":"Explicit fractional key (recorded so replays converge).","$ref":"#/components/schemas/SortKey"}},"required":["name","type"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseView"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/databases/{databaseId}/views/change":{"post":{"operationId":"database.changeViews","summary":"Change a database's views","description":"Adds, changes and removes views in one step. config is merged into the view's config (filter, sorts, groupBy, columns, …); see get_database for the current values.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"databaseId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"add":{"default":[],"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"type":{"$ref":"#/components/schemas/ViewType"},"config":{"$ref":"#/components/schemas/ViewConfigPatchInput"}},"required":["name","type"]}},"update":{"default":[],"type":"array","items":{"type":"object","properties":{"view":{"type":"string","minLength":1,"description":"A view's id or name (case-insensitive)."},"name":{"type":"string","minLength":1,"maxLength":200},"type":{"$ref":"#/components/schemas/ViewType"},"config":{"$ref":"#/components/schemas/ViewConfigPatchInput"}},"required":["view"]}},"remove":{"default":[],"type":"array","items":{"type":"string","minLength":1,"description":"A view's id or name (case-insensitive)."}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseOutline"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/databases/{id}":{"patch":{"operationId":"database.update","summary":"Update database settings","description":"Sets the filter applied to every view and the row templates.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"anyOf":[{"$ref":"#/components/schemas/FilterNode"},{"type":"null"}]},"templateIds":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Database"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true},"delete":{"operationId":"database.delete","summary":"Turn a database back into a page","description":"Removes the database (schema and views go to the trash with it); the document and its rows stay as ordinary pages. To delete the document itself use doc.delete.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Database"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":true},"get":{"operationId":"database.get","summary":"Get a database","description":"Returns a database's settings, live properties and views, in order.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseDefinition"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/databases/{id}/definition":{"put":{"operationId":"database.setDefinition","summary":"Replace a database's schema and views","description":"Applies a whole definition (what fromBase reads from a .base file): properties and views with a known id are updated, new ones created, live ones missing from it deleted. Row values are not touched.","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"definition":{"type":"object","properties":{"config":{"$ref":"#/components/schemas/DatabaseConfigInput"},"properties":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string","minLength":1,"maxLength":200},"type":{"$ref":"#/components/schemas/PropertyType"},"key":{"type":"string","minLength":1,"maxLength":128},"config":{"default":{},"$ref":"#/components/schemas/PropertyConfigInput"}},"required":["id","name","type","key"]}},"views":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string","minLength":1,"maxLength":200},"type":{"$ref":"#/components/schemas/ViewType"},"config":{"$ref":"#/components/schemas/ViewConfigInput"}},"required":["id","name","type","config"]}}},"required":["config","properties","views"]}},"required":["definition"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseDefinition"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/databases/{id}/restore":{"post":{"operationId":"database.restore","summary":"Restore a database","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Database"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/documents":{"post":{"operationId":"doc.create","summary":"Create a document","description":"Creates a document in a workspace, optionally under a parent and with an initial Markdown body. Without afterId/beforeId it is appended as the last child.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"id":{"description":"Client-minted id. Generated when omitted.","$ref":"#/components/schemas/Ulid"},"parentId":{"default":null,"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"title":{"default":"Untitled","type":"string","minLength":1,"maxLength":255},"properties":{"default":{},"$ref":"#/components/schemas/Properties"},"markdown":{"description":"Initial body as Lydie Markdown.","type":"string"},"teamspaceId":{"description":"Hosted: the teamspace a top-level page goes into (null or absent: the creator's private section). Ignored for child pages, which share their parent's space, and in local mode.","anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]},"afterId":{"description":"Place directly after this sibling.","$ref":"#/components/schemas/Ulid"},"beforeId":{"description":"Place directly before this sibling.","$ref":"#/components/schemas/Ulid"},"sortKey":{"description":"Explicit fractional key. Overrides afterId/beforeId; recorded by clients so replays converge.","$ref":"#/components/schemas/SortKey"}},"required":["workspaceId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/documents/{documentId}/grants":{"post":{"operationId":"share.grant","summary":"Share a page","description":"Gives a user, a teamspace's members or everyone in the workspace (principalType workspace, principalId = workspace id) a level on the page and its subpages. Needs full access.","tags":["share"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"documentId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"principalType":{"$ref":"#/components/schemas/PrincipalType"},"principalId":{"type":"string","minLength":1,"maxLength":64},"level":{"$ref":"#/components/schemas/AccessLevel"}},"required":["principalType","principalId","level"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentGrant"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/documents/{documentId}/grants/{grantId}":{"delete":{"operationId":"share.revoke","summary":"Stop sharing a page","tags":["share"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"documentId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"grantId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/documents/{documentId}/invite":{"post":{"operationId":"share.invite","summary":"Share a page with someone by email","description":"Members get a grant. Someone with an account who is not a member is added as a guest. Anyone else is emailed an invitation that makes them a guest with this access.","tags":["share"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"documentId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"level":{"$ref":"#/components/schemas/AccessLevel"}},"required":["email","level"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["granted","added_as_guest","invited"]},"userId":{"anyOf":[{"$ref":"#/components/schemas/UserId"},{"type":"null"}]},"invitationId":{"type":["string","null"]}},"required":["status","userId","invitationId"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/documents/{documentId}/publications":{"post":{"operationId":"publication.create","summary":"Publish a document to a connection","description":"Creates a publication of a document (and its subpages with `includeSubpages`) to a connection, and queues the first run unless `publishNow` is false. `config` follows the connector's configSchema (connector.list). Needs edit access to the document.","tags":["publication"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"documentId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"$ref":"#/components/schemas/Ulid"},"includeSubpages":{"default":false,"type":"boolean"},"filter":{"default":null,"anyOf":[{"type":"object","properties":{"property":{"type":"string","minLength":1,"maxLength":128},"equals":{}},"required":["property","equals"]},{"type":"null"}],"description":"Publish only documents whose property equals this (lists: contains it)."},"config":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"autoPublish":{"default":false,"type":"boolean"},"publishNow":{"default":true,"type":"boolean"}},"required":["connectionId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"publication":{"$ref":"#/components/schemas/Publication"},"run":{"anyOf":[{"$ref":"#/components/schemas/PublicationRun"},{"type":"null"}]}},"required":["publication","run"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":false}},"/documents/{documentId}/restricted":{"post":{"operationId":"share.setRestricted","summary":"Restrict or unrestrict a page","description":"A restricted page does not inherit access from its parent or its teamspace: only its own grants apply (to it and its subpages). Restricting gives you full access so you keep it.","tags":["share"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"documentId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"restricted":{"type":"boolean"}},"required":["restricted"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/documents/{documentId}/share-links":{"post":{"operationId":"shareLink.create","summary":"Create a public link","description":"Creates a view-only public link to the page (and, by default, its unrestricted subpages). The token is returned only once. Needs full access.","tags":["shareLink"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"documentId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"includeSubpages":{"default":true,"type":"boolean"},"expiresAt":{"default":null,"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"password":{"default":null,"anyOf":[{"type":"string","minLength":4,"maxLength":200},{"type":"null"}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"shareLink":{"$ref":"#/components/schemas/ShareLink"},"token":{"type":"string"},"url":{"type":"string"}},"required":["shareLink","token","url"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":false},"get":{"operationId":"shareLink.list","summary":"List a page's public links","tags":["shareLink"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"documentId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"shareLinks":{"type":"array","items":{"$ref":"#/components/schemas/ShareLink"}}},"required":["shareLinks"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/documents/{documentId}/sharing":{"get":{"operationId":"share.get","summary":"Get a page's sharing settings","tags":["share"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"documentId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SharingInfo"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/documents/{id}":{"delete":{"operationId":"doc.delete","summary":"Delete a document","description":"Soft-deletes a document and its subtree. Restore it with doc.restore. Deleting a deleted document is a no-op.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"deletedAt":{"$ref":"#/components/schemas/Timestamp"},"deletedIds":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"}}},"required":["id","deletedAt","deletedIds"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":true},"get":{"operationId":"doc.get","summary":"Get a document","description":"Returns a document's metadata and, unless includeBody is false, its Markdown body.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"includeBody","in":"query","required":false,"schema":{"default":true,"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"document":{"$ref":"#/components/schemas/Document"},"body":{"anyOf":[{"$ref":"#/components/schemas/DocumentBody"},{"type":"null"}]}},"required":["document","body"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/documents/{id}/backlinks":{"get":{"operationId":"doc.backlinks","summary":"List backlinks","description":"Lists live documents that link to this document.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"backlinks":{"type":"array","items":{"$ref":"#/components/schemas/Backlink"}}},"required":["backlinks"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/documents/{id}/blocks/{blockId}/backlinks":{"get":{"operationId":"doc.blockBacklinks","summary":"List backlinks to a block","description":"Lists live documents that link to one block (`[[Note#^blockId]]`) of this document.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"blockId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/BlockId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"backlinks":{"type":"array","items":{"$ref":"#/components/schemas/Backlink"}}},"required":["backlinks"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/documents/{id}/body":{"patch":{"operationId":"doc.updateBody","summary":"Update a document body","description":"Replaces the body with `markdown`, or applies `edits` (exact old/new string replacements against the Markdown returned by doc.get). Edits that do not match exactly once are skipped and reported in `warnings`. Pass `expectedVersion` to fail with a conflict if the body changed since you read it.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"markdown":{"type":"string"},"edits":{"minItems":1,"type":"array","items":{"$ref":"#/components/schemas/BodyEditInput"}},"expectedVersion":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"document":{"$ref":"#/components/schemas/Document"},"version":{"type":"string"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/Warning"}}},"required":["document","version","warnings"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":true}},"/documents/{id}/links":{"get":{"operationId":"doc.outgoingLinks","summary":"List outgoing links","description":"Lists the links in this document (body first, then properties, in document order), each with the live document it resolves to or null.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","items":{"$ref":"#/components/schemas/OutgoingLink"}}},"required":["links"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/documents/{id}/move":{"post":{"operationId":"doc.move","summary":"Move a document","description":"Moves a document (and its subtree) under a new parent, or to the top level with parentId null. Without afterId/beforeId it becomes the last child.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"parentId":{"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"afterId":{"description":"Place directly after this sibling.","$ref":"#/components/schemas/Ulid"},"beforeId":{"description":"Place directly before this sibling.","$ref":"#/components/schemas/Ulid"},"sortKey":{"description":"Explicit fractional key. Overrides afterId/beforeId; recorded by clients so replays converge.","$ref":"#/components/schemas/SortKey"}},"required":["parentId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/documents/{id}/properties":{"patch":{"operationId":"doc.setProperties","summary":"Set document properties","description":"Merges `set` into the document's properties and removes the keys in `unset`.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"set":{"default":{},"$ref":"#/components/schemas/Properties"},"unset":{"default":[],"type":"array","items":{"type":"string","minLength":1,"maxLength":128}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/documents/{id}/purge":{"post":{"operationId":"doc.purge","summary":"Permanently delete a document","description":"Permanently deletes a document in the trash, its trashed subtree, bodies and outgoing links. Links to it become unresolved. Cannot be undone.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"purgedIds":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"}}},"required":["purgedIds"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/documents/{id}/rename":{"post":{"operationId":"doc.rename","summary":"Rename a document","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":255}},"required":["title"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/documents/{id}/restore":{"post":{"operationId":"doc.restore","summary":"Restore a deleted document","description":"Restores a soft-deleted document and the part of its subtree deleted with it. If its parent is gone it is restored to the top level.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/documents/{id}/space":{"post":{"operationId":"doc.moveToSpace","summary":"Move a page to another teamspace or to Private","description":"Moves the page and its subpages to the top level of a teamspace you belong to, or of your private section (teamspaceId null). Needs full access to the page.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"teamspaceId":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]},"sortKey":{"description":"Recorded by clients so replays converge.","$ref":"#/components/schemas/SortKey"}},"required":["teamspaceId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/documents/{id}/unlinked-mentions":{"get":{"operationId":"doc.unlinkedMentions","summary":"List unlinked mentions","description":"Lists live documents whose text mentions this document's title without linking to it.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"mentions":{"type":"array","items":{"$ref":"#/components/schemas/UnlinkedMention"}}},"required":["mentions"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/documents/{id}/versions":{"get":{"operationId":"doc.listVersions","summary":"List a document's versions","description":"Lists saved versions of a document's body, newest first.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"versions":{"type":"array","items":{"$ref":"#/components/schemas/DocumentVersion"}}},"required":["versions"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/documents/{id}/versions/{versionId}":{"get":{"operationId":"doc.getVersion","summary":"Get a document version","description":"Returns one saved version of a document's body as Markdown.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"versionId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"$ref":"#/components/schemas/DocumentVersion"},"markdown":{"type":"string"}},"required":["version","markdown"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/documents/{id}/versions/{versionId}/restore":{"post":{"operationId":"doc.restoreVersion","summary":"Restore a document version","description":"Makes the body read as a saved version again, as a new edit merged into the live document. The body before the restore is kept as a version (`previousVersionId`): restore it to undo.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"versionId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"versionId":{"description":"The version recording the restored body.","type":["string","null"]},"previousVersionId":{"description":"The body before the restore.","type":["string","null"]},"version":{"type":"string","description":"The body's new content version (for expectedVersion)."}},"required":["versionId","previousVersionId","version"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/history/sessions":{"get":{"operationId":"history.listSessions","summary":"List agent sessions","description":"Lists sessions that changed a workspace, most recent first.","tags":["history"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"query","required":false,"schema":{"$ref":"#/components/schemas/WorkspaceId"}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"sessions":{"type":"array","items":{"$ref":"#/components/schemas/HistorySession"}}},"required":["sessions"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/history/sessions/{sessionId}":{"get":{"operationId":"history.listBySession","summary":"List a session's changes","description":"Lists every operation a session applied, oldest first.","tags":["history"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"sessionId","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"limit","in":"query","required":false,"schema":{"default":200,"type":"integer","minimum":1,"maximum":1000}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/HistoryEntry"}}},"required":["entries"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/history/sessions/{sessionId}/undo":{"post":{"operationId":"history.undoSession","summary":"Undo a session","description":"Reverts every change a session made, newest first, as one undoable step. Changes that later edits by others touched are skipped and reported, as are changes that cannot be undone.","tags":["history"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"sessionId","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"undoneIds":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"},"description":"History entries that were reverted."},"skipped":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"operation":{"type":"string"},"reason":{"type":"string","enum":["not_undoable","conflict","failed"]},"message":{"type":"string"}},"required":["id","operation","reason","message"],"additionalProperties":false}}},"required":["undoneIds","skipped"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":true}},"/invitations/accept":{"post":{"operationId":"invitation.accept","summary":"Accept an invitation","description":"The signed-in account's email must match the invitation.","tags":["invitation"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":20,"maxLength":200}},"required":["token"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"role":{"$ref":"#/components/schemas/WorkspaceRole"},"documentId":{"type":["string","null"]}},"required":["workspaceId","role","documentId"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false,"x-lydie-session-only":true}},"/invitations/decline":{"post":{"operationId":"invitation.decline","summary":"Decline an invitation","tags":["invitation"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":20,"maxLength":200}},"required":["token"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false,"x-lydie-session-only":true}},"/invitations/lookup":{"get":{"operationId":"invitation.lookup","summary":"Look up an invitation by its token","tags":["invitation"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"token","in":"query","required":true,"schema":{"type":"string","minLength":20,"maxLength":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitationPreview"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/invitations/{invitationId}":{"delete":{"operationId":"invitation.revoke","summary":"Revoke an invitation","tags":["invitation"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"invitationId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/invitations/{invitationId}/resend":{"post":{"operationId":"invitation.resend","summary":"Resend an invitation","description":"Sends a new link and extends the expiry. The previous link stops working.","tags":["invitation"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"invitationId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":false}},"/notifications":{"get":{"operationId":"notification.list","summary":"List notifications","description":"Your notifications, newest first. Archived ones only with archived: true.","tags":["notification"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"query","required":false,"schema":{"$ref":"#/components/schemas/WorkspaceId"}},{"name":"unread","in":"query","required":false,"description":"Only unread ones.","schema":{"default":false,"type":"boolean"}},{"name":"archived","in":"query","required":false,"description":"Archived ones instead of the inbox.","schema":{"default":false,"type":"boolean"}},{"name":"before","in":"query","required":false,"description":"Page: notifications older than this id.","schema":{"type":"string","minLength":1,"maxLength":64}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"notifications":{"type":"array","items":{"$ref":"#/components/schemas/Notification"}},"unread":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["notifications","unread"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/notifications/archive":{"post":{"operationId":"notification.archive","summary":"Archive notifications","description":"Moves them out of the inbox (and off your devices); archived: false brings them back.","tags":["notification"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"archived":{"default":true,"type":"boolean"}},"required":["ids"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["updated"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/notifications/preferences":{"get":{"operationId":"notification.getPreferences","summary":"Get notification preferences","tags":["notification"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","enum":["off","mentions","all"]}},"required":["email"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true},"put":{"operationId":"notification.setPreferences","summary":"Set notification preferences","description":"email: off (default), mentions (mail for mentions), all (every notification).","tags":["notification"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","enum":["off","mentions","all"]}},"required":["email"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","enum":["off","mentions","all"]}},"required":["email"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/notifications/read":{"post":{"operationId":"notification.markRead","summary":"Mark notifications read","tags":["notification"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"read":{"default":true,"description":"false: mark unread.","type":"boolean"}},"required":["ids"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["updated"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/notifications/read-all":{"post":{"operationId":"notification.markAllRead","summary":"Mark all notifications read","tags":["notification"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["updated"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/oauth-grants/{grantId}":{"delete":{"operationId":"oauthGrant.revoke","summary":"Disconnect an app","description":"Its access and refresh tokens stop working at once.","tags":["oauthGrant"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"grantId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false,"x-lydie-session-only":true}},"/oauth/requests/{id}":{"get":{"operationId":"oauth.getRequest","summary":"Read an OAuth authorization request","description":"For the consent page: which app asks, for what, and until when. 404 when the request is unknown, expired or already decided.","tags":["oauth"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":16,"maxLength":100,"description":"The `request` query parameter."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthRequest"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-session-only":true}},"/oauth/requests/{id}/decision":{"post":{"operationId":"oauth.decide","summary":"Approve or deny an OAuth authorization request","description":"approve: true needs workspaceId (the app is confined to it) and may narrow scopes. Returns where to send the browser: the app's redirect URI with code and state, or with error=access_denied.","tags":["oauth"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":16,"maxLength":100,"description":"The `request` query parameter."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"approve":{"type":"boolean"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"scopes":{"minItems":1,"type":"array","items":{"type":"string","enum":["docs:read","docs:write"]}}},"required":["approve"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"redirectTo":{"type":"string"}},"required":["redirectTo"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":false,"x-lydie-session-only":true}},"/publications/{id}":{"get":{"operationId":"publication.get","summary":"Get a publication","description":"A publication with the state of each published document.","tags":["publication"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"publication":{"$ref":"#/components/schemas/Publication"}},"required":["publication"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true},"patch":{"operationId":"publication.update","summary":"Change a publication","tags":["publication"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"includeSubpages":{"type":"boolean"},"filter":{"anyOf":[{"type":"object","properties":{"property":{"type":"string","minLength":1,"maxLength":128},"equals":{}},"required":["property","equals"]},{"type":"null"}],"description":"Publish only documents whose property equals this (lists: contains it)."},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"autoPublish":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"publication":{"$ref":"#/components/schemas/Publication"}},"required":["publication"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false},"delete":{"operationId":"publication.delete","summary":"Remove a publication","description":"Stops publishing. What was published stays at the destination: run publication.unpublish first to take it down.","tags":["publication"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"}},"required":["id"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/publications/{id}/resolve":{"post":{"operationId":"publication.resolve","summary":"Resolve a diverged document","description":"Settles a document that changed both in Lydie and at the destination. `overwrite` publishes the Lydie version over the remote edits. `keepRemote` accepts the destination's version as published without changing the document. `pull` merges the remote edits into the document (connectors that can pull) and publishes the result; a merge conflict leaves it diverged.","tags":["publication"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"documentId":{"$ref":"#/components/schemas/Ulid"},"resolution":{"type":"string","enum":["overwrite","keepRemote","pull"]}},"required":["documentId","resolution"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/PublicationRun"}},"required":["run"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/publications/{id}/run":{"post":{"operationId":"publication.run","summary":"Publish now","description":"Queues a run that publishes what changed: unchanged documents are skipped (content hash), remote edits are detected and pulled back or shown as a divergence, never overwritten. `force` republishes unchanged documents. `scheduledAt` runs it later. A waiting run absorbs repeated requests.","tags":["publication"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"force":{"default":false,"type":"boolean"},"scheduledAt":{"$ref":"#/components/schemas/Timestamp"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/PublicationRun"}},"required":["run"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/publications/{id}/runs":{"get":{"operationId":"publication.runs","summary":"List a publication's runs","description":"Runs newest first, with their step log (requests, commits, deliveries, errors).","tags":["publication"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"runId","in":"query","required":false,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"$ref":"#/components/schemas/PublicationRun"}}},"required":["runs"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/publications/{id}/unpublish":{"post":{"operationId":"publication.unpublish","summary":"Unpublish","description":"Queues a run that takes every published document down at the destination (deletes the file, sets the post back to draft or trashes it, or notifies, per connector).","tags":["publication"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/PublicationRun"}},"required":["run"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/share-links/{shareLinkId}":{"patch":{"operationId":"shareLink.update","summary":"Change a public link","description":"Set expiresAt or password to null to remove them.","tags":["shareLink"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"shareLinkId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"includeSubpages":{"type":"boolean"},"expiresAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"password":{"anyOf":[{"type":"string","minLength":4,"maxLength":200},{"type":"null"}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareLink"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false},"delete":{"operationId":"shareLink.revoke","summary":"Revoke a public link","tags":["shareLink"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"shareLinkId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/teamspaces/{teamspaceId}":{"patch":{"operationId":"teamspace.update","summary":"Update a teamspace","description":"Changes name, description, icon, visibility or default flag. Teamspace owners and workspace owners/admins only. Changing visibility changes who can read its pages.","tags":["teamspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"teamspaceId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"description":"Teamspace id."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":2000},"icon":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"visibility":{"$ref":"#/components/schemas/TeamspaceVisibility"},"isDefault":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Teamspace"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false},"delete":{"operationId":"teamspace.delete","summary":"Delete a teamspace","description":"Soft-deletes the teamspace and moves its pages to the trash.","tags":["teamspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"teamspaceId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"description":"Teamspace id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/teamspaces/{teamspaceId}/join":{"post":{"operationId":"teamspace.join","summary":"Join an open teamspace","tags":["teamspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"teamspaceId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"description":"Teamspace id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/teamspaces/{teamspaceId}/leave":{"post":{"operationId":"teamspace.leave","summary":"Leave a teamspace","tags":["teamspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"teamspaceId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"description":"Teamspace id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/teamspaces/{teamspaceId}/members":{"post":{"operationId":"teamspace.addMember","summary":"Add someone to a teamspace","description":"Teamspace owners and workspace owners/admins. Guests cannot join teamspaces.","tags":["teamspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"teamspaceId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"description":"Teamspace id."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"role":{"default":"member","$ref":"#/components/schemas/TeamspaceRole"}},"required":["userId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false},"get":{"operationId":"teamspace.listMembers","summary":"List teamspace members","tags":["teamspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"teamspaceId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"description":"Teamspace id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/TeamspaceMember"}}},"required":["members"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/teamspaces/{teamspaceId}/members/{userId}":{"delete":{"operationId":"teamspace.removeMember","summary":"Remove someone from a teamspace","tags":["teamspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"teamspaceId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"description":"Teamspace id."}},{"name":"userId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/UserId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/teamspaces/{teamspaceId}/members/{userId}/role":{"post":{"operationId":"teamspace.setMemberRole","summary":"Change a teamspace member's role","tags":["teamspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"teamspaceId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"description":"Teamspace id."}},{"name":"userId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/UserId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"$ref":"#/components/schemas/TeamspaceRole"}},"required":["role"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/teamspaces/{teamspaceId}/restore":{"post":{"operationId":"teamspace.restore","summary":"Restore a deleted teamspace","description":"Brings back a deleted teamspace and the pages that were moved to the trash with it. Pages trashed before the teamspace was deleted stay in the trash. Workspace owners and admins, and the teamspace's owners.","tags":["teamspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"teamspaceId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"description":"Teamspace id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Teamspace"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/workspaces":{"post":{"operationId":"workspace.create","summary":"Create a workspace","description":"Creates a workspace with you as its owner and an open, default teamspace called General.","tags":["workspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"description":"Client-minted id. Generated when omitted.","$ref":"#/components/schemas/WorkspaceId"},"name":{"type":"string","minLength":1,"maxLength":200},"defaultTeamspaceId":{"type":"string","minLength":1,"maxLength":64}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceSummary"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":false,"x-lydie-session-only":true},"get":{"operationId":"workspace.list","summary":"List your workspaces","tags":["workspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"workspaces":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceSummary"}}},"required":["workspaces"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/workspaces/{workspaceId}":{"patch":{"operationId":"workspace.rename","summary":"Rename a workspace","tags":["workspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceSummary"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/workspaces/{workspaceId}/api-tokens":{"post":{"operationId":"apiToken.create","summary":"Create an API token","description":"Creates a personal API token for one workspace. The secret is returned once; send it as `Authorization: Bearer <secret>` to /v1 operation routes or /mcp. It acts as you, limited to this workspace and the given scopes (default: read and write).","tags":["apiToken"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"scopes":{"default":["docs:read","docs:write"],"minItems":1,"type":"array","items":{"type":"string","enum":["docs:read","docs:write"]}},"expiresInDays":{"type":"integer","minimum":1,"maximum":3650}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"$ref":"#/components/schemas/ApiToken"},"secret":{"type":"string"}},"required":["token","secret"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":false,"x-lydie-session-only":true},"get":{"operationId":"apiToken.list","summary":"List your API tokens","description":"Your live (not revoked, not expired) tokens for a workspace, newest first.","tags":["apiToken"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/ApiToken"}}},"required":["tokens"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-session-only":true}},"/workspaces/{workspaceId}/attachments":{"get":{"operationId":"attachment.list","summary":"List attachments","description":"Lists a workspace's attachments, or one document's, newest first.","tags":["attachment"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}},{"name":"documentId","in":"query","required":false,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"includeDeleted","in":"query","required":false,"schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}},"required":["attachments"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/workspaces/{workspaceId}/children":{"get":{"operationId":"doc.listChildren","summary":"List a document's children","description":"Lists the direct children of a document (or the top level when parentId is omitted) in order, each with its number of live children. Use it to load a tree level by level.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}},{"name":"parentId","in":"query","required":false,"description":"Omit for the top level.","schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"includeDeleted","in":"query","required":false,"schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/ChildEntry"}}},"required":["entries"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/workspaces/{workspaceId}/connections":{"post":{"operationId":"connection.create","summary":"Connect a destination","description":"Connects a workspace to a destination with a token or generated secret (OAuth: connection.authorize). The credentials are checked with the destination first and stored encrypted; they are never returned, except generated secrets (`revealed`), once. Owners and admins only.","tags":["connection"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"connector":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":120},"authMethod":{"type":"string","enum":["token","generated"]},"settings":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"credentials":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["connector","name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"connection":{"$ref":"#/components/schemas/Connection"},"warnings":{"type":"array","items":{"type":"string"}},"revealed":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}],"description":"Generated secrets (webhook signing secret). Shown only now."}},"required":["connection","warnings","revealed"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":false},"get":{"operationId":"connection.list","summary":"List connections","description":"The workspace's destination connections (no credentials). Members and above.","tags":["connection"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"connections":{"type":"array","items":{"$ref":"#/components/schemas/Connection"}}},"required":["connections"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/workspaces/{workspaceId}/connections/authorize":{"post":{"operationId":"connection.authorize","summary":"Start connecting with OAuth","description":"Returns the provider's sign-in URL. After the person approves, the provider returns to the API, which creates the connection (or re-authorises `connectionId`) and redirects to the web app's connection settings with `?connection=<id>` or `?error=`. Owners and admins only.","tags":["connection"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"connector":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":120},"settings":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"connectionId":{"default":null,"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]}},"required":["connector","name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"authorizeUrl":{"type":"string"},"expiresAt":{"$ref":"#/components/schemas/Timestamp"}},"required":["authorizeUrl","expiresAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":false}},"/workspaces/{workspaceId}/databases":{"get":{"operationId":"database.list","summary":"List databases","description":"Lists the live databases of a workspace (database documents not in the trash).","tags":["database"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"databases":{"type":"array","items":{"$ref":"#/components/schemas/DatabaseSummary"}}},"required":["databases"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/workspaces/{workspaceId}/invitations":{"post":{"operationId":"invitation.create","summary":"Invite someone by email","description":"Emails an invitation link (valid for 7 days). Inviting an email that already has a pending invitation sends a fresh link. Owners and admins only.","tags":["invitation"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"role":{"default":"member","type":"string","enum":["admin","member","guest"]},"teamspaceIds":{"default":[],"description":"Teamspaces the invitee joins on accepting (not for guests).","maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"required":["email"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false},"get":{"operationId":"invitation.list","summary":"List pending invitations","tags":["invitation"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"invitations":{"type":"array","items":{"$ref":"#/components/schemas/Invitation"}}},"required":["invitations"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/workspaces/{workspaceId}/leave":{"post":{"operationId":"member.leave","summary":"Leave a workspace","description":"Same as being removed. The owner must transfer ownership first. Your private pages go to the owner.","tags":["member"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false,"x-lydie-session-only":true}},"/workspaces/{workspaceId}/members":{"get":{"operationId":"member.list","summary":"List workspace members","tags":["member"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/Member"}}},"required":["members"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/workspaces/{workspaceId}/members/{userId}":{"delete":{"operationId":"member.remove","summary":"Remove a member","description":"Removes someone from the workspace, its teamspaces and every page shared with them. Their private pages are transferred to the workspace owner and stay private.","tags":["member"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}},{"name":"userId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/UserId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/workspaces/{workspaceId}/members/{userId}/role":{"post":{"operationId":"member.setRole","summary":"Change a member's role","description":"Owners and admins can change roles. Only the owner can demote an admin. Making someone a guest removes them from every teamspace; they keep pages shared with them directly.","tags":["member"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}},{"name":"userId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/UserId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["admin","member","guest"]}},"required":["role"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Member"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/workspaces/{workspaceId}/oauth-grants":{"get":{"operationId":"oauthGrant.list","summary":"List connected apps","description":"Apps you allowed to act for you in this workspace through OAuth (MCP clients).","tags":["oauthGrant"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"grants":{"type":"array","items":{"$ref":"#/components/schemas/OAuthGrant"}}},"required":["grants"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true,"x-lydie-session-only":true}},"/workspaces/{workspaceId}/publications":{"get":{"operationId":"publication.list","summary":"List publications","description":"Publications in a workspace the caller can see (view access to the published document), optionally of one document.","tags":["publication"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}},{"name":"documentId","in":"query","required":false,"schema":{"$ref":"#/components/schemas/Ulid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"publications":{"type":"array","items":{"$ref":"#/components/schemas/Publication"}}},"required":["publications"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/workspaces/{workspaceId}/search":{"get":{"operationId":"doc.search","summary":"Search documents","description":"Full-text search over titles and bodies. Words are matched as prefixes; all words must match.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}},{"name":"query","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":500}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"hits":{"type":"array","items":{"$ref":"#/components/schemas/SearchHit"}}},"required":["hits"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/workspaces/{workspaceId}/teamspaces":{"post":{"operationId":"teamspace.create","summary":"Create a teamspace","description":"You become its owner. Guests cannot create teamspaces.","tags":["teamspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"description":"Client-minted id. Generated when omitted.","type":"string","minLength":1,"maxLength":64},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"default":"","type":"string","maxLength":2000},"icon":{"default":null,"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"visibility":{"default":"open","$ref":"#/components/schemas/TeamspaceVisibility"},"isDefault":{"default":false,"type":"boolean"}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Teamspace"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":false,"x-lydie-idempotent":false,"x-lydie-undoable":false},"get":{"operationId":"teamspace.list","summary":"List teamspaces","description":"Open and closed teamspaces, plus private ones you belong to. Workspace owners and admins see all.","tags":["teamspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}},{"name":"deleted","in":"query","required":false,"description":"List deleted teamspaces you could restore instead (admins, teamspace owners).","schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"teamspaces":{"type":"array","items":{"$ref":"#/components/schemas/Teamspace"}}},"required":["teamspaces"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/workspaces/{workspaceId}/transfer-ownership":{"post":{"operationId":"workspace.transferOwnership","summary":"Transfer workspace ownership","description":"Makes another member (not a guest) the owner. You become an admin.","tags":["workspace"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"}},"required":["userId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false,"x-lydie-session-only":true}},"/workspaces/{workspaceId}/trash":{"get":{"operationId":"trash.list","summary":"List the trash","description":"Lists what is in a workspace's trash, newest first. A document deleted with its subtree is one item; restoring it restores the subtree.","tags":["trash"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}},{"name":"limit","in":"query","required":false,"schema":{"default":100,"type":"integer","minimum":1,"maximum":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/TrashItem"}}},"required":["items"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true},"delete":{"operationId":"trash.empty","summary":"Empty the trash","description":"Permanently deletes everything in a workspace's trash. Cannot be undone.","tags":["trash"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"purgedIds":{"type":"array","items":{"$ref":"#/components/schemas/Ulid"}}},"required":["purgedIds"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"mutation","x-lydie-scopes":["docs:write"],"x-lydie-destructive":true,"x-lydie-idempotent":true,"x-lydie-undoable":false}},"/workspaces/{workspaceId}/tree":{"get":{"operationId":"doc.listTree","summary":"List the document tree","description":"Lists documents depth-first in tree order. With rootId, lists that document's descendants only.","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}},{"name":"rootId","in":"query","required":false,"schema":{"$ref":"#/components/schemas/Ulid"}},{"name":"includeDeleted","in":"query","required":false,"schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/TreeEntry"}}},"required":["entries"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}},"/workspaces/{workspaceId}/unresolved-links":{"get":{"operationId":"doc.unresolvedLinks","summary":"List unresolved links","description":"Lists links in live documents whose target does not exist (yet).","tags":["doc"],"parameters":[{"$ref":"#/components/parameters/LydieVersion"},{"name":"workspaceId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","items":{"$ref":"#/components/schemas/UnresolvedLink"}}},"required":["links"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-lydie-kind":"query","x-lydie-scopes":["docs:read"],"x-lydie-destructive":false,"x-lydie-idempotent":true}}},"components":{"schemas":{"AccessLevel":{"type":"string","enum":["view","comment","edit","full"],"description":"full = edit + share."},"Actor":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"user"},"id":{"type":"string","minLength":1}},"required":["type","id"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"agent"},"id":{"type":"string","minLength":1},"app":{"type":"string","minLength":1},"onBehalfOf":{"type":"string","minLength":1}},"required":["type","id","app","onBehalfOf"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"system"},"id":{"type":"string","minLength":1}},"required":["type","id"],"additionalProperties":false}],"description":"Who performed a write."},"ActorRef":{"type":"string","minLength":1,"description":"User id, or agent:<app>:<id>:<onBehalfOf>, or system:<id>."},"ApiToken":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"name":{"type":"string"},"prefix":{"type":"string","description":"The secret's first characters, to recognise it."},"scopes":{"type":"array","items":{"type":"string","enum":["docs:read","docs:write"]}},"createdAt":{"type":"string"},"lastUsedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]}},"required":["id","workspaceId","name","prefix","scopes","createdAt","lastUsedAt","expiresAt"],"additionalProperties":false},"Attachment":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"documentId":{"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}],"description":"The document it belongs to; null for workspace files."},"filename":{"type":"string","minLength":1,"maxLength":255},"contentType":{"type":"string","minLength":1,"maxLength":255},"size":{"type":"integer","minimum":0,"maximum":9007199254740991},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"},"deletedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"updatedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]}},"required":["id","workspaceId","documentId","filename","contentType","size","sha256","createdAt","updatedAt","deletedAt"],"additionalProperties":false},"Backlink":{"type":"object","properties":{"source":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"title":{"type":"string","minLength":1,"maxLength":255},"parentId":{"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"}},"required":["id","title","parentId","workspaceId"],"additionalProperties":false},"kind":{"type":"string","enum":["link","embed"]},"syntax":{"type":"string","enum":["wikilink","markdown"]},"targetRef":{"type":"string"},"sourceBlockId":{"anyOf":[{"$ref":"#/components/schemas/BlockId"},{"type":"null"}]},"targetHeading":{"type":["string","null"]},"targetBlockId":{"anyOf":[{"$ref":"#/components/schemas/BlockId"},{"type":"null"}]},"sourceProperty":{"description":"Set when the link is in a property (a relation value or a [[link]]).","type":["string","null"]}},"required":["source","kind","syntax","targetRef","sourceBlockId","targetHeading","targetBlockId"],"additionalProperties":false},"BlobUpload":{"type":"object","properties":{"method":{"type":"string","const":"PUT"},"url":{"type":"string"},"headers":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"expiresAt":{"$ref":"#/components/schemas/Timestamp"}},"required":["method","url","headers","expiresAt"],"additionalProperties":false},"BlockId":{"type":"string","pattern":"^[A-Za-z0-9-]{1,64}$"},"BodyEditInput":{"type":"object","properties":{"oldStr":{"type":"string","minLength":1},"newStr":{"type":"string"},"replaceAll":{"default":false,"type":"boolean"}},"required":["oldStr","newStr"]},"ChildEntry":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"parentId":{"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"title":{"type":"string","minLength":1,"maxLength":255},"sortKey":{"$ref":"#/components/schemas/SortKey"},"properties":{"$ref":"#/components/schemas/Properties"},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"},"deletedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"updatedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"childCount":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"Live children, so a tree can show a disclosure."},"teamspaceId":{"type":["string","null"]},"privateOwnerId":{"type":["string","null"]}},"required":["id","workspaceId","parentId","title","sortKey","properties","createdAt","updatedAt","deletedAt","childCount"],"additionalProperties":false},"Color":{"type":"string","enum":["default","gray","brown","orange","yellow","green","blue","purple","pink","red"]},"Connection":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"connector":{"type":"string"},"name":{"type":"string"},"authMethod":{"type":"string","enum":["token","oauth2","generated"]},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"credentialsHint":{"type":["string","null"]},"account":{"description":"Who the credentials act as at the destination.","type":["string","null"]},"status":{"type":"string","enum":["active","error"]},"lastError":{"type":["string","null"]},"lastValidatedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"createdBy":{"type":["string","null"]},"updatedBy":{"type":["string","null"]},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"}},"required":["id","workspaceId","connector","name","authMethod","settings","credentialsHint","account","status","lastError","lastValidatedAt","createdBy","updatedBy","createdAt","updatedAt"],"additionalProperties":false,"description":"A destination account. Credentials are never returned."},"ConnectorInfo":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"auth":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["token","oauth2","generated"]},"label":{"type":"string"},"fields":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"JSON Schema of the credentials to type in."},"available":{"type":"boolean","description":"false: OAuth is not configured on this server."}},"required":["type","label","fields","available"],"additionalProperties":false}},"settingsSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"configSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"capabilities":{"type":"object","properties":{"format":{"type":"string","enum":["markdown","html","json"]},"remoteState":{"type":"boolean"},"pull":{"type":"boolean"},"conflicts":{"type":"string","enum":["pullRequest","diverge","none"]},"assets":{"type":"string","enum":["files","upload","link"]},"unpublish":{"type":"string","enum":["delete","draft","notify"]},"drafts":{"type":"boolean"},"schedule":{"type":"boolean"}},"required":["format","remoteState","pull","conflicts","assets","unpublish","drafts","schedule"],"additionalProperties":false}},"required":["id","name","description","auth","settingsSchema","configSchema","capabilities"],"additionalProperties":false},"Database":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"config":{"$ref":"#/components/schemas/DatabaseConfig"},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"},"deletedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"updatedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]}},"required":["id","workspaceId","config","createdAt","updatedAt","deletedAt"],"additionalProperties":false},"DatabaseConfig":{"type":"object","properties":{"filter":{"default":null,"anyOf":[{"$ref":"#/components/schemas/FilterNode"},{"type":"null"}]},"templateIds":{"default":[],"type":"array","items":{"$ref":"#/components/schemas/Ulid"}},"extra":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["filter","templateIds","extra"],"additionalProperties":false},"DatabaseConfigInput":{"type":"object","properties":{"filter":{"default":null,"anyOf":[{"$ref":"#/components/schemas/FilterNode"},{"type":"null"}]},"templateIds":{"default":[],"type":"array","items":{"$ref":"#/components/schemas/Ulid"}},"extra":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"DatabaseDefinition":{"type":"object","properties":{"database":{"$ref":"#/components/schemas/Database"},"properties":{"type":"array","items":{"$ref":"#/components/schemas/DatabaseProperty"}},"views":{"type":"array","items":{"$ref":"#/components/schemas/DatabaseView"}}},"required":["database","properties","views"],"additionalProperties":false},"DatabaseOutline":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"properties":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/PropertyType"},"key":{"type":"string"}},"required":["id","name","type","key"],"additionalProperties":false}},"views":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/ViewType"}},"required":["id","name","type"],"additionalProperties":false}}},"required":["id","properties","views"],"additionalProperties":false,"description":"A database's properties and views, in order."},"DatabaseProperty":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"databaseId":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string","minLength":1,"maxLength":200,"description":"Display name (Bases displayName)."},"type":{"$ref":"#/components/schemas/PropertyType"},"key":{"type":"string","minLength":1,"maxLength":128,"description":"Stored types: the frontmatter key holding the value. Formulas, rollups, createdBy and updatedBy: the formula name in the .base file. Unused for title and created/updated time."},"config":{"$ref":"#/components/schemas/PropertyConfig"},"sortKey":{"$ref":"#/components/schemas/SortKey"},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"},"deletedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"updatedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]}},"required":["id","workspaceId","databaseId","name","type","key","config","sortKey","createdAt","updatedAt","deletedAt"],"additionalProperties":false},"DatabaseSummary":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"config":{"$ref":"#/components/schemas/DatabaseConfig"},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"},"deletedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"updatedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"title":{"type":"string"},"parentId":{"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]}},"required":["id","workspaceId","config","createdAt","updatedAt","deletedAt","title","parentId"],"additionalProperties":false},"DatabaseView":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"databaseId":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string","minLength":1,"maxLength":200},"type":{"$ref":"#/components/schemas/ViewType"},"config":{"$ref":"#/components/schemas/ViewConfig"},"sortKey":{"$ref":"#/components/schemas/SortKey"},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"},"deletedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"updatedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]}},"required":["id","workspaceId","databaseId","name","type","config","sortKey","createdAt","updatedAt","deletedAt"],"additionalProperties":false},"Document":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"parentId":{"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"title":{"type":"string","minLength":1,"maxLength":255},"sortKey":{"$ref":"#/components/schemas/SortKey"},"properties":{"$ref":"#/components/schemas/Properties"},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"},"deletedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"updatedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]}},"required":["id","workspaceId","parentId","title","sortKey","properties","createdAt","updatedAt","deletedAt"],"additionalProperties":false,"description":"Document metadata. The body is not part of it."},"DocumentBody":{"type":"object","properties":{"markdown":{"type":"string"},"version":{"type":"string","description":"Opaque content version; pass it as expectedVersion."}},"required":["markdown","version"],"additionalProperties":false},"DocumentGrant":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"documentId":{"type":"string"},"principalType":{"$ref":"#/components/schemas/PrincipalType"},"principalId":{"type":"string"},"level":{"$ref":"#/components/schemas/AccessLevel"},"createdBy":{"type":["string","null"]},"createdAt":{"$ref":"#/components/schemas/Timestamp"}},"required":["id","documentId","principalType","principalId","level","createdBy","createdAt"],"additionalProperties":false},"DocumentVersion":{"type":"object","properties":{"id":{"type":"string"},"documentId":{"$ref":"#/components/schemas/Ulid"},"kind":{"type":"string","enum":["auto","before_write","restore"],"description":"auto: editing went idle. before_write: the state before an API write or restore. restore: the result of a restore."},"authors":{"type":"array","items":{"type":"string"},"description":"Actor refs of whoever changed the body since the previous version."},"restoredFrom":{"type":["string","null"]},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"}},"required":["id","documentId","kind","authors","restoredFrom","sizeBytes","createdAt"],"additionalProperties":false},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_input","not_found","conflict","forbidden","unknown_operation","internal"]},"message":{"type":"string"},"hint":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false},"FilterCondition":{"type":"object","properties":{"type":{"type":"string","const":"condition"},"propertyId":{"$ref":"#/components/schemas/Ulid"},"op":{"$ref":"#/components/schemas/FilterOp"},"value":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"$ref":"#/components/schemas/RelativeDate"},{"$ref":"#/components/schemas/MeValue"}]},{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"$ref":"#/components/schemas/RelativeDate"},{"$ref":"#/components/schemas/MeValue"}]}},{"type":"null"}]}},"required":["type","propertyId","op"],"additionalProperties":false},"FilterExpression":{"type":"object","properties":{"type":{"type":"string","const":"expression"},"expression":{"type":"string","minLength":1}},"required":["type","expression"],"additionalProperties":false},"FilterNode":{"oneOf":[{"$ref":"#/components/schemas/FilterCondition"},{"$ref":"#/components/schemas/FilterExpression"},{"type":"object","properties":{"type":{"type":"string","const":"group"},"combinator":{"type":"string","enum":["and","or","not"]},"children":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/FilterCondition"},{"$ref":"#/components/schemas/FilterExpression"},{"type":"object","properties":{"type":{"type":"string","const":"group"},"combinator":{"type":"string","enum":["and","or","not"]},"children":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/FilterCondition"},{"$ref":"#/components/schemas/FilterExpression"},{"type":"object","properties":{"type":{"type":"string","const":"group"},"combinator":{"type":"string","enum":["and","or","not"]},"children":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/FilterCondition"},{"$ref":"#/components/schemas/FilterExpression"}]}}},"required":["type","combinator","children"],"additionalProperties":false}]}}},"required":["type","combinator","children"],"additionalProperties":false}]}}},"required":["type","combinator","children"],"additionalProperties":false}]},"FilterOp":{"type":"string","enum":["eq","neq","contains","notContains","startsWith","endsWith","lt","lte","gt","gte","between","in","notIn","isEmpty","isNotEmpty"]},"GroupBy":{"type":"object","properties":{"propertyId":{"$ref":"#/components/schemas/Ulid"},"direction":{"default":"asc","type":"string","enum":["asc","desc"]},"order":{"type":"array","items":{"type":["string","null"]}},"hideEmpty":{"description":"Hide groups with no rows (board columns).","type":"boolean"},"dateBucket":{"description":"Date grouping; default month.","type":"string","enum":["day","week","month","year"]},"collapsed":{"type":"array","items":{"type":["string","null"]}}},"required":["propertyId","direction"],"additionalProperties":false},"GroupByInput":{"type":"object","properties":{"propertyId":{"$ref":"#/components/schemas/Ulid"},"direction":{"default":"asc","type":"string","enum":["asc","desc"]},"order":{"type":"array","items":{"type":["string","null"]}},"hideEmpty":{"description":"Hide groups with no rows (board columns).","type":"boolean"},"dateBucket":{"description":"Date grouping; default month.","type":"string","enum":["day","week","month","year"]},"collapsed":{"type":"array","items":{"type":["string","null"]}}},"required":["propertyId"]},"HistoryEntry":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"operation":{"type":"string"},"input":{},"inverse":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/InverseStep"}},{"type":"null"}],"description":"Operations that undo it, in the order to run them; null if it cannot be undone."},"actor":{"$ref":"#/components/schemas/Actor"},"sessionId":{"type":["string","null"]},"groupId":{"description":"Operations applied together (one transaction) share a group.","$ref":"#/components/schemas/Ulid"},"workspaceId":{"anyOf":[{"$ref":"#/components/schemas/WorkspaceId"},{"type":"null"}]},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"undoneAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]}},"required":["id","operation","input","inverse","actor","sessionId","groupId","workspaceId","createdAt","undoneAt"],"additionalProperties":false},"HistorySession":{"type":"object","properties":{"sessionId":{"type":"string"},"actor":{"$ref":"#/components/schemas/Actor"},"workspaceId":{"anyOf":[{"$ref":"#/components/schemas/WorkspaceId"},{"type":"null"}]},"firstAt":{"$ref":"#/components/schemas/Timestamp"},"lastAt":{"$ref":"#/components/schemas/Timestamp"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"undoneCount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["sessionId","actor","workspaceId","firstAt","lastAt","count","undoneCount"],"additionalProperties":false},"InverseStep":{"type":"object","properties":{"op":{"type":"string"},"input":{},"rewrite":{"$ref":"#/components/schemas/SchemaRewrite"}},"required":["op","input"],"additionalProperties":false},"Invitation":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"email":{"type":"string"},"role":{"$ref":"#/components/schemas/WorkspaceRole"},"status":{"type":"string","enum":["pending","accepted","declined","revoked"]},"expiresAt":{"$ref":"#/components/schemas/Timestamp"},"documentId":{"type":["string","null"]},"documentLevel":{"anyOf":[{"$ref":"#/components/schemas/AccessLevel"},{"type":"null"}]},"teamspaceIds":{"type":"array","items":{"type":"string"}},"invitedBy":{"type":["string","null"]},"createdAt":{"$ref":"#/components/schemas/Timestamp"}},"required":["id","workspaceId","email","role","status","expiresAt","documentId","documentLevel","teamspaceIds","invitedBy","createdAt"],"additionalProperties":false},"InvitationPreview":{"type":"object","properties":{"invitation":{"$ref":"#/components/schemas/Invitation"},"workspaceName":{"type":"string"},"invitedByName":{"type":["string","null"]},"documentTitle":{"type":["string","null"]}},"required":["invitation","workspaceName","invitedByName","documentTitle"],"additionalProperties":false},"MeValue":{"type":"object","properties":{"me":{"type":"boolean","const":true}},"required":["me"],"additionalProperties":false},"Member":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"userId":{"$ref":"#/components/schemas/UserId"},"role":{"$ref":"#/components/schemas/WorkspaceRole"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":["string","null"]},"createdAt":{"$ref":"#/components/schemas/Timestamp"}},"required":["id","workspaceId","userId","role","name","email","image","createdAt"],"additionalProperties":false},"Notification":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"kind":{"type":"string","enum":["mention","share","invitation_accepted","assigned"]},"documentId":{"type":["string","null"]},"actorId":{"description":"Who caused it; null when unknown.","type":["string","null"]},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"mention: { title, actorName, snippet }; share: { title, actorName, level }; invitation_accepted: { email, name, workspaceName, documentId? }; assigned: { title, actorName, propertyName, propertyId, databaseId }"},"readAt":{"type":["string","null"]},"archivedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","workspaceId","kind","documentId","actorId","data","readAt","archivedAt","createdAt"],"additionalProperties":false},"OAuthGrant":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"client":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"uri":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"scopes":{"type":"array","items":{"type":"string","enum":["docs:read","docs:write"]}},"createdAt":{"type":"string"},"lastUsedAt":{"type":["string","null"]}},"required":["id","workspaceId","client","scopes","createdAt","lastUsedAt"],"additionalProperties":false},"OAuthRequest":{"type":"object","properties":{"id":{"type":"string"},"client":{"type":"object","properties":{"name":{"type":"string"},"uri":{"type":"string"},"logoUri":{"type":"string"},"redirectHost":{"type":"string","description":"Where the app sends you back (host[:port])."}},"required":["name","redirectHost"],"additionalProperties":false},"scopes":{"type":"array","items":{"type":"string","enum":["docs:read","docs:write"]},"description":"What the app asks for."},"expiresAt":{"type":"string"}},"required":["id","client","scopes","expiresAt"],"additionalProperties":false},"OutgoingLink":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"kind":{"type":"string","enum":["link","embed"]},"syntax":{"type":"string","enum":["wikilink","markdown"]},"targetRef":{"type":"string","description":"The link target as written (path or title, without #part)."},"targetHeading":{"type":["string","null"]},"targetBlockId":{"anyOf":[{"$ref":"#/components/schemas/BlockId"},{"type":"null"}]},"sourceBlockId":{"anyOf":[{"$ref":"#/components/schemas/BlockId"},{"type":"null"}]},"sourceProperty":{"type":["string","null"]},"target":{"anyOf":[{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"title":{"type":"string","minLength":1,"maxLength":255},"parentId":{"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"}},"required":["id","title","parentId","workspaceId"],"additionalProperties":false},{"type":"null"}],"description":"The live document it resolves to; null when it resolves to nothing or to the trash."}},"required":["id","kind","syntax","targetRef","targetHeading","targetBlockId","sourceBlockId","target"],"additionalProperties":false},"PrincipalType":{"type":"string","enum":["user","teamspace","workspace"],"description":"workspace = everyone in the workspace except guests."},"Properties":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":128},"additionalProperties":{"$ref":"#/components/schemas/PropertyValue"},"description":"Typed frontmatter properties."},"PropertyConfig":{"type":"object","properties":{"options":{"description":"select, multiSelect, status","type":"array","items":{"$ref":"#/components/schemas/SelectOption"}},"numberFormat":{"type":"string","enum":["number","integer","commas","percent","currency"]},"decimals":{"type":"integer","minimum":0,"maximum":10},"currency":{"description":"ISO 4217 code, with numberFormat currency","type":"string","minLength":3,"maxLength":3},"includeTime":{"description":"date: values carry a time","type":"boolean"},"range":{"description":"date: values may carry an end (start/end)","type":"boolean"},"relation":{"$ref":"#/components/schemas/RelationConfig"},"rollup":{"$ref":"#/components/schemas/RollupConfig"},"expression":{"description":"formula: an Obsidian Bases expression","type":"string"},"prefix":{"description":"uniqueId: shown before the number (\"LYD\" → LYD-12)","type":"string","maxLength":16,"pattern":"^(?:[A-Za-z][A-Za-z0-9]*)?$"},"extra":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false},"PropertyConfigInput":{"type":"object","properties":{"options":{"description":"select, multiSelect, status","type":"array","items":{"$ref":"#/components/schemas/SelectOptionInput"}},"numberFormat":{"type":"string","enum":["number","integer","commas","percent","currency"]},"decimals":{"type":"integer","minimum":0,"maximum":10},"currency":{"description":"ISO 4217 code, with numberFormat currency","type":"string","minLength":3,"maxLength":3},"includeTime":{"description":"date: values carry a time","type":"boolean"},"range":{"description":"date: values may carry an end (start/end)","type":"boolean"},"relation":{"$ref":"#/components/schemas/RelationConfigInput"},"rollup":{"$ref":"#/components/schemas/RollupConfigInput"},"expression":{"description":"formula: an Obsidian Bases expression","type":"string"},"prefix":{"description":"uniqueId: shown before the number (\"LYD\" → LYD-12)","type":"string","maxLength":16,"pattern":"^(?:[A-Za-z][A-Za-z0-9]*)?$"},"extra":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"PropertyConfigSpecInput":{"type":"object","properties":{"options":{"description":"select, multiSelect, status","type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string","minLength":1,"maxLength":200},"color":{"default":"default","$ref":"#/components/schemas/Color"},"group":{"$ref":"#/components/schemas/StatusGroup"}},"required":["name"]}},"numberFormat":{"type":"string","enum":["number","integer","commas","percent","currency"]},"decimals":{"type":"integer","minimum":0,"maximum":10},"currency":{"description":"ISO 4217 code, with numberFormat currency","type":"string","minLength":3,"maxLength":3},"includeTime":{"description":"date: values carry a time","type":"boolean"},"range":{"description":"date: values may carry an end (start/end)","type":"boolean"},"relation":{"$ref":"#/components/schemas/RelationConfigInput"},"rollup":{"$ref":"#/components/schemas/RollupConfigInput"},"expression":{"description":"formula: an Obsidian Bases expression","type":"string"},"prefix":{"description":"uniqueId: shown before the number (\"LYD\" → LYD-12)","type":"string","maxLength":16,"pattern":"^(?:[A-Za-z][A-Za-z0-9]*)?$"},"extra":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"PropertyType":{"type":"string","enum":["title","text","number","select","multiSelect","status","date","checkbox","url","email","phone","person","files","relation","rollup","formula","uniqueId","createdTime","updatedTime","createdBy","updatedBy"]},"PropertyValue":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"type":"string"}}]},"Publication":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"connectionId":{"$ref":"#/components/schemas/Ulid"},"connector":{"type":"string"},"documentId":{"$ref":"#/components/schemas/Ulid"},"includeSubpages":{"type":"boolean"},"filter":{"anyOf":[{"type":"object","properties":{"property":{"type":"string","minLength":1,"maxLength":128},"equals":{}},"required":["property","equals"],"additionalProperties":false},{"type":"null"}],"description":"Publish only documents whose property equals this (lists: contains it)."},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"autoPublish":{"type":"boolean"},"lastRunAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"items":{"type":"array","items":{"$ref":"#/components/schemas/PublicationItem"}},"createdBy":{"type":["string","null"]},"updatedBy":{"type":["string","null"]},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"}},"required":["id","workspaceId","connectionId","connector","documentId","includeSubpages","filter","config","autoPublish","lastRunAt","items","createdBy","updatedBy","createdAt","updatedAt"],"additionalProperties":false},"PublicationItem":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"documentId":{"$ref":"#/components/schemas/Ulid"},"state":{"type":"string","enum":["draft","scheduled","publishing","published","updated_pending","failed","unpublished","diverged"]},"externalId":{"type":["string","null"]},"externalUrl":{"type":["string","null"]},"lastPublishedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"lastError":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"divergence":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"For diverged items: reason, base/ours/theirs (destination format), conflicts, marked text and the pull request."},"updatedAt":{"$ref":"#/components/schemas/Timestamp"}},"required":["id","documentId","state","externalId","externalUrl","lastPublishedAt","lastError","divergence","updatedAt"],"additionalProperties":false},"PublicationRun":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"publicationId":{"$ref":"#/components/schemas/Ulid"},"action":{"type":"string","enum":["publish","unpublish","resolve"]},"trigger":{"type":"string","enum":["manual","auto","poll"]},"options":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"status":{"type":"string","enum":["queued","running","succeeded","partial","failed","cancelled"]},"attempt":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"runAt":{"$ref":"#/components/schemas/Timestamp"},"steps":{"type":"array","items":{"type":"object","properties":{"at":{"$ref":"#/components/schemas/Timestamp"},"step":{"type":"string"},"status":{"type":"string","enum":["ok","skipped","error","info"]},"documentId":{"type":"string"},"ms":{"type":"number"},"detail":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["at","step","status"],"additionalProperties":false}},"summary":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},{"type":"null"}]},"error":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"requestedBy":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"startedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"finishedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]}},"required":["id","publicationId","action","trigger","options","status","attempt","runAt","steps","summary","error","requestedBy","createdAt","startedAt","finishedAt"],"additionalProperties":false,"description":"A run and its log."},"RelationConfig":{"type":"object","properties":{"databaseId":{"description":"The database whose rows this relation points at.","$ref":"#/components/schemas/Ulid"},"twoWay":{"default":false,"type":"boolean"},"reversePropertyId":{"default":null,"description":"The synced property on the other database (two-way relations).","anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"limit":{"default":"many","type":"string","enum":["one","many"]}},"required":["databaseId","twoWay","reversePropertyId","limit"],"additionalProperties":false},"RelationConfigInput":{"type":"object","properties":{"databaseId":{"description":"The database whose rows this relation points at.","$ref":"#/components/schemas/Ulid"},"twoWay":{"default":false,"type":"boolean"},"reversePropertyId":{"default":null,"description":"The synced property on the other database (two-way relations).","anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"limit":{"default":"many","type":"string","enum":["one","many"]}},"required":["databaseId"]},"RelativeDate":{"type":"object","properties":{"relative":{"type":"string","enum":["today","now"]},"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unit":{"type":"string","enum":["minute","hour","day","week","month","year"]}},"required":["relative"],"additionalProperties":false},"RollupConfig":{"type":"object","properties":{"relationPropertyId":{"$ref":"#/components/schemas/Ulid"},"targetPropertyId":{"description":"A property of the related database.","$ref":"#/components/schemas/Ulid"},"function":{"$ref":"#/components/schemas/RollupFunction"}},"required":["relationPropertyId","targetPropertyId","function"],"additionalProperties":false},"RollupConfigInput":{"type":"object","properties":{"relationPropertyId":{"$ref":"#/components/schemas/Ulid"},"targetPropertyId":{"description":"A property of the related database.","$ref":"#/components/schemas/Ulid"},"function":{"$ref":"#/components/schemas/RollupFunction"}},"required":["relationPropertyId","targetPropertyId","function"]},"RollupFunction":{"type":"string","enum":["showOriginal","showUnique","count","countValues","countUnique","countEmpty","countNotEmpty","percentEmpty","percentNotEmpty","sum","average","median","min","max","range","earliest","latest","checked","unchecked","percentChecked","percentUnchecked"]},"SchemaRewrite":{"type":"object","properties":{"databaseId":{"$ref":"#/components/schemas/Ulid"},"propertyId":{"$ref":"#/components/schemas/Ulid"},"reason":{"type":"string","enum":["option","key","type","relation","uniqueId"]}},"required":["databaseId","propertyId","reason"],"additionalProperties":false},"SearchHit":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"title":{"type":"string"},"snippet":{"type":"string","description":"Matching excerpt; matches are wrapped in <mark></mark>."},"score":{"type":"number","description":"Lower is better (bm25)."}},"required":["id","title","snippet","score"],"additionalProperties":false},"SelectOption":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string","minLength":1,"maxLength":200},"color":{"default":"default","$ref":"#/components/schemas/Color"},"group":{"$ref":"#/components/schemas/StatusGroup"}},"required":["id","name","color"],"additionalProperties":false},"SelectOptionInput":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"name":{"type":"string","minLength":1,"maxLength":200},"color":{"default":"default","$ref":"#/components/schemas/Color"},"group":{"$ref":"#/components/schemas/StatusGroup"}},"required":["id","name"]},"ShareLink":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"documentId":{"type":"string"},"tokenHint":{"type":"string"},"includeSubpages":{"type":"boolean"},"expiresAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"hasPassword":{"type":"boolean"},"createdBy":{"type":["string","null"]},"createdAt":{"$ref":"#/components/schemas/Timestamp"}},"required":["id","documentId","tokenHint","includeSubpages","expiresAt","hasPassword","createdBy","createdAt"],"additionalProperties":false},"SharingInfo":{"type":"object","properties":{"documentId":{"$ref":"#/components/schemas/Ulid"},"myLevel":{"$ref":"#/components/schemas/AccessLevel"},"restricted":{"type":"boolean"},"teamspaceId":{"type":["string","null"]},"privateOwnerId":{"type":["string","null"]},"grants":{"type":"array","items":{"$ref":"#/components/schemas/DocumentGrant"},"description":"Grants on this page."},"inherited":{"type":"array","items":{"type":"object","properties":{"documentId":{"type":"string"},"title":{"type":"string"},"grants":{"type":"array","items":{"$ref":"#/components/schemas/DocumentGrant"}}},"required":["documentId","title","grants"],"additionalProperties":false},"description":"Grants on ancestors that apply here, nearest first, up to a restricted page."},"people":{"type":"array","items":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"name":{"type":"string"},"email":{"type":"string"},"level":{"$ref":"#/components/schemas/AccessLevel"}},"required":["userId","name","email","level"],"additionalProperties":false},"description":"Everyone who can access the page and their resolved level."}},"required":["documentId","myLevel","restricted","teamspaceId","privateOwnerId","grants","inherited","people"],"additionalProperties":false},"SortKey":{"type":"string","minLength":1,"maxLength":256,"pattern":"^[0-9A-Za-z]+$","description":"Fractional index key; siblings sort by (sortKey, id)."},"StatusGroup":{"type":"string","enum":["todo","inProgress","complete"]},"Teamspace":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"name":{"type":"string"},"description":{"type":"string"},"icon":{"type":["string","null"]},"visibility":{"$ref":"#/components/schemas/TeamspaceVisibility"},"isDefault":{"type":"boolean"},"myRole":{"anyOf":[{"$ref":"#/components/schemas/TeamspaceRole"},{"type":"null"}]},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"},"deletedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]}},"required":["id","workspaceId","name","description","icon","visibility","isDefault","myRole","createdAt","updatedAt"],"additionalProperties":false},"TeamspaceMember":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"teamspaceId":{"type":"string","minLength":1,"maxLength":64},"userId":{"$ref":"#/components/schemas/UserId"},"role":{"$ref":"#/components/schemas/TeamspaceRole"},"name":{"type":"string"},"email":{"type":"string"}},"required":["id","teamspaceId","userId","role","name","email"],"additionalProperties":false},"TeamspaceRole":{"type":"string","enum":["owner","member"]},"TeamspaceVisibility":{"type":"string","enum":["open","closed","private"]},"Timestamp":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$","description":"ISO 8601 UTC timestamp."},"TrashItem":{"type":"object","properties":{"kind":{"type":"string","enum":["document","attachment"]},"id":{"$ref":"#/components/schemas/Ulid"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"title":{"type":"string","description":"Document title or attachment filename."},"parentId":{"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}],"description":"Where a document goes back to on restore, if still there."},"deletedAt":{"$ref":"#/components/schemas/Timestamp"},"deletedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"descendantCount":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"Documents trashed together with it."}},"required":["kind","id","workspaceId","title","parentId","deletedAt","deletedBy","descendantCount"],"additionalProperties":false},"TreeEntry":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"},"parentId":{"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"title":{"type":"string","minLength":1,"maxLength":255},"sortKey":{"$ref":"#/components/schemas/SortKey"},"properties":{"$ref":"#/components/schemas/Properties"},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"},"deletedAt":{"anyOf":[{"$ref":"#/components/schemas/Timestamp"},{"type":"null"}]},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"updatedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"depth":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"0 for the top level of the listed tree."},"teamspaceId":{"type":["string","null"]},"privateOwnerId":{"type":["string","null"]}},"required":["id","workspaceId","parentId","title","sortKey","properties","createdAt","updatedAt","deletedAt","depth"],"additionalProperties":false},"Ulid":{"type":"string","pattern":"^[0-9A-HJKMNP-TV-Z]{26}$","description":"ULID (26 characters, Crockford base32)."},"UnlinkedMention":{"type":"object","properties":{"source":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"title":{"type":"string","minLength":1,"maxLength":255},"parentId":{"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"}},"required":["id","title","parentId","workspaceId"],"additionalProperties":false},"snippet":{"type":"string","description":"Matching excerpt; the mention is wrapped in <mark></mark>."}},"required":["source","snippet"],"additionalProperties":false},"UnresolvedLink":{"type":"object","properties":{"source":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"title":{"type":"string","minLength":1,"maxLength":255},"parentId":{"anyOf":[{"$ref":"#/components/schemas/Ulid"},{"type":"null"}]},"workspaceId":{"$ref":"#/components/schemas/WorkspaceId"}},"required":["id","title","parentId","workspaceId"],"additionalProperties":false},"kind":{"type":"string","enum":["link","embed"]},"syntax":{"type":"string","enum":["wikilink","markdown"]},"targetRef":{"type":"string"}},"required":["source","kind","syntax","targetRef"],"additionalProperties":false},"UserId":{"type":"string","minLength":1,"maxLength":64,"description":"User id."},"ViewColumn":{"type":"object","properties":{"propertyId":{"$ref":"#/components/schemas/Ulid"},"visible":{"default":true,"type":"boolean"},"width":{"type":"integer","minimum":20,"maximum":2000}},"required":["propertyId","visible"],"additionalProperties":false},"ViewColumnInput":{"type":"object","properties":{"propertyId":{"$ref":"#/components/schemas/Ulid"},"visible":{"default":true,"type":"boolean"},"width":{"type":"integer","minimum":20,"maximum":2000}},"required":["propertyId"]},"ViewConfig":{"type":"object","properties":{"filter":{"default":null,"anyOf":[{"$ref":"#/components/schemas/FilterNode"},{"type":"null"}]},"sorts":{"default":[],"type":"array","items":{"type":"object","properties":{"propertyId":{"$ref":"#/components/schemas/Ulid"},"direction":{"default":"asc","type":"string","enum":["asc","desc"]}},"required":["propertyId","direction"],"additionalProperties":false}},"groupBy":{"default":null,"anyOf":[{"$ref":"#/components/schemas/GroupBy"},{"type":"null"}]},"subGroupBy":{"default":null,"description":"Board swimlanes.","anyOf":[{"$ref":"#/components/schemas/GroupBy"},{"type":"null"}]},"columns":{"default":[],"type":"array","items":{"$ref":"#/components/schemas/ViewColumn"}},"limit":{"default":null,"anyOf":[{"type":"integer","minimum":1,"maximum":9007199254740991},{"type":"null"}]},"summaries":{"default":{},"description":"propertyId → summary name","type":"object","propertyNames":{"$ref":"#/components/schemas/Ulid"},"additionalProperties":{"type":"string"}},"layout":{"default":{},"$ref":"#/components/schemas/ViewLayout"},"extra":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["filter","sorts","groupBy","subGroupBy","columns","limit","summaries","layout","extra"],"additionalProperties":false},"ViewConfigInput":{"type":"object","properties":{"filter":{"default":null,"anyOf":[{"$ref":"#/components/schemas/FilterNode"},{"type":"null"}]},"sorts":{"default":[],"type":"array","items":{"type":"object","properties":{"propertyId":{"$ref":"#/components/schemas/Ulid"},"direction":{"default":"asc","type":"string","enum":["asc","desc"]}},"required":["propertyId"]}},"groupBy":{"default":null,"anyOf":[{"$ref":"#/components/schemas/GroupByInput"},{"type":"null"}]},"subGroupBy":{"default":null,"description":"Board swimlanes.","anyOf":[{"$ref":"#/components/schemas/GroupByInput"},{"type":"null"}]},"columns":{"default":[],"type":"array","items":{"$ref":"#/components/schemas/ViewColumnInput"}},"limit":{"default":null,"anyOf":[{"type":"integer","minimum":1,"maximum":9007199254740991},{"type":"null"}]},"summaries":{"default":{},"description":"propertyId → summary name","type":"object","propertyNames":{"$ref":"#/components/schemas/Ulid"},"additionalProperties":{"type":"string"}},"layout":{"default":{},"$ref":"#/components/schemas/ViewLayoutInput"},"extra":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"ViewConfigPatchInput":{"type":"object","properties":{"filter":{"anyOf":[{"$ref":"#/components/schemas/FilterNode"},{"type":"null"}]},"sorts":{"type":"array","items":{"type":"object","properties":{"propertyId":{"$ref":"#/components/schemas/Ulid"},"direction":{"default":"asc","type":"string","enum":["asc","desc"]}},"required":["propertyId"]}},"groupBy":{"anyOf":[{"$ref":"#/components/schemas/GroupByInput"},{"type":"null"}]},"subGroupBy":{"description":"Board swimlanes.","anyOf":[{"$ref":"#/components/schemas/GroupByInput"},{"type":"null"}]},"columns":{"type":"array","items":{"$ref":"#/components/schemas/ViewColumnInput"}},"limit":{"anyOf":[{"type":"integer","minimum":1,"maximum":9007199254740991},{"type":"null"}]},"summaries":{"description":"propertyId → summary name","type":"object","propertyNames":{"$ref":"#/components/schemas/Ulid"},"additionalProperties":{"type":"string"}},"layout":{"$ref":"#/components/schemas/ViewLayoutInput"},"extra":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"ViewGroup":{"type":"object","properties":{"key":{"type":["string","null"]},"subKey":{"description":"Set for sub-groups (board swimlanes); null otherwise.","type":["string","null"]},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"start":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["key","subKey","count","start"],"additionalProperties":false},"ViewLayout":{"type":"object","properties":{"rowHeight":{"description":"table","type":"string","enum":["short","medium","tall","extra"]},"wrapCells":{"description":"table","type":"boolean"},"cardSize":{"description":"board, gallery: px","type":"integer","minimum":50,"maximum":1000},"cover":{"description":"board, gallery: the card image","anyOf":[{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"property"},"propertyId":{"$ref":"#/components/schemas/Ulid"}},"required":["type","propertyId"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"pageContent"}},"required":["type"],"additionalProperties":false}]},{"type":"null"}]},"coverFit":{"type":"string","enum":["cover","contain"]},"coverAspectRatio":{"type":"number","minimum":0.1,"maximum":10},"markers":{"description":"list","type":"string","enum":["bullet","number","none"]},"calendarPropertyId":{"description":"calendar: the date property placing rows","$ref":"#/components/schemas/Ulid"},"calendarMode":{"type":"string","enum":["month","week"]},"showWeekends":{"type":"boolean"},"colorColumns":{"description":"board","type":"boolean"}},"additionalProperties":false},"ViewLayoutInput":{"type":"object","properties":{"rowHeight":{"description":"table","type":"string","enum":["short","medium","tall","extra"]},"wrapCells":{"description":"table","type":"boolean"},"cardSize":{"description":"board, gallery: px","type":"integer","minimum":50,"maximum":1000},"cover":{"description":"board, gallery: the card image","anyOf":[{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"property"},"propertyId":{"$ref":"#/components/schemas/Ulid"}},"required":["type","propertyId"]},{"type":"object","properties":{"type":{"type":"string","const":"pageContent"}},"required":["type"]}]},{"type":"null"}]},"coverFit":{"type":"string","enum":["cover","contain"]},"coverAspectRatio":{"type":"number","minimum":0.1,"maximum":10},"markers":{"description":"list","type":"string","enum":["bullet","number","none"]},"calendarPropertyId":{"description":"calendar: the date property placing rows","$ref":"#/components/schemas/Ulid"},"calendarMode":{"type":"string","enum":["month","week"]},"showWeekends":{"type":"boolean"},"colorColumns":{"description":"board","type":"boolean"}}},"ViewResult":{"type":"object","properties":{"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"offset":{"type":"integer","minimum":0,"maximum":9007199254740991},"rows":{"type":"array","items":{"$ref":"#/components/schemas/ViewRow"}},"groups":{"type":"array","items":{"$ref":"#/components/schemas/ViewGroup"}}},"required":["total","offset","rows","groups"],"additionalProperties":false},"ViewRow":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Ulid"},"title":{"type":"string"},"sortKey":{"$ref":"#/components/schemas/SortKey"},"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"updatedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorRef"},{"type":"null"}]},"group":{"description":"The row's group (null: no value or not grouped).","type":["string","null"]},"subGroup":{"type":["string","null"]},"computed":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","title","sortKey","properties","createdAt","updatedAt","createdBy","updatedBy","group","subGroup","computed"],"additionalProperties":false},"ViewType":{"type":"string","enum":["table","board","list","calendar","gallery"]},"Warning":{"type":"object","properties":{"code":{"type":"string","enum":["no_match","ambiguous_match"]},"message":{"type":"string"},"editIndex":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","message"],"additionalProperties":false},"WorkspaceId":{"type":"string","minLength":1,"maxLength":64,"description":"Workspace id."},"WorkspaceRole":{"type":"string","enum":["owner","admin","member","guest"],"description":"Guests only see pages shared with them."},"WorkspaceSummary":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/WorkspaceId"},"name":{"type":"string"},"role":{"$ref":"#/components/schemas/WorkspaceRole"},"createdAt":{"$ref":"#/components/schemas/Timestamp"},"updatedAt":{"$ref":"#/components/schemas/Timestamp"}},"required":["id","name","role","createdAt","updatedAt"],"additionalProperties":false}},"parameters":{"LydieVersion":{"name":"Lydie-Version","in":"header","required":false,"description":"API version (YYYY-MM-DD). Defaults to the version pinned on the token.","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-12"}}},"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"security":[{"bearer":[]}]}