Browse docs

API

Tap to expand

Contribute

APIUpdated 2026-03-18

Context Query, Share, and Resume

Use context query for project knowledge retrieval, then share or resume context when the workflow needs continuity across runs.

Applies to: Context API v1

Use POST /v1/context/query when you want ranked project context back from sources, documents, code, or previously indexed knowledge.

Use context sharing and resume when a workflow needs to hand that context to another run, agent, or teammate without rebuilding it from scratch.

What each route is for

  • POST /v1/context/query: retrieve relevant project context
  • POST /v1/context/share: package a context snapshot for reuse
  • POST /v1/context/resume: restore a previously shared context snapshot

Minimal query request

json
{
  "project": "retaindb-quickstart",
  "query": "What should I know about project setup?",
  "top_k": 5
}

Try it

bash
curl -X POST "https://api.retaindb.com/v1/context/query" \
  -H "Authorization: Bearer $RETAINDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project": "retaindb-quickstart",
    "query": "What should I know about project setup?",
    "top_k": 5
  }'

What to look for in the response

A good response gives you:

  • clearly relevant chunks or results
  • enough metadata to understand where the result came from
  • latency information you can log or inspect

When to use share and resume

Use share and resume when the problem is not retrieval quality but workflow continuity.

Examples:

  • handing an investigation to another agent run
  • saving a strong retrieval snapshot for review
  • preserving a context pack across long-running work

Security notes

Treat shared context as portable knowledge. The same scoping and access rules that matter during query still matter after sharing.

Next step

Continue with projects and sources if you still need to ingest more knowledge, or semantic search and file search if you want to compare retrieval styles.

Was this page helpful?

Your feedback helps us prioritize docs improvements weekly.