REST API Reference
Complete reference for ElizaOS REST API endpoints
Overview
The ElizaOS REST API provides comprehensive endpoints for managing agents, messaging, memory, media,
and system operations. All endpoints are prefixed with /api and return JSON responses.
Base Configuration
Base URL
http://localhost:3000/apiAuthentication
If ELIZA_SERVER_AUTH_TOKEN is set, include the API key in headers:
X-API-KEY: your-api-keyResponse Format
Success Response:
{
"success": true,
"data": {
/* endpoint-specific data */
}
}Error Response:
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human readable error message",
"details": "Additional error information"
}
}Agent Management
List All Agents
GET /api/agentsResponse:
{
"success": true,
"data": {
"agents": [
{
"id": "agent-uuid",
"name": "Agent Name",
"characterName": "Character Name",
"bio": "Agent biography",
"status": "active" | "inactive"
}
]
}
}Get Agent Details
GET /api/agents/:agentIdResponse:
{
"success": true,
"data": {
"id": "agent-uuid",
"name": "Agent Name",
"bio": ["Biography lines"],
"lore": ["Lore entries"],
"knowledge": ["Knowledge items"],
"topics": ["conversation", "topics"],
"status": "active" | "inactive"
}
}Create Agent
POST /api/agentsRequest Body:
{
"characterJson": {
/* character configuration */
},
// OR
"characterPath": "/path/to/character.json",
// OR
"agent": {
/* agent configuration */
}
}Start Agent
POST /api/agents/:agentId/startResponse:
{
"success": true,
"data": {
"id": "agent-uuid",
"character": {
/* character data */
},
"status": "active"
}
}Stop Agent
POST /api/agents/:agentId/stopMessaging
Core Messaging
Submit Message
POST /api/messaging/submitRequest Body:
{
"channel_id": "channel-uuid",
"server_id": "server-uuid",
"author_id": "author-uuid",
"content": "Message content",
"in_reply_to_message_id": "message-uuid",
"source_type": "agent_response",
"raw_message": {
"thought": "Agent's internal thought",
"actions": ["action1", "action2"]
},
"metadata": {
"agentName": "Agent Name",
"attachments": []
}
}Complete Message
POST /api/messaging/completeRequest Body:
{
"channel_id": "channel-uuid",
"server_id": "server-uuid"
}Ingest External Message
POST /api/messaging/ingest-externalRequest Body:
{
"channel_id": "channel-uuid",
"server_id": "server-uuid",
"author_id": "author-uuid",
"author_display_name": "User Name",
"content": "Message content",
"source_id": "platform-message-id",
"source_type": "discord",
"raw_message": {},
"metadata": {}
}Servers
List Servers
GET /api/messaging/serversResponse:
{
"success": true,
"data": {
"servers": [
{
"id": "server-uuid",
"name": "Server Name",
"sourceType": "eliza_default",
"metadata": {},
"createdAt": "2024-01-01T00:00:00Z"
}
]
}
}Get Server Details
GET /api/messaging/servers/:serverIdChannels
List Channels for Server
GET /api/messaging/servers/:serverId/channelsQuery Parameters:
participantId- Filter channels by participant
Response:
{
"success": true,
"data": {
"channels": [
{
"id": "channel-uuid",
"name": "Channel Name",
"type": "dm" | "group",
"participants": ["user-uuid-1", "user-uuid-2"],
"lastMessageAt": "2024-01-01T00:00:00Z"
}
]
}
}Create Channel
POST /api/messaging/servers/:serverId/channelsRequest Body:
{
"name": "Channel Name",
"type": "dm" | "group",
"participants": ["user-uuid-1", "user-uuid-2"],
"metadata": {}
}Send Message to Channel
POST /api/messaging/central-channels/:channelId/messagesRequest Body:
{
"author_id": "user-uuid",
"content": "Message text",
"in_reply_to_message_id": "message-uuid",
"server_id": "server-uuid",
"raw_message": {},
"metadata": {
"user_display_name": "User Name"
},
"source_type": "eliza_gui"
}Get Channel Messages
GET /api/messaging/central-channels/:channelId/messagesQuery Parameters:
limit- Number of messages (default: 50)before- ISO timestamp for pagination
Response:
{
"success": true,
"data": {
"messages": [
{
"id": "message-uuid",
"content": "Message content",
"authorId": "author-uuid",
"channelId": "channel-uuid",
"createdAt": "2024-01-01T00:00:00Z",
"metadata": {}
}
]
}
}Upload File to Channel
POST /api/messaging/central-channels/:channelId/uploadRequest:
- Content-Type:
multipart/form-data - Field:
file- Media file
Response:
{
"success": true,
"data": {
"url": "/media/uploads/channels/{channelId}/filename.ext",
"filename": "filename.ext"
}
}Delete Message
DELETE /api/messaging/messages/:messageIdMemory Management
Search Agent Memory
GET /api/memory/agents/:agentId/searchQuery Parameters:
query- Search text (required)limit- Result limit (default: 10)
Response:
{
"success": true,
"data": {
"memories": [
{
"id": "memory-uuid",
"content": {
"text": "Memory content",
"source": "conversation"
},
"similarity": 0.95,
"createdAt": "2024-01-01T00:00:00Z"
}
]
}
}Create Memory
POST /api/memory/agents/:agentId/memoriesRequest Body:
{
"content": {
"text": "Memory content",
"type": "reflection" | "fact" | "dialogue"
},
"roomId": "optional-room-uuid"
}Get Memories by Room
GET /api/memory/agents/:agentId/rooms/:roomId/memoriesQuery Parameters:
unique- Return only unique memories (default: true)
Remove Memory
DELETE /api/memory/agents/:agentId/memories/:memoryIdRemove All Memories
DELETE /api/memory/agents/:agentId/memoriesQuery Parameters:
confirm- Must be "true" to execute
Audio Processing
Transcribe Audio
POST /api/audio/transcribeRequest:
- Content-Type:
multipart/form-data - Field:
audio- Audio file
Response:
{
"success": true,
"data": {
"text": "Transcribed text",
"service": "openai"
}
}Generate Speech
POST /api/audio/speechRequest Body:
{
"text": "Text to convert to speech",
"voice": "en-US-Neural2-A",
"service": "google" | "openai" | "elevenlabs"
}Response:
{
"success": true,
"data": {
"audio": "base64-encoded-audio",
"format": "mp3",
"sampleRate": 24000
}
}Process Audio Conversation
POST /api/audio/agents/:agentId/conversationRequest:
- Content-Type:
multipart/form-data - Field:
audio- Audio file - Field:
roomId- Room UUID
Response:
{
"success": true,
"data": {
"text": "User's transcribed speech",
"response": "Agent's response",
"audio": "base64-encoded-response-audio"
}
}Media Management
Upload Agent Media
POST /api/media/agents/:agentId/uploadRequest:
- Content-Type:
multipart/form-data - Field:
file- Media file
Response:
{
"success": true,
"data": {
"url": "/media/uploads/agents/{agentId}/filename.ext",
"filename": "filename.ext",
"mimeType": "image/jpeg",
"size": 12345
}
}Upload Channel Media
POST /api/media/channels/:channelId/uploadGenerate Media
POST /api/media/agents/:agentId/generateRequest Body:
{
"prompt": "Image generation prompt",
"type": "image",
"service": "openai"
}Response:
{
"success": true,
"data": {
"url": "/media/generated/{agentId}/generated-image.png",
"metadata": {
"prompt": "Original prompt",
"model": "dall-e-3"
}
}
}Server Management
Health Monitoring
Ping
GET /api/server/pingResponse:
{
"pong": true,
"timestamp": 1234567890
}Hello World
GET /api/server/helloResponse:
{
"message": "Hello World!"
}System Status
GET /api/server/statusResponse:
{
"status": "ok",
"agentCount": 3,
"timestamp": "2024-01-01T00:00:00Z"
}Health Check
GET /api/server/healthResponse:
{
"status": "OK",
"version": "1.2.0",
"timestamp": "2024-01-01T00:00:00Z",
"dependencies": {
"agents": "healthy"
}
}Server Stop
POST /api/server/stopResponse:
{
"message": "Server stopping..."
}Debugging
Debug Information
GET /api/server/debugResponse:
{
"success": true,
"data": {
"environment": "development",
"nodeVersion": "20.0.0",
"elizaVersion": "1.2.0",
"plugins": ["@elizaos/plugin-discord", "@elizaos/plugin-twitter"]
}
}Logging
Stream Logs
GET /api/server/logsQuery Parameters:
level- Log level filter (debug, info, warn, error)agentId- Filter by specific agentlimit- Number of log entries (default: 100)
Response:
{
"success": true,
"data": {
"logs": [
{
"level": "info",
"timestamp": "2024-01-01T00:00:00Z",
"message": "Log message",
"agentId": "agent-uuid",
"metadata": {}
}
]
}
}System Configuration
Environment Management
Get Local Environment Variables
GET /api/system/env/localResponse:
{
"success": true,
"data": {
"NODE_ENV": "development",
"SERVER_URL": "http://localhost:3000",
"ELIZA_SERVER_PORT": "3000"
}
}Update Local Environment Variables
POST /api/system/env/localRequest Body:
{
"content": {
"NODE_ENV": "production",
"SERVER_URL": "https://example.com",
"ELIZA_SERVER_PORT": "3000"
}
}Response:
{
"success": true,
"message": "Local env updated"
}Version Management
Get Version Information
GET /api/system/versionResponse:
{
"version": "1.2.0",
"source": "server",
"timestamp": "2024-01-01T00:00:00Z",
"environment": "development",
"uptime": 3600
}TEE Operations
Generate Remote Attestation
POST /api/tee/attestationRequest Body:
{
"reportData": "custom-report-data"
}Response:
{
"success": true,
"data": {
"attestation": "base64-encoded-attestation",
"signature": "attestation-signature"
}
}Derive Key
POST /api/tee/derive-keyRequest Body:
{
"path": "/path/to/derive",
"data": "input-data"
}Error Codes
Common error codes returned by the API:
| Code | Description |
|---|---|
INVALID_ID | Invalid UUID format |
NOT_FOUND | Resource not found |
INVALID_REQUEST | Invalid request parameters |
DB_ERROR | Database operation failed |
AUTH_REQUIRED | Authentication required |
FORBIDDEN | Insufficient permissions |
RATE_LIMITED | Too many requests |
INTERNAL_ERROR | Server error |
Rate Limiting
API endpoints are rate-limited to prevent abuse:
- Default: 100 requests per minute per IP
- File uploads: 10 requests per minute per IP
- Can be configured via environment variables
CORS Configuration
CORS is enabled with the following defaults:
- Origin: Configured via
CORS_ORIGINenv var or* - Credentials: Enabled
- Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS
- Headers: Content-Type, Authorization, X-API-KEY
File Size Limits
- JSON payloads: 100KB (configurable via
EXPRESS_MAX_PAYLOAD) - File uploads: 10MB per file
- Audio files: 25MB
- Generated content: Limited by disk space
Best Practices
- Always handle errors - Check for error responses
- Use proper content types - Set Content-Type headers
- Validate UUIDs - Ensure valid UUID format
- Implement retries - Add exponential backoff
- Cache responses - Use appropriate cache headers
- Monitor rate limits - Track X-RateLimit headers
- Secure file uploads - Validate file types and sizes