- Development:
http://localhost:8000 - Production: Configure per deployment
For Phase 1 (MVP), there is no authentication required.
Production: Add API key or JWT authentication.
Endpoint
GET /health
Response
{
"status": "healthy",
"timestamp": 1711097400
}Endpoint
GET /status
Response
{
"status": "operational",
"uptime_seconds": 3600,
"database": {
"total_events": 150,
"processed_events": 145,
"total_knowledge": 145,
"with_embeddings": 145
}
}Endpoint
GET /metrics
Response
{
"total_events": 150,
"processed_events": 145,
"total_knowledge": 145,
"with_embeddings": 145,
"embedding_coverage": 100.0
}Endpoint
POST /api/v1/query
Request Body
{
"query": "What database decisions were made?",
"top_k": 5,
"filter": {
"source": "slack"
}
}Query Parameters
query(required): Natural language search querytop_k(optional): Number of results (default: 5, max: 50)filter(optional): Filter results by source:slack,github, etc.
Response
{
"query": "What database decisions were made?",
"results": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"summary": "Team decided to migrate from MongoDB to PostgreSQL for better consistency",
"similarity_score": 0.92,
"source": "slack",
"channel": "#engineering",
"author": "alice",
"tags": ["database", "architecture", "migration"],
"decisions": [
"Migrate to PostgreSQL",
"Use pgvector for embeddings"
],
"entities": [
{
"name": "PostgreSQL",
"type": "tool",
"context": "new database choice",
"confidence": 0.95
},
{
"name": "MongoDB",
"type": "tool",
"context": "legacy database",
"confidence": 0.90
}
],
"created_at": "2024-03-22T10:30:00Z"
},
{
"id": "660e8400-e29b-41d4-a716-446655440001",
"summary": "Discussed schema design patterns for PostgreSQL migration",
"similarity_score": 0.88,
"source": "github",
"channel": "org/backend-repo",
"author": "bob",
"tags": ["schema", "database", "design"],
"decisions": ["Normalize schema", "Add indexes on foreign keys"],
"entities": [
{
"name": "schema_migration",
"type": "decision",
"context": "database design task",
"confidence": 0.85
}
],
"created_at": "2024-03-22T09:15:00Z"
}
],
"count": 2,
"duration": "245ms"
}Response Codes
200 OK: Successful search400 Bad Request: Invalid query500 Internal Server Error: Server error
Endpoint
GET /api/v1/history
Query Parameters
limit(optional): Results per page (default: 20, max: 100)offset(optional): Pagination offset (default: 0)
Response
{
"events": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"source": "slack",
"event_type": "message",
"author": "alice",
"channel": "#engineering",
"processing_status": "completed",
"received_at": "2024-03-22T10:30:00Z",
"processed_at": "2024-03-22T10:31:15Z"
}
],
"total": 150,
"offset": 0,
"limit": 20
}Endpoint
GET /api/v1/entities
Query Parameters
limit(optional): Results per page (default: 50, max: 200)offset(optional): Pagination offset (default: 0)
Response
{
"entities": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "PostgreSQL",
"type": "tool",
"description": "Open-source relational database",
"first_mentioned_at": "2024-03-20T08:00:00Z",
"last_mentioned_at": "2024-03-22T10:30:00Z",
"mention_count": 15
},
{
"id": "660e8400-e29b-41d4-a716-446655440001",
"name": "alice",
"type": "person",
"description": "Engineering team member",
"first_mentioned_at": "2024-03-19T09:00:00Z",
"last_mentioned_at": "2024-03-22T11:45:00Z",
"mention_count": 42
}
],
"total": 87,
"offset": 0,
"limit": 50
}Endpoint
GET /api/v1/entities/:name
URL Parameters
name: Entity name (URL encoded if contains special characters)
Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "PostgreSQL",
"type": "tool",
"description": "Open-source relational database",
"first_mentioned_at": "2024-03-20T08:00:00Z",
"last_mentioned_at": "2024-03-22T10:30:00Z",
"mention_count": 15
}Response Codes
200 OK: Entity found404 Not Found: Entity doesn't exist500 Internal Server Error: Server error
All errors follow this format:
{
"error": "Description of what went wrong"
}Common Errors
400 Bad Request: Invalid input (missing required fields, invalid JSON)404 Not Found: Resource not found500 Internal Server Error: Server-side error (check service logs)
Not implemented in MVP. Will be added in production.
# Query
curl -X POST http://localhost:8000/api/v1/query \
-H "Content-Type: application/json" \
-d '{
"query": "What architectural decisions impact our API design?",
"top_k": 10
}'
# Result contains summaries, decisions, and entities related to API architecture# Get entity details
curl "http://localhost:8000/api/v1/entities/my-microservice"
# Response shows when it was mentioned, who mentioned it, in what context# Get recent events
curl "http://localhost:8000/api/v1/history?limit=20&offset=0"
# Shows last 20 ingested events and their processing status-
Query Optimization
- Use specific queries for better results: "What database did we choose?" vs "database"
- Adjust
top_kbased on your needs (5-10 for focused results, 20+ for exploration)
-
Pagination
- Use
limitandoffsetfor large result sets - Default limit is 20; max is 100
- Use
-
Caching
- Results are computed fresh from embeddings
- Consider caching on client side for repeated queries
-
Error Handling
- Always check HTTP status code
- Log error messages for debugging
- Retry 500 errors with exponential backoff
/api/v1/query: 100-500ms (depends on vector DB performance)/api/v1/history: 50-150ms/api/v1/entities: 50-150ms
async function queryMemory(query, topK = 5) {
const response = await fetch('http://localhost:8000/api/v1/query', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
query: query,
top_k: topK
})
});
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
return await response.json();
}
// Usage
const results = await queryMemory('What API design decisions were made?');
console.log(results.results[0].summary);import requests
def query_memory(query: str, top_k: int = 5):
response = requests.post(
'http://localhost:8000/api/v1/query',
json={
'query': query,
'top_k': top_k
}
)
response.raise_for_status()
return response.json()
# Usage
results = query_memory('What API design decisions were made?')
print(results['results'][0]['summary'])curl -X POST http://localhost:8000/api/v1/query \
-H "Content-Type: application/json" \
-d '{
"query": "What API design decisions were made?",
"top_k": 5
}' | jq '.results[0]'- JWT authentication
- Rate limiting per API key
- Advanced filtering (date ranges, entity types)
- Result ranking customization
- Webhook subscriptions for new knowledge
- Batch query endpoint