{"openapi":"3.1.0","info":{"title":"Cleve REST API","version":"1.0.0","summary":"Read and write notes and folders in a Cleve workspace, and read anyone's published posts.","description":"Cleve is an AI workspace and knowledge base. It keeps your notes, docs, voice notes and ideas in one place and lets you chat with AI models that have the full context of everything you have saved.\n\nThis API reads and writes the notes and folders in a workspace you belong to. Create a personal API key in Cleve under Settings → Developer and send it as `Authorization: Bearer <key>`. If you belong to several workspaces, send `X-Cleve-Workspace: <workspace id>` to choose one; the ID is under Settings → Developer.\n\nEvery success response wraps its payload in `{ \"data\": ... }`. Every error response is JSON with `error` (a human-readable message), `code` (a stable machine-readable code), `hint` (how to fix it) and `docs`.\n\nThe Sites routes serve the posts someone publishes on cleve.ai/@handle with no key, so a blog can use Cleve as its CMS.\n\nFor agents, the Cleve MCP server at https://app.cleve.ai/mcp exposes the same workspace as tools with OAuth sign-in.","termsOfService":"https://www.cleve.ai/terms","contact":{"name":"Cleve support","email":"support@cleve.ai","url":"https://docs.cleve.ai/developers/api"}},"servers":[{"url":"https://app.cleve.ai/api/v1","description":"Production"}],"externalDocs":{"description":"Cleve REST API guide","url":"https://docs.cleve.ai/developers/api"},"tags":[{"name":"Notes","description":"Markdown notes in the workspace."},{"name":"Folders","description":"Folders that group notes."},{"name":"Sites","description":"Public, read-only: the posts someone publishes on cleve.ai/@handle."}],"security":[{"bearerAuth":[]}],"paths":{"/notes":{"get":{"operationId":"listNotes","summary":"List notes","description":"Lists notes in the workspace, newest first, up to 200 (there is no paging). `content` is a short plain-text preview; call getNote for the full body.","tags":["Notes"],"parameters":[{"name":"folderId","in":"query","required":false,"description":"Only include notes in this folder.","schema":{"type":"string"}},{"name":"pinnedOnly","in":"query","required":false,"description":"When `true`, return only pinned notes.","schema":{"type":"boolean"}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"responses":{"200":{"description":"The notes.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NoteSummary"}}}}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createNote","summary":"Create a note","description":"Creates a note from a title and a Markdown body. Returns the new note's ID.","tags":["Notes"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteCreate"}}}},"responses":{"201":{"description":"The note was created.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["noteId"],"properties":{"noteId":{"type":"string"}}}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}]}},"/notes/count":{"get":{"operationId":"countNotes","summary":"Count notes","description":"Returns how many notes the workspace holds, and how many are pinned.","tags":["Notes"],"parameters":[{"name":"folderId","in":"query","required":false,"description":"Only include notes in this folder.","schema":{"type":"string"}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"responses":{"200":{"description":"The counts.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/NoteCount"}}}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/notes/recent":{"get":{"operationId":"listRecentNotes","summary":"List recently updated notes","description":"Lists the most recently updated notes.","tags":["Notes"],"parameters":[{"name":"limit","in":"query","required":false,"description":"How many notes to return. Values out of range are clamped; a value that isn't a number is a 400.","schema":{"type":"integer","minimum":1,"maximum":50,"default":10}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"responses":{"200":{"description":"The notes.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NoteSummary"}}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/notes/search":{"get":{"operationId":"searchNotes","summary":"Search notes","description":"Full-text search across note titles and bodies: body matches by relevance, then title-only matches. Each result's `content` is the plain-text copy, not Markdown; call getNote for the Markdown. Use searchNotesWithBody when the query has characters that are awkward to URL-encode.","tags":["Notes"],"parameters":[{"name":"query","in":"query","required":true,"description":"Search terms.","schema":{"type":"string","minLength":1}},{"name":"limit","in":"query","required":false,"description":"Maximum number of results. Values out of range are clamped.","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"folderId","in":"query","required":false,"description":"Only include notes in this folder.","schema":{"type":"string"}},{"name":"isPinned","in":"query","required":false,"description":"Filter by pinned state.","schema":{"type":"boolean"}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"responses":{"200":{"description":"Matching notes, as plain text.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Note"}}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"searchNotesWithBody","summary":"Search notes (JSON body)","description":"Same as searchNotes, with the search sent as a JSON body instead of query parameters.","tags":["Notes"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteSearch"}}}},"responses":{"200":{"description":"Matching notes, as plain text.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Note"}}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}]}},"/notes/{noteId}":{"get":{"operationId":"getNote","summary":"Get a note","description":"Returns one note with its metadata and its full content as Markdown.","tags":["Notes"],"parameters":[{"name":"noteId","in":"path","required":true,"description":"Note ID, as returned by listNotes, searchNotes or createNote (`_id` / `noteId`).","schema":{"type":"string"}},{"name":"format","in":"query","required":false,"description":"`markdown` (default) or `text` for the plain-text copy used by search.","schema":{"type":"string","enum":["markdown","text"]}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"responses":{"200":{"description":"The note.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Note"}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The note or folder does not exist, or this key cannot reach it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateNote","summary":"Update a note","description":"Updates a note. Every field is optional. `content` replaces the whole body; `title` alone rewrites only the title.","tags":["Notes"],"parameters":[{"name":"noteId","in":"path","required":true,"description":"Note ID, as returned by listNotes, searchNotes or createNote (`_id` / `noteId`).","schema":{"type":"string"}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteUpdate"}}}},"responses":{"200":{"description":"The note was updated.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Success"}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The note or folder does not exist, or this key cannot reach it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteNote","summary":"Move a note to the Bin","description":"Moves a note to the Bin. It can be restored with POST /notes/{noteId}/restore for 30 days, then it is deleted for good.","tags":["Notes"],"parameters":[{"name":"noteId","in":"path","required":true,"description":"Note ID, as returned by listNotes, searchNotes or createNote (`_id` / `noteId`).","schema":{"type":"string"}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"responses":{"200":{"description":"The note is in the Bin.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Success"}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The note or folder does not exist, or this key cannot reach it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/notes/{noteId}/restore":{"post":{"operationId":"restoreNote","summary":"Restore a note from the Bin","description":"Restores a note from the Bin into its folder, or the top level if that folder is gone.","tags":["Notes"],"parameters":[{"name":"noteId","in":"path","required":true,"description":"Note ID, as returned by listNotes, searchNotes or createNote (`_id` / `noteId`).","schema":{"type":"string"}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"responses":{"200":{"description":"The note was restored.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Success"}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The note or folder does not exist, or this key cannot reach it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/notes/{noteId}/publish":{"post":{"operationId":"publishNote","summary":"Publish a note","description":"Publishes a note (doc) to your public Cleve profile, where anyone can read it.","tags":["Notes"],"parameters":[{"name":"noteId","in":"path","required":true,"description":"Note ID, as returned by listNotes, searchNotes or createNote (`_id` / `noteId`).","schema":{"type":"string"}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"responses":{"200":{"description":"The note is published.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Success"}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The note or folder does not exist, or this key cannot reach it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"unpublishNote","summary":"Unpublish a note","description":"Takes a published note off the public web.","tags":["Notes"],"parameters":[{"name":"noteId","in":"path","required":true,"description":"Note ID, as returned by listNotes, searchNotes or createNote (`_id` / `noteId`).","schema":{"type":"string"}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"responses":{"200":{"description":"The note is no longer published.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Success"}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The note or folder does not exist, or this key cannot reach it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/folders":{"get":{"operationId":"listFolders","summary":"List folders","description":"Lists every folder in the workspace as a flat list. Nesting is given by `parentId`.","tags":["Folders"],"responses":{"200":{"description":"The folders.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Folder"}}}}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}]},"post":{"operationId":"createFolder","summary":"Create a folder","description":"Creates a folder, optionally inside another folder. Returns the new folder's ID.","tags":["Folders"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FolderCreate"}}}},"responses":{"201":{"description":"The folder was created.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["folderId"],"properties":{"folderId":{"type":"string"}}}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}]}},"/folders/{folderId}":{"patch":{"operationId":"renameFolder","summary":"Rename or move a folder","description":"Renames a folder, moves it into another folder or to the top level, or both.","tags":["Folders"],"parameters":[{"name":"folderId","in":"path","required":true,"description":"Folder ID, as returned by listFolders or createFolder.","schema":{"type":"string"}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FolderUpdate"}}}},"responses":{"200":{"description":"The folder was updated.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Success"}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The note or folder does not exist, or this key cannot reach it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteFolder","summary":"Move a folder to the Bin","description":"Moves a folder to the Bin with the notes and subfolders inside it. Restoring it within 30 days brings it all back.","tags":["Folders"],"parameters":[{"name":"folderId","in":"path","required":true,"description":"Folder ID, as returned by listFolders or createFolder.","schema":{"type":"string"}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"responses":{"200":{"description":"The folder is in the Bin.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Success"}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The note or folder does not exist, or this key cannot reach it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/folders/{folderId}/restore":{"post":{"operationId":"restoreFolder","summary":"Restore a folder from the Bin","description":"Restores a folder from the Bin, with everything that was binned along with it.","tags":["Folders"],"parameters":[{"name":"folderId","in":"path","required":true,"description":"Folder ID, as returned by listFolders or createFolder.","schema":{"type":"string"}},{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}],"responses":{"200":{"description":"The folder was restored.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Success"}}}}}},"400":{"description":"The request is invalid: a field is missing or wrong, an ID is malformed, or the note's state doesn't allow it. `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The note or folder does not exist, or this key cannot reach it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/bin":{"get":{"operationId":"listBin","summary":"List the Bin","description":"Lists the notes and folders in the Bin, newest first. Each item says when it will be deleted for good (`purgeAt`, milliseconds since the epoch).","tags":["Notes"],"responses":{"200":{"description":"The items in the Bin.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"type":"object","required":["kind","id","title","binnedAt","purgeAt"],"properties":{"kind":{"type":"string","enum":["note","folder"]},"id":{"type":"string"},"title":{"type":"string"},"binnedAt":{"type":"number"},"purgeAt":{"type":"number"},"binnedByName":{"type":["string","null"]},"fromFolderName":{"type":["string","null"]},"docCount":{"type":"number"},"canDeleteForever":{"type":"boolean"}}}}}}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key's user isn't allowed to do this (for example, pinning a note only shared with them), the `X-Cleve-Workspace` header names a workspace this key can't act in, or a workspace key's creator has left its workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"X-Cleve-Workspace","in":"header","required":false,"description":"Workspace (org) ID the request acts in, from Cleve → Settings → Developer. Needed only when a personal key's owner belongs to several workspaces; without it the request uses their first workspace. A workspace key always uses its own workspace.","schema":{"type":"string","examples":["org_2abc123"]}}]}},"/sites/{handle}/posts":{"get":{"operationId":"listSitePosts","summary":"List a site's posts","description":"Lists the docs someone has published on their site (cleve.ai/@handle), newest published first, a page at a time. Public: no API key needed. Lists docs published one by one; docs shown only because their folder is published are not included. Pass `nextCursor` back as `cursor` for the next page; it is `null` on the last page.","tags":["Sites"],"security":[],"parameters":[{"name":"handle","in":"path","required":true,"description":"The site's handle: the name after @ in cleve.ai/@handle. Case doesn't matter.","schema":{"type":"string","examples":["ashvin"]}},{"name":"limit","in":"query","required":false,"description":"How many posts per page. Values out of range are clamped; a value that isn't a number is a 400.","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"One page of posts.","content":{"application/json":{"schema":{"type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Post"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` for the next page."}}}}}},"400":{"description":"`limit` isn't a number, or `cursor` isn't one this API gave out.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No one has that handle, or the post isn't published there. Cached for a minute.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/sites/{handle}/posts/{postId}":{"get":{"operationId":"getSitePost","summary":"Get a published post","description":"One published post with its body as Markdown, ready for a blog. The title isn't repeated in the body, comment threads are left out, and doc links and mentions show as plain text. Public: no API key needed.","tags":["Sites"],"security":[],"parameters":[{"name":"handle","in":"path","required":true,"description":"The site's handle: the name after @ in cleve.ai/@handle. Case doesn't matter.","schema":{"type":"string","examples":["ashvin"]}},{"name":"postId","in":"path","required":true,"description":"The post's `id` from listSitePosts.","schema":{"type":"string"}}],"responses":{"200":{"description":"The post.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/PostWithBody"}}}}}},"404":{"description":"No one has that handle, or the post isn't published there. Cached for a minute.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/sites/{handle}/rss":{"get":{"operationId":"getSiteFeed","summary":"Get a site's RSS feed","description":"An RSS 2.0 feed of the 20 newest posts on someone's site, each with its title, link, date and excerpt. Public: no API key needed.","tags":["Sites"],"security":[],"parameters":[{"name":"handle","in":"path","required":true,"description":"The site's handle: the name after @ in cleve.ai/@handle. Case doesn't matter.","schema":{"type":"string","examples":["ashvin"]}}],"responses":{"200":{"description":"The feed.","content":{"application/rss+xml":{"schema":{"type":"string"}}}},"404":{"description":"No one has that handle, or the post isn't published there. Cached for a minute.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected server error. Safe to retry once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key sent as `Authorization: Bearer <key>`: a personal key from Cleve → Settings → Developer, or a workspace key from a workspace's API keys page (it acts as its creator, in that workspace only)."}},"schemas":{"Error":{"type":"object","description":"Every error response has this shape.","required":["error","code","hint","docs"],"properties":{"error":{"type":"string","description":"Human-readable message.","examples":["Note not found"]},"code":{"type":"string","description":"Stable machine-readable error code.","enum":["bad_request","unauthorized","forbidden","not_found","method_not_allowed","internal_error"]},"hint":{"type":"string","description":"How to resolve the error."},"docs":{"type":"string","format":"uri","description":"Where to read more."}}},"Success":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","const":true}}},"NoteKind":{"type":"string","enum":["note","memory","welcome","imported"],"description":"`memory` notes hold what Cleve remembers about you; `imported` notes came from an import."},"NoteSummary":{"type":"object","required":["_id","_creationTime","content","isPinned","updatedAt"],"properties":{"_id":{"type":"string","description":"Note ID."},"_creationTime":{"type":"number","description":"Creation time, milliseconds since the Unix epoch."},"userId":{"type":"string","description":"ID of the note's owner."},"title":{"type":"string"},"content":{"type":"string","description":"Plain-text preview of the body."},"kind":{"$ref":"#/components/schemas/NoteKind"},"isPinned":{"type":"boolean"},"linkRole":{"type":"string","enum":["viewer","editor"],"description":"What anyone with the link may do. Missing: only people the note is shared with can open it."},"isPublic":{"type":"boolean","deprecated":true,"description":"Legacy link-sharing flag, left on notes shared before linkRole. Read linkRole instead."},"isPublished":{"type":"boolean","description":"Whether the note is published to the web."},"publishedAt":{"type":"number","description":"Publish time, milliseconds since the Unix epoch."},"folderId":{"type":"string","description":"Folder the note is in, if any."},"updatedAt":{"type":"number","description":"Last update, milliseconds since the Unix epoch."},"orgId":{"type":"string","description":"Workspace ID."}}},"Note":{"description":"A note with its full content as Markdown (plain text with `?format=text`).","allOf":[{"$ref":"#/components/schemas/NoteSummary"},{"type":"object","properties":{"content":{"type":"string","description":"The whole note as Markdown, the same syntax PATCH takes, so it can be edited and written back. With `?format=text`, a plain-text copy instead."},"permission":{"type":"string","enum":["owner","editor","viewer"],"description":"What the caller may do with the note."},"canManageSharing":{"type":"boolean"}}}]},"NoteCount":{"type":"object","required":["total","pinned"],"properties":{"total":{"type":"integer","minimum":0},"pinned":{"type":"integer","minimum":0}}},"NoteCreate":{"type":"object","properties":{"title":{"type":"string","description":"Note title."},"content":{"type":"string","description":"Note body as Markdown."},"folderId":{"type":"string","description":"Folder to create the note in."},"isPinned":{"type":"boolean","description":"Pin the note."}},"examples":[{"title":"Meeting notes","content":"## Agenda\n\n- Item 1"}]},"NoteUpdate":{"type":"object","properties":{"title":{"type":"string","description":"New title."},"content":{"type":"string","description":"New body as Markdown. Replaces the whole body."},"isPinned":{"type":"boolean"},"linkAccess":{"type":"string","enum":["restricted","viewer","editor"],"description":"Who can open the note with its link: `restricted` (only people it is shared with), `viewer` or `editor`. Needs permission to manage the note's sharing."},"isPublic":{"type":"boolean","deprecated":true,"description":"Legacy: `true` is linkAccess `viewer`, `false` is `restricted`."},"folderId":{"type":["string","null"],"description":"Move to this folder, or `null` to unfile."}},"examples":[{"isPinned":true}]},"NoteSearch":{"type":"object","required":["query"],"properties":{"query":{"type":"string","minLength":1},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20},"folderId":{"type":"string"},"isPinned":{"type":"boolean"}},"examples":[{"query":"product roadmap","limit":5}]},"Folder":{"type":"object","required":["_id","_creationTime","name"],"properties":{"_id":{"type":"string","description":"Folder ID."},"_creationTime":{"type":"number","description":"Creation time, milliseconds since the Unix epoch."},"userId":{"type":"string","description":"ID of the folder's owner."},"name":{"type":"string"},"parentId":{"type":"string","description":"Parent folder ID. Absent for top-level folders."},"isPublic":{"type":"boolean"},"isPublished":{"type":"boolean"},"publishedAt":{"type":"number"},"orgId":{"type":"string","description":"Workspace ID."}}},"FolderCreate":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1},"parentId":{"type":"string","description":"Create the folder inside this folder."}},"examples":[{"name":"Research"}]},"PostAuthor":{"type":"object","required":["name","handle","imageUrl","url"],"properties":{"name":{"type":["string","null"]},"handle":{"type":"string"},"imageUrl":{"type":["string","null"],"format":"uri"},"url":{"type":"string","format":"uri","description":"Their site, cleve.ai/@handle."}}},"Post":{"type":"object","description":"A published post as a list shows it.","required":["id","title","excerpt","url","imageUrl","publishedAt","updatedAt","author"],"properties":{"id":{"type":"string","description":"Post ID (the doc's ID)."},"title":{"type":"string","description":"The title, or `Untitled`."},"excerpt":{"type":"string","description":"The opening words under the title, about 200 characters, as plain text."},"url":{"type":"string","format":"uri","description":"The post on cleve.ai/@handle."},"imageUrl":{"type":"string","format":"uri","description":"The post's social card image, as cleve.ai shows in link previews."},"publishedAt":{"type":"string","format":"date-time","description":"When it was first published."},"updatedAt":{"type":"string","format":"date-time","description":"When it last changed."},"author":{"$ref":"#/components/schemas/PostAuthor"}}},"PostWithBody":{"description":"A post with its body.","allOf":[{"$ref":"#/components/schemas/Post"},{"type":"object","required":["markdown"],"properties":{"markdown":{"type":"string","description":"The body as GitHub-flavoured Markdown, without the title heading. Toggles come as `<details>` HTML, and interactive blocks as fenced code marked `cleve-block`, which never runs on its own."}}}]},"FolderUpdate":{"type":"object","description":"Pass `name`, `parentId` or both.","minProperties":1,"properties":{"name":{"type":"string","minLength":1,"description":"New name."},"parentId":{"type":["string","null"],"description":"Move into this folder, or `null` to move to the top level."}},"examples":[{"name":"Renamed folder"},{"parentId":null}]}}}}