> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memcontext.in/llms.txt
> Use this file to discover all available pages before exploring further.

# API Reference

> Complete reference for the MemContext REST API.

## Base URL

```
https://api.memcontext.in
```

All endpoints are prefixed with `/api/`.

## Authentication

Every request must include an API key in the `X-API-Key` header:

```bash theme={null}
curl https://api.memcontext.in/api/memories \
  -H "X-API-Key: mc_your_key"
```

API keys are created from the [MemContext dashboard](https://app.memcontext.in). See [Authentication](/authentication) for details.

## Endpoints

| Method   | Path                                  | Description                                                                      |
| -------- | ------------------------------------- | -------------------------------------------------------------------------------- |
| `POST`   | `/api/memories`                       | [Save a memory](/api-reference/endpoint/save-a-memory)                           |
| `GET`    | `/api/memories`                       | [List memories](/api-reference/endpoint/list-memories)                           |
| `GET`    | `/api/memories/search`                | [Search memories](/api-reference/endpoint/search-memories)                       |
| `GET`    | `/api/memories/profile`               | [Get user profile context](/api-reference/endpoint/get-user-profile-context)     |
| `GET`    | `/api/memories/graph`                 | Memory graph data for visualization                                              |
| `GET`    | `/api/memories/{id}`                  | [Get a memory by ID](/api-reference/endpoint/get-a-memory-by-id)                 |
| `PATCH`  | `/api/memories/{id}`                  | [Update a memory](/api-reference/endpoint/update-a-memory)                       |
| `DELETE` | `/api/memories/{id}`                  | Delete a memory                                                                  |
| `POST`   | `/api/memories/{id}/forget`           | [Forget a memory](/api-reference/endpoint/forget-a-memory-soft-delete)           |
| `GET`    | `/api/memories/{id}/history`          | [Get memory version history](/api-reference/endpoint/get-memory-version-history) |
| `POST`   | `/api/memories/{id}/feedback`         | [Submit feedback](/api-reference/endpoint/submit-feedback-for-a-memory)          |
| `GET`    | `/api/workspaces`                     | List workspaces available to the authenticated user                              |
| `POST`   | `/api/workspaces`                     | Create a workspace                                                               |
| `GET`    | `/api/workspaces/{id}/team`           | List workspace members and pending invitations                                   |
| `POST`   | `/api/context-vault/documents`        | Queue Context Vault text, URL, or remote file ingestion                          |
| `POST`   | `/api/context-vault/documents/upload` | Upload and ingest a Context Vault file                                           |
| `GET`    | `/api/context-vault/documents`        | List Context Vault documents                                                     |
| `GET`    | `/api/context-vault/search`           | Search Context Vault documents and extracted memories                            |
| `GET`    | `/api/context-vault/memories`         | Browse extracted and curated workspace memories                                  |

## Response format

All successful responses return JSON. Error responses follow a consistent shape:

For `POST /api/memories`, shorter memories usually return `201` with a final save result, while larger notes may return `202 Accepted` with a `jobId` and message for tracking extraction into atomic memories.

```json theme={null}
{
  "error": "Human-readable error message",
  "code": "HTTP_404",
  "requestId": "abc123xyz456"
}
```

Every response includes an `X-Request-Id` header for tracing.

## Rate limits

Rate-limited endpoints return the following headers:

| Header                  | Description                               |
| ----------------------- | ----------------------------------------- |
| `X-RateLimit-Limit`     | Maximum requests in the current window.   |
| `X-RateLimit-Remaining` | Requests remaining in the current window. |
| `X-RateLimit-Reset`     | Unix timestamp when the window resets.    |

See [Authentication](/authentication#rate-limits) for per-endpoint limits.

## Request limits

* Maximum request body size: **50 KB**.
* Memory content maximum length: **10,000 characters**.
* Search query maximum length: **1,000 characters**.
