Call /v1/experience and /v1/recall from n8n workflows via HTTP nodes.
n8n Integration
n8n's HTTP Request node speaks JSON. Use it to push experiences into CortexDB and to recall context for downstream LLM nodes.
Setup
Store these as n8n Credentials so they're not hard-coded in the workflow:
| Name | Value |
|---|---|
CORTEX_API_URL | https://api-v1.cortexdb.ai |
CORTEX_TOKEN | PASETO bearer token for the workflow actor |
CORTEX_ACTOR | e.g. service:n8n-flow |
CORTEX_SCOPE | e.g. org:acme/source:n8n |
Capture node — POST /v1/experience
Method: POST
URL: {{ $env.CORTEX_API_URL }}/v1/experience
Headers:
Authorization: Bearer {{ $credentials.CORTEX_TOKEN }}
X-Cortex-Actor: {{ $env.CORTEX_ACTOR }}
Content-Type: application/json
Body (JSON):
{
"scope": "{{ $env.CORTEX_SCOPE }}",
"modality": "conversation",
"content": { "kind": "text", "text": "{{ $json.message }}" },
"context": { "observed_at": "{{ $now.toISOString() }}" },
"idempotency_key": "{{ $execution.id }}"
}
The n8n execution ID is a perfect idempotency key — replays of the same execution write once.
Recall node — POST /v1/recall
URL: {{ $env.CORTEX_API_URL }}/v1/recall
Body: { "scope": "{{ $env.CORTEX_SCOPE }}", "view": "holistic",
"query": "{{ $json.question }}",
"include": ["beliefs", "facts", "episodes"],
"budgets": { "max_tokens": 3000 } }
Wire the returned context_block into a downstream OpenAI / Anthropic node's system prompt.