Documents are the core content unit in Caret. Every document lives inside a workspace and can optionally be placed in a folder within that workspace. The Documents API gives you full control over the document lifecycle — from creating a blank page and writing structured content, to sharing it with collaborators at fine-grained permission levels. Content is stored in two parallel representations: a structured Tiptap/ProseMirror JSON tree (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/arrozet/caret/llms.txt
Use this file to discover all available pages before exploring further.
content_json) that the rich-text editor consumes, and a plain-text extraction (content_text) used for search and AI context. All endpoints require a valid Supabase JWT passed as a Bearer token.
All endpoints are routed through the API Gateway. The gateway forwards
/api/v1/documents* traffic to the internal document-service. You should always target https://api.caret.page/api/v1/... in client code.POST /api/v1/documents
Create a new document inside a workspace. The caller is automatically set as the document owner. The document is created with an empty body — use PATCH /api/v1/documents/{id} to write content after creation.
Request body
Display title for the document. Shown in the workspace sidebar and document header.
UUID of the workspace the document will belong to. The caller must be a member of this workspace.
UUID of the folder to place the document in. Omit (or pass
null) to create the document at the workspace root.201 Created
UUID of the newly created document.
UUID of the workspace this document belongs to.
UUID of the containing folder, or
null if the document is at the workspace root.Document title as provided at creation time.
Lifecycle status. Newly created documents start as
active. Can also be archived.Access scope. One of
private, workspace, link, or public.UUID of the user who owns the document. Set to the caller’s user ID on creation.
Latest Tiptap/ProseMirror JSON content tree.
null for a newly created empty document.Plain-text extraction of the document content.
null for a newly created empty document.ISO 8601 timestamp of when the document was created.
ISO 8601 timestamp of the last update to the document record.
GET /api/v1/documents
List all documents in a given workspace that the caller has access to. Returns documents the caller owns or is an explicit member of within the specified workspace. This endpoint does not return documents shared directly with the caller from other workspaces — use GET /api/v1/documents/shared for those.
Query parameters
UUID of the workspace to list documents from.
Maximum number of documents to return. Omit for unpaginated results.
Number of documents to skip before returning results. Used together with
limit for cursor-style pagination.200 OK — array of DocumentResponseDto
Returns an array of document objects. Each object has the same shape as the response documented in POST /api/v1/documents above.
GET /api/v1/documents/shared
List all documents that have been shared directly with the authenticated caller — that is, documents where the caller has been added as an explicit document-level collaborator (editor, commenter, or viewer), regardless of workspace membership. This is useful for building “Shared with me” views.
Response — 200 OK — array of DocumentResponseDto
Returns an array of document objects using the same shape as other document endpoints.
GET /api/v1/documents/{id}
Retrieve a single document by its UUID. The response includes the full content_json and content_text fields when content has been saved. The caller must have at least viewer access to the document.
Path parameters
UUID of the document to retrieve.
200 OK — DocumentResponseDto
UUID of the document.
UUID of the workspace this document belongs to.
UUID of the containing folder, or
null if the document is at the workspace root.Document title.
Lifecycle status —
active or archived.Access scope —
private, workspace, link, or public.UUID of the document owner.
The latest saved Tiptap/ProseMirror JSON content tree.
null if no content has been written yet.Plain-text extraction of the latest document content. Used for search and AI context injection.
null if no content has been written yet.ISO 8601 creation timestamp.
ISO 8601 timestamp of the last update.
PATCH /api/v1/documents/{id}
Update a document’s title, folder placement, workspace assignment, or rich-text content. All fields are optional — only the fields you include will be changed. This is the primary write path for the editor: the Tiptap frontend sends content_json and content_text together whenever the user saves.
The gateway spec uses
PATCH for this operation (partial update semantics). Only fields you include in the request body will be modified; omitted fields are left unchanged.UUID of the document to update.
New title for the document.
Move the document to a different workspace by supplying its UUID. The caller must have write access in the target workspace.
Move the document to a different folder. Pass a folder UUID to move into a folder, or
null to move the document to the workspace root.Updated Tiptap/ProseMirror JSON content tree. Should be sent together with
content_text.Updated plain-text extraction of the document content. Used by the AI service for RAG indexing. Should be sent together with
content_json.200 OK — DocumentResponseDto
Returns the full updated document object.
DELETE /api/v1/documents/{id}
Soft-delete a document by its UUID. The document is marked as deleted in the database but not permanently removed, preserving audit history and allowing potential recovery. Only the document owner or a workspace owner can delete a document.
Path parameters
UUID of the document to delete.
204 No Content
No response body is returned on successful deletion.
POST /api/v1/documents/{id}/invite
Invite a user to collaborate on a specific document by their email address. The invited user is found by email in the Caret user directory and granted a direct document-level role. Document-level sharing is distinct from workspace membership — a user can be given access to a single document without becoming a workspace member.
The response scope field is always "document", distinguishing this invite from workspace-level membership recorded by the workspaces invite endpoint.
Collaboration roles
| Role | Permissions |
|---|---|
owner | Full control, including inviting others and deleting the document |
editor | Can read and write document content |
commenter | Can read content and leave comments |
viewer | Read-only access |
UUID of the document to invite the collaborator to.
Email address of the user to invite. The user must already have a Caret account.
201 Created
UUID of the document the collaborator was invited to.
UUID of the invited user.
Email address of the invited user, as provided in the request.
The role granted to the invited user. One of
owner, editor, commenter, or viewer.Always
"document" for this endpoint, indicating a direct document-level share (as opposed to workspace-level membership).