Context API

Push and pull recipes

These snippets show the basic push, poll, and pull flow for Context API. Replace the placeholders with a workspace-scoped Context API key (sk_ctx_…), your workspace id, and the API base URL for your environment.

Push — single ingest

Body fields must match the published ingest schema. Use async ingest for larger payloads and poll the returned job until processing is complete.

curl -sS -X POST "https://api.neither.online/api/ingest" \
  -H "Authorization: Bearer <CONTEXT_API_KEY>" \
  -H "Content-Type: application/json" \
  -d "{\"workspace_id\":\"<WORKSPACE_ID>\",\"source_id\":\"track4-manual-1\",\"content_type\":\"generic_snippet\",\"text\":\"Hello\",\"title\":\"T\"}"

Poll ingest job

Use the job_id from the ingest response.

curl -sS "https://api.neither.online/api/ingest/jobs/<JOB_ID>" \
  -H "Authorization: Bearer <CONTEXT_API_KEY>"

Pull — list projects

Example read on GET /api/context/projects. Optional BC query parameters are in OpenAPI.

curl -sS "https://api.neither.online/api/context/projects" \
  -H "Authorization: Bearer <CONTEXT_API_KEY>"

TypeScript (fetch)

const baseUrl = process.env.API_BASE ?? "https://api.neither.online";
const apiKey = process.env.CONTEXT_API_KEY;
if (!apiKey) throw new Error("Set CONTEXT_API_KEY");

const res = await fetch(`${baseUrl}/api/context/projects`, {
  headers: { Authorization: `Bearer ${apiKey}` },
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = (await res.json()) as { projects?: unknown[] };
console.log(data.projects?.length ?? 0, "projects");

API overview · Hosted OpenAPI