Files
The REST API for the Files app. Create documents for AI-powered analysis and semantic search. Document content is stored securely and automatically indexed for semantic search.
List Documents
GET /v1/documents Query Parameters
| Parameter | Type | Description |
|---|---|---|
project_id | UUID | Scope results to a project (optional) |
parent_id | UUID | Scope results to a folder (optional) |
search | string | Filter by title text (optional) |
limit | integer | Max results (1 to 100) |
offset | integer | Pagination offset |
Create Document
POST /v1/documents Create a document with text content. The content is automatically indexed for semantic search in the background after the response returns.
System-assigned fields (id, org_id,
created_at, updated_at) are never supplied by the
caller; the organization comes from the authenticated session and the
rest are assigned by the server.
Request Body
| Field | Type | Description |
|---|---|---|
title | string | Document title (required) |
content | string | Document content (optional) |
content_type | string | One of markdown, plain, rich_text (optional, defaults to markdown) |
project_id | UUID | Project to attach the document to (optional) |
parent_id | UUID | Folder to place the document in (optional) |
tags | string[] | Tags (optional) |
Response
On success (201 Created) the complete created document is returned.
{
"success": true,
"data": {
"id": "...",
"org_id": "...",
"folder_id": null,
"project_id": null,
"title": "My Document",
"content": "...",
"content_type": "markdown",
"file_url": null,
"file_size": null,
"metadata": {},
"is_indexed": false,
"indexed_at": null,
"created_by": "...",
"created_at": "2026-06-20T12:00:00Z",
"updated_at": "2026-06-20T12:00:00Z",
"deleted_at": null
}
} is_indexed is false immediately after creation;
indexing completes in the background (see Indexing for Search below).
Response Codes
| Status | Meaning |
|---|---|
201 | Document created; the full record is returned |
400 | Validation error (missing/invalid field, a project_id/parent_id that does not reference an existing item, or content rejected by the safety policy) |
401 | Authentication required |
403 | Caller lacks the required permission to create documents |
500 | Unexpected server error |
Get Document
GET /v1/documents/:id Returns the document record, including its content and metadata.
Update Document
PUT /v1/documents/:id
Update a document's title, content,
content_type, or tags. When new content is
supplied the document is automatically re-indexed in the background.
Delete Document
DELETE /v1/documents/:id Deletes the document. A file uploaded or saved in a Files library moves to Trash, where it can be restored for 30 days. After that it leaves Trash and can no longer be restored. Documents created in Docs, Sheets and Slides do not go to Trash.
List Trash
GET /v1/documents/trash Lists the deleted files you can still restore, most recently deleted first, 25 per page. The active list’s visibility applies: you see only files you could see before they were deleted.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | integer | Page number, 1 to 10000 (optional, defaults to 1) |
{
"success": true,
"data": {
"documents": [
{
"id": "...",
"title": "Q3 board pack.pdf",
"deleted_at": "2026-11-20T09:15:00Z",
"purge_at": "2026-12-20T09:15:00Z"
}
],
"total_count": 1
}
} purge_at is when the file leaves Trash and can no longer be restored.
Response Codes
| Status | Meaning |
|---|---|
200 | The page of Trash entries is returned |
400 | page is not a whole number from 1 to 10000 |
401 | Authentication required |
403 | Caller is not an active member of the organization |
500 | Unexpected server error |
Restore Document
POST /v1/documents/:id/restore
Restores a file from Trash to its original library and folder, keeping its
ID, contents and metadata, and returns the restored record with
deleted_at set to null and
"restored": true. No request body is needed. Restoring needs
permission to add files in the original location, and the restored file
counts toward your organization’s document limit again.
Response Codes
| Status | Meaning |
|---|---|
200 | File restored; the restored record is returned |
400 | The ID is not a valid UUID |
401 | Authentication required |
402 | The organization has reached its document limit |
403 | The organization has reached its storage limit or the caller cannot add files to the original location |
404 | The file is unavailable, has expired, or has already been restored |
500 | Unexpected server error |
Indexing for Search
After a document is created or its content is updated, it is automatically indexed for semantic search in the background, so the API response returns immediately. The search index is kept up to date for you, so no manual reindexing is required.
Once indexed, documents are searchable via the Search API and the AI assistant.