Search & Retrieval

Find memories using semantic search or navigate the keypath hierarchy for structured retrieval.

POST/memories/search
POST/keypaths
GET/status

Get by Keypath (Recursive)

POST/keypaths

Retrieve memories at a keypath with optional recursive expansion and time-travel. Returns a map of keypath to summary for efficient context loading.

Request Body

ParameterTypeRequiredDescription
project_idstringRequiredProject to query.
keypathstringRequiredRoot keypath to retrieve.
recursivebooleanDefault: falseInclude all child keypaths.
at_revisionintegerOptionalTime-travel: get state at a specific revision number.
Request (Recursive)
curl -X POST https://api.memstate.ai/api/v1/keypaths \
  -H "Content-Type: application/json" \
  -H "X-API-Key: mst_your_key" \
  -d '{
    "project_id": "my-saas",
    "keypath": "auth",
    "recursive": true
  }'
200 OK
{
  "memories": {
    "auth": "Authentication system overview with multi-provider support",
    "auth.provider": "OAuth2 with Google and GitHub providers",
    "auth.registration": "User registration with email verification",
    "auth.session": "JWT sessions with 15-minute access + 7-day refresh tokens"
  },
  "total_count": 4,
  "revision_number": 23
}

Time-Travel Queries

Use at_revision to retrieve the memory state at any point in history. This is useful for understanding how your project's knowledge evolved.

Request (Time-Travel)
curl -X POST https://api.memstate.ai/api/v1/keypaths \
  -H "Content-Type: application/json" \
  -H "X-API-Key: mst_your_key" \
  -d '{
    "project_id": "my-saas",
    "keypath": "auth",
    "recursive": true,
    "at_revision": 10
  }'

What are revisions?

Each ingestion creates a new revision number. You can list all revisions with the GET /projects/{id}/revisions endpoint to find the revision you want to query.

System Status

GET/status

Get the current system status including memory count, project count, and available features.

Request
curl https://api.memstate.ai/api/v1/status \
  -H "X-API-Key: mst_your_key"
200 OK
{
  "status": "ok",
  "memory_count": 156,
  "project_count": 4,
  "storage_backend": "postgres",
  "features": {
    "conflict_detection": true,
    "llm_processing": true
  }
}