Quickstart

Create a brain, capture something, and read it back.

By the end of this page you’ll have a brain holding one compiled page, read back through the SDK. It takes about five minutes.

1

Get an API key

API keys are scoped to an organization and carry the role of the member they were issued to. Ask an owner, admin, or developer on your org to issue one from the dashboard — keys look like lbk_....

You also need a subject id: a stable identifier for the end user you’re acting on behalf of. Brains are owned by subjects, so this determines which brains you can see. See Authentication.

2

Install an SDK

$npm install @livingbrain/sdk
3

Create a brain

1import { LivingBrainClient } from "@livingbrain/sdk";
2
3const client = new LivingBrainClient({
4 apiKey: process.env.LIVING_BRAIN_API_KEY!,
5 subjectId: "user_123",
6});
7
8const brain = await client.brains.create({
9 name: "Research",
10 description: "Papers and notes",
11});
12
13console.log(brain.id);
4

Push a capture

Captures are asynchronous. You get back an ingest source whose status tells you where it is in the pipeline; Living Brain compiles it into one or more pages in the background.

1const source = await client.captures.capture({
2 brainId: brain.id,
3 body: {
4 kind: "url",
5 fetchUrl: "https://arxiv.org/abs/1706.03762",
6 label: "Attention Is All You Need",
7 },
8});
9
10console.log(source.status); // "pending"

Rather than polling, register a webhook and let Living Brain tell you when compilation finishes.

5

Read the pages back

Once compilation completes, the brain has pages. List them — the SDKs paginate for you:

1for await (const page of await client.workspace.listPages({ brainId: brain.id })) {
2 console.log(page.title, "", page.summary);
3}

Next steps