LLMtxt
API Reference

API Reference

REST API at api.llmtxt.my for document management, progressive disclosure, and collaboration

LLMtxt API Reference

Base URL: https://api.llmtxt.my

Quick Start

# Store a document
curl -X POST https://api.llmtxt.my/compress \
  -H "Content-Type: application/json" \
  -d '{"content": "Hello, world!"}'

# Get overview (token-efficient)
curl https://api.llmtxt.my/documents/SLUG/overview

# Get raw content
curl https://api.llmtxt.my/documents/SLUG/raw

Document Management

MethodEndpointDescription
POST/compressCreate and store a document
GET/documents/:slugGet document metadata
POST/decompressRetrieve full document content
POST/validateValidate content without storing
POST/searchSearch across multiple documents

Progressive Disclosure

MethodEndpointDescription
GET/documents/:slug/overviewDocument structure and sections
GET/documents/:slug/sectionsList all sections
GET/documents/:slug/sections/:nameGet specific section
GET/documents/:slug/tocTable of contents
GET/documents/:slug/lines?start=N&end=MLine range extraction
GET/documents/:slug/search?q=querySearch within document
GET/documents/:slug/query?path=$.keyJSONPath query
GET/documents/:slug/rawRaw plaintext content
POST/documents/:slug/batchBatch section query

Versioning

MethodEndpointDescription
PUT/documents/:slugUpdate document (creates version)
GET/documents/:slug/versionsList all versions
GET/documents/:slug/versions/:numGet specific version
GET/documents/:slug/diff?from=N&to=MDiff between versions
POST/documents/:slug/patchApply unified diff patch

Lifecycle and Consensus

MethodEndpointAuthDescription
POST/documents/:slug/transitionOwnerChange document state
POST/documents/:slug/approveRegisteredApprove document
POST/documents/:slug/rejectRegisteredReject with reason
GET/documents/:slug/approvalsNoneList approval votes
GET/documents/:slug/contributorsNoneAttribution summary

Document States

DRAFT -> REVIEW -> LOCKED -> ARCHIVED
  |                  ^
  +------------------+  (skip review)

Only DRAFT and REVIEW documents accept patches. ARCHIVED is terminal.

Analysis

MethodEndpointDescription
GET/documents/:slug/similar?q=queryFind similar sections
GET/documents/:slug/graphExtract mentions, tags, directives
POST/documents/:slug/plan-retrievalToken-budget-aware retrieval

Authentication

MethodEndpointDescription
POST/auth/sign-up/emailRegister with email and password
POST/auth/sign-in/emailSign in
POST/auth/sign-in/anonymousCreate anonymous session (24h)
GET/auth/get-sessionGet current session
POST/auth/sign-outSign out

Signed URLs

MethodEndpointAuthDescription
POST/signed-urlsOwnerGenerate time-limited access token

Token Savings Headers

All progressive disclosure endpoints return:

  • X-Token-Count - tokens in the returned content
  • X-Total-Tokens - tokens in the full document
  • X-Tokens-Saved - tokens you did NOT need to read

Error Responses

All errors return JSON with error and optionally message and details fields.

Status codes: 200, 201, 400, 401, 403, 404, 500

On this page