Variables API
Fast key-value store for LLM state — counters, flags, last-seen timestamps, partial progress.
Variables API
The Variables API is a fast key-value store for ephemeral state. Unlike memories (which are indexed, searchable, and structured), variables are optimized for quick read/write access — perfect for counters, flags, and session state.
Endpoints
POST /var
Set or update a variable.
curl -X POST https://synapse.schaefer.zone/var \
-H "Authorization: Bearer YOUR_MIND_KEY" \
-H "Content-Type: application/json" \
-d '{"key": "last_session_at", "value": "2026-06-27T14:00:00Z"}'GET /var/:key
Get a single variable.
curl -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/var/last_session_atResponse:
{ "key": "last_session_at", "value": "2026-06-27T14:00:00Z", "updated_at": "..." }GET /var
List variable names + metadata. Values are redacted (ex RUN-461,
task 7103c3c1: the listing once returned every value in cleartext —
including shared account tokens/PATs). Fetch a value individually via
GET /var/:key (typed secret vars are human-only: Mind-Key auth gets
403, use the resolver pattern for functional access).
curl -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/varResponse (v1.65.0+):
{ "variables": { "last_session_at": { "scope": "mind", "type": "string", "has_secret": false, "updated_at": 1790000000 } }, "count": 1, "scopes": { "last_session_at": "mind" }, "redacted": true }DELETE /var/:key
Delete a variable.
curl -X DELETE -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/var/last_session_atWhen to Use Variables vs Memory
| Use Case | Use |
|---|---|
| User name, preferences | Memory (searchable, structured) |
| Last session timestamp | Variable (ephemeral state) |
| Counter (e.g. messages sent) | Variable (frequent updates) |
| Workflow state ("step 3 of 5 done") | Variable (transient) |
| Long-form project notes | Memory (full-text indexed) |
| Reusable scripts | Script store (named, versioned) |
Common Patterns
Track last session
# At session end
curl -X POST .../var -d '{"key": "last_session_at", "value": "'$(date -Iseconds)'"}'
# At session start
LAST=$(curl .../var/last_session_at | jq -r .value)
curl .../memory/diff?since=$(date -d "$LAST" +%s)Counter pattern
# Increment
N=$(curl .../var/api_calls | jq -r .value)
curl -X POST .../var -d "{\"key\": \"api_calls\", \"value\": $((N+1))}"Feature flags
curl -X POST .../var -d '{"key": "feature_x_enabled", "value": "true"}'
# Check
ENABLED=$(curl .../var/feature_x_enabled | jq -r .value)
if [ "$ENABLED" = "true" ]; then ... fiNext Steps
- Memory API — for structured, searchable data
- Cron & Scheduler