BrainAPI
BrainAPI
Retrieve

For the complete BrainAPI documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL. Docs MCP: /docs/mcp.

As-of retrieve

Read the knowledge state valid at an instant, with fail-closed undated facts and changelog windows

Retrieve and search accept as_of as an ISO-8601 datetime. When it is set, BrainAPI returns the knowledge state valid at that instant.

Undated facts are omitted (fail closed) and counted in validity_unknown_count. Set include_validity_unknown=true to return those facts separately in validity_unknown. They are still excluded from the primary result.

curl --fail-with-body -X POST http://localhost:8000/retrieve/context \
  -H "BrainPAT: $BRAINPAT_TOKEN" \
  -H "X-Brain-ID: $BRAIN_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "What was the on-call policy on 1 March 2024?",
    "as_of": "2024-03-01T00:00:00Z",
    "include_validity_unknown": false
  }'

GET /retrieve/ and GET|POST /retrieve/search take the same as_of and include_validity_unknown fields (query string on GET, JSON body on POST).

FieldDefaultMeaning
as_ofunsetInstant for validity filtering. Omit for current state.
include_validity_unknownfalseWhen as_of is set, include undated facts in validity_unknown only.
validity_unknown_countresponseCount of facts omitted because they have no valid-time start.
validity_unknownresponsePayload of those facts when include_validity_unknown=true.

Invalid as_of values fail the request. Compact stamps such as 2024-01-01T930 can parse instead of being rejected; prefer a full ISO-8601 datetime with offset. See Known issues.

Changelogs

MethodPathEffect
GET/retrieve/changelogsPage changelog entries. since is inclusive; until is exclusive. Combined, they return added, superseded, and invalidated facts in that window.
GET/retrieve/changelogs/{id}Read one entry.
GET/retrieve/changelogs/typesDistinct changelog types.
curl --fail-with-body "http://localhost:8000/retrieve/changelogs?since=2024-03-01T00:00:00Z&until=2024-03-02T00:00:00Z" \
  -H "BrainPAT: $BRAINPAT_TOKEN" \
  -H "X-Brain-ID: $BRAIN_ID"

Types include relationship_created, relationship_deprecated, node_properties_updated, and relationship_properties_updated. Window filters run in the graph query. Neo4j creates per-type range indexes on seven validity timestamp properties. Index setup is cached per database (TTL 60 seconds) and retried after writes that add relationship types; failed types back off from 30 seconds to 10 minutes.

MCP

list_changelogs accepts query_text, types, since, and until. get_changelog reads one entry by id. Product MCP as-of retrieve is search_semantically only (as_of, include_validity_unknown). search_memory and traverse_graph do not take those fields.

Edit on GitHub

Last updated on

On this page