canonical: https://jentic.com/apis/memara.io/memara

# Memara API

The Memara API is an external memory system designed for AI agents and multi-step workflows. It exposes Memory Spaces - scoped containers for facts, documents, and conversation history - together with semantic search, access controls, sharing, and analytics across 171 endpoints. Agents can write memories, retrieve relevant context for a new turn, share spaces with collaborators, and audit usage, which makes Memara a drop-in long-term memory layer for LLM applications that need to outlive a single context window.

## For AI agents

Read and write long-term memory for AI agents - store facts, documents, and turns in scoped Memory Spaces and retrieve relevant context via semantic search. Bearer-authenticated.

## Scope

Does not host LLM inference, generate embeddings on demand, or replace a relational database - use for AI agent long-term memory storage and retrieval only.

## Capabilities

- Create and scope Memory Spaces so each agent or user has isolated long-term memory
- Store memories with content, metadata, and tags via the /memories endpoint, then retrieve them by semantic similarity
- Share a Memory Space with another user or grant scoped access for collaborative agent workflows
- Track Memory Space analytics including memory count, storage usage, and query patterns
- Authenticate via socket-based or HTTP bearer tokens for both server and edge agent runtimes
- Enforce content limits and quotas on a per-space basis to control cost as agents accumulate state

## Use cases

### Long-Term Memory for Conversational Agents

Customer-facing chat agents need to remember user preferences, history, and prior decisions across sessions. Memara's /memories endpoints let an agent write each significant turn into a Memory Space and retrieve the top-k semantically relevant memories at the start of every new conversation, replacing brittle vector-DB plumbing with a managed memory service.

Example prompt: Create a Memory Space for user_id=u_123, write the fact 'prefers vegetarian recipes' on each confirmation, then on the next session retrieve the top 5 memories matching the user's new query before composing a response.

### Multi-Agent Knowledge Sharing

When several agents collaborate on a task - say, a research agent and a drafting agent - they need a shared scratchpad. Memara's space-sharing endpoints let one agent grant another scoped access to the same Memory Space so findings flow forward without serialising the whole context window into prompts.

Example prompt: Create a Memory Space owned by the research agent, share it with the drafting agent via `/spaces/{space_id}/share`, then have the drafting agent query the space for citations during writing.

### Workflow State Persistence

Long-running agent workflows - onboarding flows, multi-step research, scheduled reviews - need state that survives crashes and context-window resets. Storing intermediate results in a Memory Space gives the workflow a durable resume point, and Memara's analytics endpoints let operators see how much state is accumulating per run.

Example prompt: After each step in the workflow, write a memory tagged 'step:{n}' with the step result; on workflow resume, list memories tagged 'step:*' to reconstruct progress.

### AI Agent Memory via Jentic

An agent built with Jentic can use Memara as its memory backend without writing direct HTTP calls. The agent searches Jentic for memory operations, loads the schema for /memories or /spaces, and persists or recalls state through normal tool calls - letting the framework handle bearer-token rotation and request shaping.

Example prompt: Search Jentic for 'store agent memory', load POST /memories, execute with the user-provided fact and a Memory Space ID, then on the next turn search 'recall agent memory' and run a top-k query.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/auth/me` | Get the authenticated user/agent identity |
| GET | `/spaces` | List Memory Spaces accessible to the caller |
| POST | `/spaces` | Create a new Memory Space |
| GET | `/spaces/{space_id}` | Get a single Memory Space |
| POST | `/spaces/{space_id}/share` | Share a Memory Space with another user |
| GET | `/spaces/{space_id}/analytics` | Get usage analytics for a Memory Space |
| POST | `/memories` | Write a new memory |
| GET | `/memories/content-limits` | Retrieve content limits and quotas |

## Key resources

- **Memory Spaces** — Scoped containers for memories with access control, sharing, and analytics.
- **Memories** — Individual stored items - facts, document chunks, turns - with content, metadata, and semantic retrieval.
- **Auth** — Token introspection and session endpoints for HTTP bearer and socket-based auth.
- **Sharing** — Endpoints to grant another user or agent scoped access to a Memory Space.
- **Analytics** — Per-space usage metrics - memory count, storage, query rate.

## Why Jentic

- **Setup:** Wiring Memara by hand means sending its HTTP bearer token and hand-coding each space and memory call against api.memara.io across a large operation surface. Through Jentic you install once, import the Memara API from the API Directory, store the token once, and your agent calls it.
- **Permission scoping:** Memara puts the space id in the URL path (`/spaces/{space_id}/...`), so a rule can pin your agent to one space: it can store and recall memories there and nothing else. You choose the operations it may call, so sharing a space or reading its analytics is included only if you add it.
- **Credential handling:** Your Memara bearer token is stored once, encrypted, by your own Jentic One instance and injected on each /memories or /spaces call at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'store agent memory' or 'recall context for a user', and Jentic returns POST /memories or the matching search operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **OpenAI API** — LLM that consumes memories Memara stores and retrieves
- **Cohere** — Embeddings and rerank that pair with external memory stores
- **Hugging Face** — Self-hosted models and datasets; not a managed memory service

## FAQ

### What authentication does the Memara API use?

The API uses HTTP bearer authentication declared as the HTTPBearer security scheme. Through Jentic, the bearer token is stored in the encrypted vault and injected on each request, so the raw token never enters agent context.

### Can I share a Memory Space between two agents with the Memara API?

Yes. POST `/spaces/{space_id}/share` grants another user or agent scoped access to a Memory Space, which is the supported pattern for multi-agent workflows that need a shared scratchpad.

### What are the rate limits for the Memara API?

The OpenAPI spec does not declare numeric rate limits, but per-space content limits are exposed via `/memories/content-limits` - query that endpoint to retrieve the current cap on memory size and total stored memories before designing high-volume writes.

### How do I store and retrieve agent memory through Jentic?

Run `pip install jentic`, search for `store agent memory` and `recall agent memory`, then execute POST /memories to write and the search endpoint to retrieve. Jentic handles bearer-token injection and schema validation automatically.

### Does the Memara API support semantic search over stored memories?

Yes. Memories are indexed for semantic retrieval so an agent can pass a natural-language query and receive the most relevant items in the Memory Space, rather than relying on exact-match metadata filters.

### Can I see how much memory an agent has accumulated in the Memara API?

Yes. `/spaces/{space_id}/analytics` returns memory count, storage usage, and query statistics for a space, which lets operators monitor cost and prune stale state.

### Can I limit what my agent is allowed to do with the Memara API?

Yes. Because you run Jentic One yourself, your own rules decide which Memara operations and credentials the agent may use, and Memara puts the space id in the URL path (`/spaces/{space_id}/...`), so a rule can pin the agent to a single Memory Space. You can allow it to only write and recall memories in that space while withholding operations like sharing a space via POST `/spaces/{space_id}/share` or reading `/spaces/{space_id}/analytics.` The bearer token stays with your instance and is injected at execution time, so the agent calls only the endpoints you permit.
