---
title: Quickstart
description: Get an API key, send your first memory, and recall it — under five minutes.
order: 1
---

# Quickstart

Memoria gives your AI agent a memory that survives across sessions. This page walks through getting from zero to your first stored fact and your first recall in under five minutes.

## 1. Create an account

Go to [memoria.premex.se](https://memoria.premex.se) and sign in with email or Google. A default *brain* is created for you automatically — think of a brain as an isolated workspace; everything you store is scoped to it.

## 2. Get an API key

In the dashboard, open **Brains → default → Keys** and create a new key labelled e.g. `local-dev`. The full secret is shown **once** — copy it now. Keys look like:

```
mem_live_4f9c…ab21
```

Treat it like a password: never check it into git, rotate if leaked.

## 3. Install the SDK (optional)

```bash
npm install @premex/memoria
# or
pnpm add @premex/memoria
```

You can also call the REST API directly with `curl` — see [REST API](/docs/rest-api).

## 4. Store your first memory

```typescript
import { MemoriaClient } from '@premex/memoria';

const memoria = new MemoriaClient({ apiKey: process.env.MEMORIA_API_KEY! });

await memoria.remember({
  content: 'Stefan is a Senior Engineer at Premex. He joined in 2023.',
});
```

What happens server-side:

1. Memoria extracts entities (`Stefan`, `Premex`) and a fact (`Stefan worksAt Premex`).
2. Each entity is resolved against existing ones in your brain via name embeddings.
3. The fact gets two timestamps — when it became true in the world (`tValid`) and when Memoria learned it (`tIngested`).
4. Contradictions are checked. If you later say "Stefan left Premex in 2025", the older fact is marked superseded — but not deleted.

The whole pipeline is one HTTP call. The response returns immediately once the episode is persisted; extraction completes in the background.

## 5. Recall it

```typescript
const result = await memoria.recall({
  query: 'Where does Stefan work?',
});

console.log(result.context);
// → "Stefan is a Senior Engineer at Premex…"
```

Recall fans out three signals in parallel:

- **Dense** vector similarity over learned embeddings
- **Sparse** BM25 keyword search
- **Graph** Personalized PageRank seeded from entities in the query

Results are fused by reciprocal-rank fusion, re-ranked by a cross-encoder, and packed into a context string ready to drop into your agent's prompt. Sub-second p50.

## 6. Time-travel

Every fact carries event time. Ask the world as it was on a specific date:

```typescript
await memoria.recall({
  query: 'Where does Stefan work?',
  asOf: '2024-06-01',
});
```

## Next steps

- [Brains](/docs/brains) — workspaces and isolation
- [Recall](/docs/recall) — the retrieval pipeline in detail
- [MCP server](/docs/mcp) — connect Memoria from Claude Code
- [CLI](/docs/cli) — one-line setup for Claude Code, including Claude Code on the web
- [REST API](/docs/rest-api) — all endpoints and shapes
