The AI Agent Simulation Platform provides a comprehensive REST API built with FastAPI. This documentation covers all available endpoints, request/response formats, and authentication requirements.
Development: http://localhost:8001/api
Production: https://your-domain.com/api
All API endpoints require JWT authentication unless specified otherwise.
Authorization: Bearer <your-jwt-token>
- Register a new account or use test login
- Use the returned JWT token for all subsequent requests
- Include the token in the Authorization header
Register a new user account.
Request Body:
{
"email": "user@example.com",
"password": "secure_password",
"name": "John Doe"
}Response:
{
"user": {
"id": "user_123",
"email": "user@example.com",
"name": "John Doe",
"created_at": "2024-01-01T00:00:00Z"
},
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"token_type": "bearer"
}Authenticate user and get JWT token.
Request Body:
{
"email": "user@example.com",
"password": "secure_password"
}Response:
{
"user": {
"id": "user_123",
"email": "user@example.com",
"name": "John Doe"
},
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"token_type": "bearer"
}Get a test JWT token for guest access.
Request Body: None
Response:
{
"user": {
"id": "guest_user",
"email": "guest@example.com",
"name": "Guest User"
},
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"token_type": "bearer"
}Get current user information.
Headers: Authorization: Bearer <token>
Response:
{
"id": "user_123",
"email": "user@example.com",
"name": "John Doe",
"created_at": "2024-01-01T00:00:00Z"
}Get all agents for the current user.
Headers: Authorization: Bearer <token>
Response:
[
{
"id": "agent_123",
"name": "Dr. Sarah Chen",
"archetype": "scientist",
"goal": "Advance precision medicine research",
"background": "Harvard-trained physician-scientist...",
"expertise": "Precision Oncology, Genomics",
"avatar_url": "https://example.com/avatar.jpg",
"created_at": "2024-01-01T00:00:00Z"
}
]Create a new agent.
Headers: Authorization: Bearer <token>
Request Body:
{
"name": "Dr. Sarah Chen",
"archetype": "scientist",
"goal": "Advance precision medicine research",
"background": "Harvard-trained physician-scientist with 15 years in oncology research",
"expertise": "Precision Oncology, Genomics, Clinical Trials",
"memory_summary": "Expert in BRCA mutations and personalized treatment protocols",
"avatar_url": "https://example.com/avatar.jpg",
"avatar_prompt": "Professional female scientist with lab coat",
"personality": {
"extroversion": 7,
"optimism": 8,
"curiosity": 9,
"cooperativeness": 6,
"energy": 7
}
}Response:
{
"id": "agent_123",
"name": "Dr. Sarah Chen",
"archetype": "scientist",
"goal": "Advance precision medicine research",
"background": "Harvard-trained physician-scientist with 15 years in oncology research",
"expertise": "Precision Oncology, Genomics, Clinical Trials",
"avatar_url": "https://example.com/avatar.jpg",
"created_at": "2024-01-01T00:00:00Z"
}Update an existing agent.
Headers: Authorization: Bearer <token>
Path Parameters:
agent_id(string): The agent ID
Request Body:
{
"name": "Dr. Sarah Chen",
"archetype": "scientist",
"goal": "Updated research goal",
"background": "Updated background information",
"expertise": "Updated expertise areas"
}Response:
{
"id": "agent_123",
"name": "Dr. Sarah Chen",
"archetype": "scientist",
"goal": "Updated research goal",
"background": "Updated background information",
"expertise": "Updated expertise areas",
"avatar_url": "https://example.com/avatar.jpg",
"updated_at": "2024-01-01T00:00:00Z"
}Delete an agent.
Headers: Authorization: Bearer <token>
Path Parameters:
agent_id(string): The agent ID
Response:
{
"message": "Agent deleted successfully"
}Get all saved agents for the current user.
Headers: Authorization: Bearer <token>
Response:
[
{
"id": "saved_agent_123",
"name": "Dr. Sarah Chen",
"archetype": "scientist",
"goal": "Advance precision medicine research",
"background": "Harvard-trained physician-scientist",
"expertise": "Precision Oncology, Genomics",
"avatar_url": "https://example.com/avatar.jpg",
"avatar_prompt": "Professional female scientist",
"is_favorite": true,
"created_at": "2024-01-01T00:00:00Z"
}
]Save an agent to the user's library.
Headers: Authorization: Bearer <token>
Request Body:
{
"name": "Dr. Sarah Chen",
"archetype": "scientist",
"goal": "Advance precision medicine research",
"background": "Harvard-trained physician-scientist",
"expertise": "Precision Oncology, Genomics",
"avatar_url": "https://example.com/avatar.jpg",
"avatar_prompt": "Professional female scientist",
"is_favorite": false
}Response:
{
"id": "saved_agent_123",
"name": "Dr. Sarah Chen",
"archetype": "scientist",
"goal": "Advance precision medicine research",
"background": "Harvard-trained physician-scientist",
"expertise": "Precision Oncology, Genomics",
"avatar_url": "https://example.com/avatar.jpg",
"avatar_prompt": "Professional female scientist",
"is_favorite": false,
"created_at": "2024-01-01T00:00:00Z"
}Update a saved agent.
Headers: Authorization: Bearer <token>
Path Parameters:
agent_id(string): The saved agent ID
Request Body:
{
"name": "Updated Agent Name",
"archetype": "scientist",
"goal": "Updated goal",
"background": "Updated background",
"expertise": "Updated expertise"
}Response:
{
"id": "saved_agent_123",
"name": "Updated Agent Name",
"archetype": "scientist",
"goal": "Updated goal",
"background": "Updated background",
"expertise": "Updated expertise",
"avatar_url": "https://example.com/avatar.jpg",
"is_favorite": false,
"updated_at": "2024-01-01T00:00:00Z"
}Toggle favorite status of a saved agent.
Headers: Authorization: Bearer <token>
Path Parameters:
agent_id(string): The saved agent ID
Request Body: None
Response:
{
"id": "saved_agent_123",
"name": "Dr. Sarah Chen",
"archetype": "scientist",
"is_favorite": true,
"message": "Favorite status updated successfully"
}Delete a saved agent from the user's library.
Headers: Authorization: Bearer <token>
Path Parameters:
agent_id(string): The saved agent ID
Response:
{
"message": "Saved agent deleted successfully"
}Start a new simulation.
Headers: Authorization: Bearer <token>
Request Body:
{
"scenario": "Business strategy meeting for new product launch",
"agents": ["agent_123", "agent_456"],
"settings": {
"auto_generate": true,
"generation_interval": 4,
"max_rounds": 10
}
}Response:
{
"simulation_id": "sim_123",
"status": "active",
"scenario": "Business strategy meeting for new product launch",
"agents": ["agent_123", "agent_456"],
"started_at": "2024-01-01T00:00:00Z"
}Get current simulation state.
Headers: Authorization: Bearer <token>
Response:
{
"simulation_id": "sim_123",
"status": "active",
"scenario": "Business strategy meeting for new product launch",
"agents": ["agent_123", "agent_456"],
"current_round": 3,
"total_rounds": 10,
"started_at": "2024-01-01T00:00:00Z",
"last_activity": "2024-01-01T00:05:00Z"
}Pause the current simulation.
Headers: Authorization: Bearer <token>
Response:
{
"simulation_id": "sim_123",
"status": "paused",
"message": "Simulation paused successfully"
}Set a custom scenario for the simulation.
Headers: Authorization: Bearer <token>
Request Body:
{
"scenario": "Emergency response planning for natural disasters",
"context": "A major earthquake has struck the region and immediate response is needed"
}Response:
{
"scenario": "Emergency response planning for natural disasters",
"context": "A major earthquake has struck the region and immediate response is needed",
"updated_at": "2024-01-01T00:00:00Z"
}Get conversation history for the current user.
Headers: Authorization: Bearer <token>
Query Parameters:
limit(int, optional): Number of conversations to return (default: 50)offset(int, optional): Number of conversations to skip (default: 0)
Response:
[
{
"id": "conv_123",
"agent_id": "agent_123",
"agent_name": "Dr. Sarah Chen",
"message": "Based on the market analysis, I recommend focusing on precision medicine approaches...",
"timestamp": "2024-01-01T00:00:00Z",
"simulation_id": "sim_123"
}
]Get detailed conversation history with full context.
Headers: Authorization: Bearer <token>
Response:
{
"conversations": [
{
"id": "conv_123",
"agent_id": "agent_123",
"agent_name": "Dr. Sarah Chen",
"message": "Based on the market analysis, I recommend focusing on precision medicine approaches...",
"timestamp": "2024-01-01T00:00:00Z",
"simulation_id": "sim_123",
"context": {
"scenario": "Business strategy meeting",
"previous_messages": 5,
"agent_archetype": "scientist"
}
}
],
"total_count": 150,
"metadata": {
"latest_simulation": "sim_123",
"active_agents": 3,
"total_messages": 150
}
}Generate a new conversation round.
Headers: Authorization: Bearer <token>
Request Body:
{
"simulation_id": "sim_123",
"agent_ids": ["agent_123", "agent_456"],
"custom_prompt": "Focus on budget considerations for this quarter"
}Response:
{
"conversations": [
{
"id": "conv_124",
"agent_id": "agent_123",
"agent_name": "Dr. Sarah Chen",
"message": "Regarding budget considerations, we should prioritize research initiatives...",
"timestamp": "2024-01-01T00:00:00Z"
}
],
"generation_time": 2.5,
"status": "success"
}Get comprehensive analytics dashboard data.
Headers: Authorization: Bearer <token>
Response:
{
"summary": {
"total_conversations": 150,
"total_agents": 12,
"total_documents": 25,
"active_simulations": 1
},
"daily_activity": [
{
"date": "2024-01-01",
"conversations": 25,
"agents_created": 2,
"documents_generated": 3
}
],
"agent_usage": [
{
"agent_id": "agent_123",
"agent_name": "Dr. Sarah Chen",
"usage_count": 45,
"last_used": "2024-01-01T00:00:00Z"
}
],
"scenario_distribution": {
"business_strategy": 35,
"research_planning": 28,
"emergency_response": 12
}
}Get weekly analytics summary.
Headers: Authorization: Bearer <token>
Response:
{
"period": {
"start_date": "2024-01-01",
"end_date": "2024-01-07"
},
"summary": {
"conversations_count": 75,
"agents_created": 5,
"documents_created": 8,
"most_active_day": "2024-01-03"
},
"daily_breakdown": [
{
"date": "2024-01-01",
"conversations": 10,
"agents_created": 1,
"documents_generated": 2
}
]
}Get generated documents for the current user.
Headers: Authorization: Bearer <token>
Query Parameters:
category(string, optional): Filter by document categorylimit(int, optional): Number of documents to return (default: 50)
Response:
[
{
"id": "doc_123",
"title": "Q1 Strategy Analysis Report",
"category": "business_strategy",
"content": "# Executive Summary\n\nThis report analyzes...",
"preview": "This report analyzes the first quarter performance...",
"created_at": "2024-01-01T00:00:00Z",
"simulation_id": "sim_123",
"metadata": {
"word_count": 1250,
"page_count": 5,
"contributors": ["Dr. Sarah Chen", "John Smith"]
}
}
]Get a specific document.
Headers: Authorization: Bearer <token>
Path Parameters:
document_id(string): The document ID
Response:
{
"id": "doc_123",
"title": "Q1 Strategy Analysis Report",
"category": "business_strategy",
"content": "# Executive Summary\n\nThis report provides a comprehensive analysis...",
"created_at": "2024-01-01T00:00:00Z",
"simulation_id": "sim_123",
"metadata": {
"word_count": 1250,
"page_count": 5,
"contributors": ["Dr. Sarah Chen", "John Smith"],
"tags": ["strategy", "analysis", "Q1"]
}
}Send user feedback.
Headers: Authorization: Bearer <token>
Request Body:
{
"type": "feature_request",
"subject": "Agent collaboration improvements",
"message": "It would be great to have better collaboration features between agents...",
"priority": "medium"
}Response:
{
"id": "feedback_123",
"status": "received",
"message": "Thank you for your feedback! We'll review it and get back to you.",
"created_at": "2024-01-01T00:00:00Z"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request data",
"details": {
"field": "email",
"issue": "Invalid email format"
}
},
"timestamp": "2024-01-01T00:00:00Z",
"request_id": "req_123"
}200- Success201- Created400- Bad Request401- Unauthorized403- Forbidden404- Not Found422- Validation Error500- Internal Server Error
VALIDATION_ERROR- Request validation failedAUTHENTICATION_ERROR- Invalid or missing authenticationPERMISSION_DENIED- Insufficient permissionsRESOURCE_NOT_FOUND- Requested resource not foundRATE_LIMIT_EXCEEDED- Too many requestsINTERNAL_ERROR- Server error
API requests are rate limited to prevent abuse:
- Authentication endpoints: 10 requests per minute
- Agent management: 100 requests per minute
- Simulation control: 50 requests per minute
- Analytics: 20 requests per minute
Rate limit headers are included in responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200
Future support for webhooks to notify external systems of events:
- Agent created/updated
- Simulation started/completed
- Document generated
- Conversation milestones
Official SDKs are planned for:
- Python
- JavaScript/TypeScript
- Go
- Java
For more information, visit the GitHub repository or contact support@ai-agent-simulation.com.