API Documentation
Build powerful integrations with the AI Memory System REST API. Store, search, and retrieve memories with semantic understanding.
http://aimemory.com.br/api
📖 Overview
The AI Memory System API allows you to programmatically manage projects, memories, sessions, tasks, and code snippets. All endpoints return JSON responses and accept JSON request bodies where applicable.
Token Authentication
Secure API access with token-based authentication for all requests.
Semantic Search
Find memories by meaning, not just keywords, using vector embeddings.
Multi-Tenant
Data isolation per tenant with role-based access control.
RESTful Design
Standard REST conventions with consistent JSON responses.
🔑 Authentication
All API requests require authentication using a token. Include your token in the Authorization header of each request.
🔒 Authorization Header
Include this header in all API requests:
Authorization: Token YOUR_API_TOKEN
| Field | Type | Required | Description |
|---|---|---|---|
| username | string | Required | Your username |
| password | string | Required | Your password |
curl -X POST http://aimemory.com.br/api/auth/login/ \
-H "Content-Type: application/json" \
-d '{
"username": "your_username",
"password": "your_password"
}'
{
"token": "abc123def456...",
"user_id": 1,
"username": "your_username",
"email": "user@example.com",
"tenant": {
"id": "uuid-here",
"name": "Your Tenant",
"slug": "your-tenant",
"plan": "premium"
}
}
🚀 Quick Start
Get started in 3 steps
Get your API token
Login via the API or get your token from the admin panel.
Create a project
Projects organize your memories, sessions, and tasks.
Start storing memories
Store facts, decisions, learnings, and more.
curl -X POST http://aimemory.com.br/api/memories/ \
-H "Authorization: Token YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"project": "your-project-slug",
"memory_type": "decision",
"content": "We chose PostgreSQL for better JSON support",
"importance": 8,
"tags": ["database", "architecture"]
}'
📁 Projects
Projects are containers for organizing memories, sessions, tasks, and code snippets. Each project has a unique slug for easy reference.
| Parameter | Type | Required | Description |
|---|---|---|---|
| search | string | Optional | Search by project name |
[
{
"id": "uuid",
"name": "My Project",
"slug": "my-project",
"description": "Project description",
"stack": "Django, React, PostgreSQL",
"is_active": true,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
]
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Project name |
| slug | string | Optional | URL-friendly identifier (auto-generated if not provided) |
| description | string | Optional | Project description |
| stack | string | Optional | Technology stack |
curl -X POST http://aimemory.com.br/api/projects/ \
-H "Authorization: Token YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My New Project",
"description": "A cool project",
"stack": "Python, Django, React"
}'
| Parameter | Type | Description |
|---|---|---|
| id | uuid | Project ID |
Returns a comprehensive Markdown document with project memories, sessions, tasks, and more. Perfect for pasting into AI chat conversations.
🧠 Memories
Memories are the core data type. Store facts, decisions, learnings, errors, solutions, and code notes. Each memory has an importance level (1-10) and can be tagged for organization.
Memory Types
fact - Information or factual data
decision - Decisions made during development
learning - Lessons learned
error - Errors encountered and solutions
solution - Implemented solutions
code - Code-related notes
| Parameter | Type | Required | Description |
|---|---|---|---|
| project | string | Optional | Filter by project ID or slug |
| memory_type | string | Optional | Filter by type (fact, decision, learning, error, solution, code) |
| search | string | Optional | Full-text search in content |
| importance__gte | integer | Optional | Minimum importance level (1-10) |
[
{
"id": "uuid",
"project": "uuid",
"memory_type": "decision",
"content": "We chose PostgreSQL for better JSON support",
"context": "Database selection meeting",
"importance": 8,
"tags": ["database", "architecture"],
"access_count": 5,
"last_accessed": "2024-01-15T10:30:00Z",
"created_at": "2024-01-01T00:00:00Z"
}
]
| Field | Type | Required | Description |
|---|---|---|---|
| project | uuid/string | Required | Project ID or slug |
| memory_type | string | Required | Type of memory |
| content | string | Required | Memory content |
| context | string | Optional | Additional context |
| importance | integer | Optional | Importance level 1-10 (default: 5) |
| tags | array | Optional | Array of tag strings |
curl -X POST http://aimemory.com.br/api/memories/ \
-H "Authorization: Token YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"project": "my-project",
"memory_type": "decision",
"content": "We chose PostgreSQL for better JSON support",
"context": "Database selection meeting",
"importance": 8,
"tags": ["database", "architecture"]
}'
Search memories using semantic understanding. Finds related memories even if they don't contain exact keywords.
| Parameter | Type | Required | Description |
|---|---|---|---|
| q | string | Required | Search query |
| project | string | Optional | Filter by project |
| limit | integer | Optional | Max results (default: 10) |
Update any field of an existing memory. Only include fields you want to change.
Soft-deletes the memory. Can be restored via admin panel.
📅 Sessions
Sessions track your work periods with AI. Record what you accomplished, blockers encountered, and next steps.
| Parameter | Type | Required | Description |
|---|---|---|---|
| project | string | Optional | Filter by project |
| Field | Type | Required | Description |
|---|---|---|---|
| project | uuid | Required | Project ID |
| summary | string | Optional | Session summary |
| accomplished | array | Optional | List of accomplishments |
| next_steps | array | Optional | Planned next steps |
| blockers | array | Optional | Blockers encountered |
curl -X POST http://aimemory.com.br/api/sessions/ \
-H "Authorization: Token YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"project": "project-uuid",
"summary": "Implemented user authentication",
"accomplished": [
"Created login endpoint",
"Added JWT token validation"
],
"next_steps": [
"Add refresh token mechanism",
"Implement password reset"
],
"blockers": [
"Need Redis for token storage"
]
}'
✅ Tasks
Track tasks and to-dos for your projects. Set priorities, due dates, and manage status.
Task Status
pending - Not started
in_progress - Currently working
completed - Finished
cancelled - Not doing
| Parameter | Type | Required | Description |
|---|---|---|---|
| project | string | Optional | Filter by project |
| status | string | Optional | Filter by status |
| priority__gte | integer | Optional | Minimum priority (1-10) |
| Field | Type | Required | Description |
|---|---|---|---|
| project | uuid | Required | Project ID |
| title | string | Required | Task title |
| description | string | Optional | Task description |
| priority | integer | Optional | Priority 1-10 (default: 5) |
| due_date | datetime | Optional | Due date (ISO 8601) |
| tags | array | Optional | Array of tags |
curl -X PATCH http://aimemory.com.br/api/tasks/TASK_UUID/ \
-H "Authorization: Token YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "completed"}'
💻 Code Snippets
Store important code fragments with metadata like file path, language, and line numbers.
| Parameter | Type | Required | Description |
|---|---|---|---|
| project | string | Optional | Filter by project |
| language | string | Optional | Filter by language (python, javascript, etc.) |
| Field | Type | Required | Description |
|---|---|---|---|
| project | uuid | Required | Project ID |
| name | string | Required | Snippet name |
| code | string | Required | The code content |
| language | string | Optional | Programming language |
| file_path | string | Optional | Source file path |
| description | string | Optional | Description of the snippet |
📋 Context Generation
Generate comprehensive context documents for your projects. Perfect for starting new AI conversations with full project knowledge.
Returns a comprehensive Markdown document containing:
- Project information and stack
- Recent sessions and accomplishments
- Important memories (decisions, learnings, etc.)
- Pending and in-progress tasks
- Code snippets (optional)
curl http://aimemory.com.br/api/projects/PROJECT_UUID/context/ \ -H "Authorization: Token YOUR_TOKEN"
⚠️ Error Handling
The API uses standard HTTP status codes and returns JSON error responses.
| Status | Meaning | Description |
|---|---|---|
| 200 | OK | Request successful |
| 201 | Created | Resource created successfully |
| 400 | Bad Request | Invalid request data |
| 401 | Unauthorized | Missing or invalid token |
| 403 | Forbidden | No permission for this resource |
| 404 | Not Found | Resource not found |
| 500 | Server Error | Internal server error |
{
"detail": "Authentication credentials were not provided."
}
📄 Pagination
List endpoints support pagination using limit and offset parameters.
GET /api/memories/?limit=20&offset=40
| Parameter | Default | Description |
|---|---|---|
| limit | 50 | Number of results per page (max 200) |
| offset | 0 | Number of results to skip |
🔌 MCP Integration
AI Memory System integrates with Claude Code via the Model Context Protocol (MCP). This allows Claude to directly access and manage your memories during coding sessions.
Setup MCP Server
Download the MCP server
Get the server from /admin/mcp-setup/ or clone from the repository.
Configure Claude Code
Add the server configuration to ~/.claude/settings.json
Start using
Claude will automatically use your memories in conversations.
{
"mcpServers": {
"ai-memory": {
"command": "python",
"args": ["/path/to/mcp_server/server.py"],
"env": {
"AIM_API_URL": "http://aimemory.com.br"
}
}
}
}