Documents

Read the documents a library has written.

Documents are the step-by-step records a library writes from recorded work. These endpoints list a library's documents, read one in full, walk the edges between documents and show the recordings a document was written from. List responses are paginated; the API overview covers paging. Every request needs your API key as a bearer token; see Authentication.

List a library's documents

GET /libraries/{id}/documents

Returns a paginated list of one library's documents. {id} is the library, as a lib_... ID or slug. To rank documents across every library at once, use search instead.

ParameterTypeWhat it does
categorystringKeep only this category.
tagstringKeep only this tag.
applicationstringKeep only documents that use this application.
searchstringSubstring match on title and content.

The filter values come from the library's label endpoints.

Get a document

GET /documents/{id}

Returns one document in full: its labels, its content, the schema that shapes it, its library and every edge in and out. {id} must be a doc_... ID; document slugs are only unique within a library, so they do not resolve here.

content is keyed by the sections of the library's template and schema describes that template, so you can render any document in the library the same way.

JSON
{
  "id": "doc_...",
  "title": "Refund an order",
  "category": "Billing",
  "tags": ["stripe", "refunds"],
  "applications": ["Stripe", "Gmail"],
  "recordingCount": 12,
  "deviceCount": 4,
  "firstSeen": "2026-05-11T10:03:00Z",
  "lastSeen": "2026-07-28T09:41:00Z",
  "createdAt": "2026-05-11T10:20:00Z",
  "updatedAt": "2026-07-28T09:55:00Z",
  "content": { ... },
  "schema": { ... },
  "library": { "id": "lib_...", "name": "Support" },
  "edges": {
    "outgoing": [...],
    "incoming": [...]
  }
}

Traverse from a document

GET /documents/{id}/traverse

Walks the graph outward from one document, breadth first, following edges for up to depth hops and collecting every document and edge it reaches. Use it to answer questions like "what usually comes after this?" without fetching the whole library graph.

ParameterTypeWhat it does
directionstringoutgoing, incoming or both. Default both.
labelstringFollow only edges with this label.
depthintegerHops to walk, 1 to 3. Default 1.

The response returns the root document id, the maxDepth walked and the nodes and edges reached.

Read source recordings

GET /documents/{id}/source-recordings

Returns the recordings a document was written from: each with its question-and-answer pairs and its step timeline as plain strings. Only recordings shared with the workspace appear here, and pages are capped at 50 results.

JSON
{
  "sourceRecordings": [
    {
      "id": "rec_...",
      "title": "Refund a payment in Stripe",
      "status": "...",
      "clientCreatedAt": "2026-07-14T11:26:00Z",
      "questions": [
        {
          "id": "ques_...",
          "question": "Why did the customer get a refund?",
          "response": "They were charged twice",
          "sequenceOrder": 1
        }
      ],
      "steps": ["...", "..."]
    },
    ...
  ],
  "total": 12,
  "page": 1,
  "pageSize": 20
}