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

ParameterTypeDescription
project_idUUIDScope results to a project (optional)
parent_idUUIDScope results to a folder (optional)
searchstringFilter by title text (optional)
limitintegerMax results (1 to 100)
offsetintegerPagination 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

FieldTypeDescription
titlestringDocument title (required)
contentstringDocument content (optional)
content_typestringOne of markdown, plain, rich_text (optional, defaults to markdown)
project_idUUIDProject to attach the document to (optional)
parent_idUUIDFolder to place the document in (optional)
tagsstring[]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

StatusMeaning
201Document created; the full record is returned
400Validation error (missing/invalid field, a project_id/parent_id that does not reference an existing item, or content rejected by the safety policy)
401Authentication required
403Caller lacks the required permission to create documents
500Unexpected 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

ParameterTypeDescription
pageintegerPage 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

StatusMeaning
200The page of Trash entries is returned
400page is not a whole number from 1 to 10000
401Authentication required
403Caller is not an active member of the organization
500Unexpected 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

StatusMeaning
200File restored; the restored record is returned
400The ID is not a valid UUID
401Authentication required
402The organization has reached its document limit
403The organization has reached its storage limit or the caller cannot add files to the original location
404The file is unavailable, has expired, or has already been restored
500Unexpected server error

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.