Skip to content

Session Model

POST /api/demo/token creates an anonymous token. That token owns one demo session and one temporary MRHI index.

The session response includes:

  • sessionId
  • createdAt
  • updatedAt
  • lastAccessedAt
  • expiresAt
  • ttlMsRemaining
  • initialized
  • vectorCount
  • maxVectors
  • config.dimensions
  • config.metric
  • config.vectorType
  • config.backend

When a session is new:

  • initialized is false
  • dimensions is null
  • metric is null

The first successful add or add-many call initializes the session.

  • Dimensions must be greater than 0
  • Dimensions cannot exceed 1024
  • All vectors in one add request must use the same length
  • All query vectors in one search-many request must use the same length
  • After initialization, future adds and searches must match the session dimension

If you want to switch dimensions while keeping the same token:

Terminal window
curl https://mrhisearch.com/api/demo/index/reset \
-X POST \
-H 'authorization: Bearer mrhi_demo__YOUR_TOKEN'

Supported metrics:

  • cosine
  • l2

Once a session is initialized, the metric is locked for that session. To switch metrics, reset the index and add vectors again.

POST /vectors/clear

  • removes all vectors
  • keeps the same session
  • keeps the configured dimensions + metric

POST /index/reset

  • deletes the whole index
  • resets dimensions + metric
  • lets the token start fresh

Sessions expire after the configured inactivity TTL. When a session expires:

  • the token becomes invalid
  • the stored index is deleted
  • the caller must request a new token

The exact deployed TTL is exposed by GET /api/demo/limits.