Getting started

Ingest content and retrieve a cited answer from it.

Ingest something

curl https://api.uni-flow.ai/api/v1/memory/ingest \
  -H "x-api-key: $CHORDIAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "content": "Acme Corp expansion: EUR 240k, Security Review stage. Blocked on BAA approval.",
    "content_type": "text",
    "routing": { "mode": "auto" }
  }'
{
  "doc_id": "ing_9f2c8a1e",
  "vault_id": "v_sales",
  "routing_confidence": 0.91,
  "needs_review": false,
  "dlp_matches": 0
}

Three fields worth reading rather than ignoring:

  • vault_id — where the classifier filed it.
  • needs_review — true when confidence fell below 0.70; the content landed in v_unassigned and is easy to lose track of.
  • dlp_matches — how many sensitive values were masked before storage.

Search it

curl https://api.uni-flow.ai/api/v1/memory/search \
  -H "x-api-key: $CHORDIAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{"query": "What is blocking the Acme deal?"}'
{
  "answer": "The Acme Corp expansion is in Security Review and is blocked on BAA approval [1].",
  "citations": [
    { "index": 1, "title": "Acme Corp expansion", "document_id": "ing_9f2c8a1e" }
  ],
  "chunk_count": 1,
  "suggested_followups": ["What is the value of the Acme deal?"]
}

The [1] markers in answer map to the citations array. Render them as links. A claim with no marker is not grounded — that is the signal to be sceptical.

Stream it, for anything user-facing

const res = await fetch('https://api.uni-flow.ai/api/v1/memory/search/stream', {
  method: 'POST',
  headers: {
    'x-api-key': process.env.CHORDIAN_API_KEY!,
    'content-type': 'application/json',
  },
  body: JSON.stringify({ query: 'What is blocking the Acme deal?' }),
});

const reader = res.body!.pipeThrough(new TextDecoderStream()).getReader();
while (true) {
  const { value, done } = await reader.read();
  if (done) break;
  // sources arrive first, then tokens, then done
  process.stdout.write(value);
}

Sources arrive before the first token, so you can render the grounding while the answer is still being written.

Uploading a file

curl https://api.uni-flow.ai/api/v1/memory/uploads \
  -H "x-api-key: $CHORDIAN_API_KEY" \
  -F "file=@q4-report.pdf"

Returns immediately with status: "pending". Extraction, scanning, chunking, embedding and entity extraction continue in the background — poll the upload or subscribe to memory.ingest.completed.

Scanned PDFs and images go through OCR automatically; no separate call.

Try it interactively

Was this page helpful?
Report an issue

On this page