Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/vectorize-io/hindsight/llms.txt

Use this file to discover all available pages before exploring further.

The retain endpoint ingests raw content into a memory bank and transforms it into structured, queryable memories. Hindsight runs LLM-based fact extraction on the content, resolves entities against the existing knowledge graph, and stores the resulting facts — not the original text. A single retain call can produce many memories depending on how much information the content contains.
To learn about fact extraction, entity resolution, and graph construction in depth, see the Retain Architecture guide.

Endpoint

POST /v1/{tenant}/banks/{bank_id}/retain

Request parameters

path.tenant
string
required
Your tenant identifier. Use default for single-tenant deployments.
path.bank_id
string
required
The memory bank to store content into. The bank is created automatically if it does not exist.
items
object[]
required
One or more content items to retain. Each item is a piece of raw content — a conversation, document, or note — that Hindsight will analyze and decompose into structured memories.
async
boolean
default:"false"
When true, the call returns immediately with an operation_id and processing runs in the background via the worker service. No usage metrics are returned for async operations. Recommended for large batches or when combined with the provider Batch API for 50% cost reduction.
document_tags
string[]
Tags applied to all items in this request batch (merged with per-item tags). Useful for tagging an entire batch with shared metadata such as a session ID.

Response fields

success
boolean
required
Whether the operation completed without errors.
bank_id
string
required
The memory bank that received the content.
items_count
integer
required
Number of items processed in this request.
async
boolean
required
Whether processing ran asynchronously.
operation_id
string
Present when async is true. Use this ID to poll GET /v1/{tenant}/banks/{bank_id}/operations/{operation_id} for completion status.
usage
object
Token usage for the LLM extraction calls. Only present for synchronous operations.

Examples

Basic retain

curl -X POST "https://your-hindsight-host/v1/default/banks/my-bank/retain" \
  -H "Authorization: Bearer $HINDSIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "content": "Alice joined the platform in January 2024 and prefers async communication over meetings.",
        "context": "onboarding",
        "metadata": {"source": "crm", "account_id": "acc_123"}
      }
    ]
  }'

Batch retain

Submit multiple items in a single request to reduce network overhead. Hindsight processes the batch and can optimize extraction across related content.
curl -X POST "https://your-hindsight-host/v1/default/banks/my-bank/retain" \
  -H "Authorization: Bearer $HINDSIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "content": "Alice prefers async communication.",
        "context": "slack",
        "tags": ["user:alice"]
      },
      {
        "content": "Bob joined the engineering team in Q1 2024.",
        "context": "hr-system",
        "tags": ["user:bob"]
      }
    ]
  }'

Async retain

For large batches, use async mode to avoid blocking your application.
curl -X POST "https://your-hindsight-host/v1/default/banks/my-bank/retain" \
  -H "Authorization: Bearer $HINDSIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [{"content": "...large batch of content..."}],
    "async": true
  }'
Enable provider Batch API support for 50% cost reduction on async retain by setting HINDSIGHT_API_RETAIN_BATCH_ENABLED=true. OpenAI and Groq both offer this discount in exchange for a processing window of up to 24 hours.

Error codes

StatusCodeDescription
400invalid_requestMalformed request body or missing required fields.
401unauthorizedMissing or invalid API key.
404bank_not_foundThe specified bank does not exist and could not be created.
422validation_errorOne or more item fields failed validation.
429rate_limitedToo many requests. Retry with exponential backoff.
500internal_errorServer error during processing.
See the Retain Architecture guide for a deep dive into how Hindsight extracts facts, resolves entities, and builds the knowledge graph.

Build docs developers (and LLMs) love