Skip to content

Reason HTTP API

reason.oka.so exposes the full Reason intelligence layer over HTTP. If you’re using an MCP-compatible client, prefer the MCP interface — it wraps these endpoints with fire-and-forget buffering and automatic retry.

Base URL

EnvironmentURL
Productionhttps://reason.oka.so
Devhttps://reason.dev.oka.so

Authentication

All endpoints except /health require a JWT token:

Terminal window
curl https://reason.oka.so/api/learnings/context/auth \
-H "Authorization: Bearer $OKA_API_KEY"

The token must include sub (user ID) and optionally account_id / org_id for multi-tenant scoping. All queries are automatically scoped to your account.

Key endpoints

Context (the flagship query)

Terminal window
# Get everything the organization knows about auth
curl "https://reason.oka.so/api/learnings/context/auth?limit=5&min_confidence=0.5" \
-H "Authorization: Bearer $OKA_API_KEY"

Returns ranked learnings with confidence scores, evidence counts, and matching strategy metadata. Uses hybrid search (semantic + lexical) with automatic fallback.

Ingest events

Terminal window
curl -X POST https://reason.oka.so/api/reasoning/ingest \
-H "Authorization: Bearer $OKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [{
"event_type": "decision",
"payload": {
"decision": "Using pgvector for semantic search",
"rationale": "Keeps the stack simple",
"alternatives": "Pinecone, Qdrant"
}
}]
}'

Browse learnings

Terminal window
# High-confidence architecture learnings
curl "https://reason.oka.so/api/reasoning/learnings?category=architecture&min_confidence=0.7&sort_by=confidence" \
-H "Authorization: Bearer $OKA_API_KEY"
Terminal window
curl "https://reason.oka.so/api/reasoning/search?q=webhook+delivery+failures&limit=5" \
-H "Authorization: Bearer $OKA_API_KEY"

Trigger consolidation

Terminal window
# Synchronous (blocks up to 120s)
curl -X POST https://reason.oka.so/api/reasoning/consolidate \
-H "Authorization: Bearer $OKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"max_events": 200}'
# Asynchronous (returns immediately with poll URL)
curl -X POST https://reason.oka.so/api/reasoning/consolidate/async \
-H "Authorization: Bearer $OKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'

Submit feedback

Terminal window
curl -X POST https://reason.oka.so/api/reasoning/feedback \
-H "Authorization: Bearer $OKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"learning_id": "uuid-here",
"useful": true,
"reason": "This was exactly the context I needed"
}'

Error responses

StatusMeaning
202Accepted (async ingest/consolidation)
400Invalid request body or parameters
401Missing or invalid JWT
402Plan limit exceeded for this meter (see Usage, plans & limits)
404Resource not found (or wrong account)
408Consolidation timed out (120s limit)
429Rate limit exceeded — check Retry-After header
503Embedding provider not configured (semantic search)

All errors return {"statusCode": N, "message": "..."}.

Rate limits

Default: 600 requests/minute per account. The 429 response includes Retry-After and X-RateLimit-Reset headers.

Full reference