API Reference
Integrate with Aethyr programmatically. Our API supports both REST and WebSocket protocols for real-time streaming.
Base URL
Self-hosted: https://your-instance.com/api
Authentication
All API requests require authentication via Bearer token. Generate API keys from the Console under Settings → API Keys.
Authorization Header
Authorization: Bearer YOUR_API_KEYSecurity Note
Never expose API keys in client-side code. Use server-side requests or environment variables.
REST Endpoints
Agents
GET
/api/agentsList all agentsPOST
/api/agentsCreate agentGET
/api/agents/:idGet agent detailsPUT
/api/agents/:idUpdate agentDELETE
/api/agents/:idDelete agentConversations
POST
/api/conversationsCreate conversationPOST
/api/conversations/:id/messagesSend messageGET
/api/conversations/:id/messagesGet messagesKnowledge Base
POST
/api/knowledge/ingestUpload documentPOST
/api/knowledge/searchSemantic searchWebSocket API
Use WebSocket for real-time streaming responses. Connect to receive token-by-token output as the model generates.
WebSocket Connection
// Connect to WebSocket
const ws = new WebSocket('wss://your-instance.com/api/ws');
// Authenticate
ws.send(JSON.stringify({
type: 'auth',
token: 'YOUR_API_KEY'
}));
// Send message and stream response
ws.send(JSON.stringify({
type: 'message',
conversationId: 'conv_123',
content: 'Hello!'
}));
// Receive streaming tokens
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'token') {
process.stdout.write(data.content);
} else if (data.type === 'done') {
console.log('\nComplete!');
}
};