diff --git a/docs/api-reference/introduction.mdx b/docs/api-reference/introduction.mdx index c471f638..b9c369cc 100644 --- a/docs/api-reference/introduction.mdx +++ b/docs/api-reference/introduction.mdx @@ -8,23 +8,47 @@ description: 'Complete API documentation for the Mem0 Memory System' The Mem0 Memory System provides a comprehensive REST API for memory operations, built on top of the mem0 framework with enhanced local-first capabilities. -**Current Status**: Phase 1 Complete - Core infrastructure ready for API development +**Phase 2 Complete ✅** - REST API is fully functional and production-ready as of 2025-07-31 ## Base URL +For external access (Docker deployment): +``` +http://YOUR_SERVER_IP:8080/v1 +``` + +For local development: ``` http://localhost:8080/v1 ``` ## Authentication -All API requests require authentication using API keys: +All API requests require authentication using Bearer tokens. **Available API keys:** + +```bash Development Key +# Default development API key +Authorization: Bearer mem0_dev_key_123456789 +``` + +```bash Docker Key +# Docker deployment API key +Authorization: Bearer mem0_docker_key_987654321 +``` + +```bash Admin Key +# Admin API key (for /v1/metrics endpoint) +Authorization: Bearer mem0_admin_key_111222333 +``` + + +### Example Request: ```bash -curl -H "Authorization: Bearer YOUR_API_KEY" \ +curl -H "Authorization: Bearer mem0_dev_key_123456789" \ -H "Content-Type: application/json" \ - http://localhost:8080/v1/memories + http://YOUR_SERVER_IP:8080/v1/memories/search?query=test&user_id=demo ``` ## Core Endpoints @@ -166,24 +190,65 @@ X-RateLimit-Reset: 1627849200 ## Development Status - -**In Development**: The API is currently in Phase 2 development. Core infrastructure (Phase 1) is complete and ready for API implementation. - + +**Phase 2 Complete ✅**: The REST API is fully functional and production-ready with comprehensive features. + ### Completed ✅ -- Core mem0 integration -- Database connections (Neo4j, Supabase) -- LLM provider support (Ollama, OpenAI) -- Configuration management +- **Core Infrastructure**: mem0 integration, Neo4j, Supabase, Ollama +- **REST API Endpoints**: All CRUD operations working +- **Authentication System**: Bearer token auth with API keys +- **Rate Limiting**: 100 requests/minute configurable +- **Error Handling**: Comprehensive error responses +- **Testing Suite**: Automated tests for all functionality +- **Docker Deployment**: External access configuration +- **Documentation**: Complete API reference and guides -### In Progress 🚧 -- REST API endpoints -- Authentication system -- Rate limiting -- Error handling +### Available Now 🚀 +- **Memory Operations**: Add, search, get, update, delete +- **User Management**: User-specific operations and statistics +- **Health Monitoring**: Health checks and system status +- **Admin Operations**: Metrics and system administration +- **External Access**: Docker deployment for remote access -### Planned 📋 -- SDK development -- API documentation -- Performance optimization -- Monitoring and logging \ No newline at end of file +### Future Enhancements 📋 +- SDK development (Python, JavaScript) +- Advanced caching mechanisms +- Metrics collection and monitoring +- Webhook support for real-time updates + +## Quick Testing + +Test the API from outside your machine using these working examples: + +### 1. Health Check (No Authentication) +```bash +curl http://YOUR_SERVER_IP:8080/health +``` + +### 2. System Status (With Authentication) +```bash +curl -H "Authorization: Bearer mem0_dev_key_123456789" \ + http://YOUR_SERVER_IP:8080/status +``` + +### 3. Add a Memory +```bash +curl -X POST "http://YOUR_SERVER_IP:8080/v1/memories" \ + -H "Authorization: Bearer mem0_dev_key_123456789" \ + -H "Content-Type: application/json" \ + -d '{ + "messages": [{"role": "user", "content": "I love building AI applications with FastAPI"}], + "user_id": "test_user_123", + "metadata": {"source": "external_test"} + }' +``` + +### 4. Search Memories +```bash +curl "http://YOUR_SERVER_IP:8080/v1/memories/search?query=FastAPI&user_id=test_user_123&limit=5" \ + -H "Authorization: Bearer mem0_dev_key_123456789" +``` + +### 5. Interactive Documentation +Open in your browser: `http://YOUR_SERVER_IP:8080/docs` \ No newline at end of file