The Lira Protocol exposes multiple APIs across different services:
- PHP API (Port 8000) - CRUD operations for users, tokens, agents
- Go API (Port 8080) - Agent execution and model management
- Java API (Port 8081) - Quantum oracle integration
All APIs return JSON responses and support CORS for frontend integration.
Development:
- PHP API: http://localhost:8000
- Go API: http://localhost:8080
- Java API: http://localhost:8081
Production:
- PHP API: https://api.lira.ai
- Go API: https://go-api.lira.ai
- Java API: https://java-api.lira.ai
Currently, APIs are open for development. Production will implement JWT authentication.
Authorization: Bearer <token>GET /api/usersResponse:
{
"success": true,
"data": [
{
"id": 1,
"address": "0x742d...5e5c",
"tokens": 12,
"agents": 5,
"status": "active"
}
]
}GET /api/users/:idPOST /api/users
Content-Type: application/json
{
"address": "0x742d35a06e5c53e5c"
}GET /api/tokensResponse:
{
"success": true,
"data": [
{
"id": 1,
"name": "MyToken",
"symbol": "MTK",
"contract": "0x1234...5678",
"supply": "1000000",
"creator": "0x742d...5e5c",
"status": "active"
}
]
}POST /api/tokens
Content-Type: application/json
{
"name": "MyToken",
"symbol": "MTK",
"supply": "1000000",
"creator": "0x742d35a06e5c53e5c"
}GET /api/agentsPOST /api/agents
Content-Type: application/json
{
"name": "Market Analyzer",
"model_type": "GPT-4",
"owner": "0x742d35a06e5c53e5c"
}GET /api/agentsResponse:
{
"success": true,
"data": [
{
"id": "1",
"name": "Market Analyzer",
"model_type": "GPT-4",
"owner": "0x742d...5e5c",
"executions": 127,
"is_active": true
}
]
}GET /api/agents/:idPOST /api/agents
Content-Type: application/json
{
"name": "Price Oracle",
"model_type": "Claude-3"
}Response:
{
"success": true,
"data": {
"id": "new-id",
"name": "Price Oracle",
"model_type": "Claude-3",
"owner": "0x742d...5e5c",
"execution_count": 0,
"is_active": true
}
}POST /api/agents/:id/execute
Content-Type: application/json
{
"input_data": "Analyze BTC/USD market"
}Response:
{
"success": true,
"data": {
"agent_id": "1",
"output": "Analyzed: BTC/USD market",
"confidence": 0.95,
"timestamp": "2026-01-12T23:50:00Z"
}
}POST /api/agents/batch-execute
Content-Type: application/json
{
"agent_ids": ["1", "2", "3"],
"input_data": "Analyze market sentiment"
}Response:
{
"success": true,
"data": [
{
"agent_id": "1",
"output": "Parallel result for agent 1",
"confidence": 0.92,
"timestamp": "2026-01-12T23:50:00Z"
},
{
"agent_id": "2",
"output": "Parallel result for agent 2",
"confidence": 0.94,
"timestamp": "2026-01-12T23:50:00Z"
}
]
}GET /api/modelsResponse:
{
"success": true,
"data": [
{
"id": "1",
"name": "GPT-4 Turbo",
"type": "language",
"version": "1.0",
"description": "Advanced language model"
}
]
}POST /api/models
Content-Type: application/json
{
"name": "Custom Model",
"type": "language",
"description": "My custom model"
}POST /api/quantum/predict
Content-Type: application/json
{
"data": "market_data_hash"
}Response:
{
"success": true,
"data": {
"result": "quantum_prediction_result",
"confidence": 0.98,
"qubits": 256,
"timestamp": "2026-01-12T23:50:00Z"
}
}GET /api/quantum/statusResponse:
{
"success": true,
"data": {
"status": "operational",
"qubits_available": 256,
"queue_length": 3,
"uptime": "99.9%"
}
}GET /api/quantum/healthResponse:
{
"status": "healthy",
"service": "Java Quantum Oracle API"
}POST /api/quantum/predict
Content-Type: application/json
{
"data": "input_data_for_prediction"
}Response:
{
"success": true,
"data": {
"result": "quantum_prediction_742",
"confidence": 0.93,
"qubits": 256,
"executionTimeMs": 234
}
}POST /api/quantum/optimize
Content-Type: application/json
{
"initial_price": 1.0,
"liquidity_target": 100000,
"volatility": 0.15
}Response:
{
"success": true,
"data": {
"optimized_price": 1.12,
"optimized_liquidity": 125000,
"optimized_volatility": 0.11,
"confidence": 0.92,
"quantum_advantage": true
}
}GET /api/quantum/statusResponse:
{
"success": true,
"data": {
"qubits_available": 256,
"queue_length": 3,
"uptime": "99.9%",
"active_jobs": 12
}
}All APIs return consistent error responses:
{
"success": false,
"error": "Error message description"
}HTTP Status Codes:
200- Success201- Created400- Bad Request401- Unauthorized404- Not Found500- Internal Server Error
Production APIs implement rate limiting:
- 100 requests per 15 minutes per IP
- Headers:
X-RateLimit-Limit,X-RateLimit-Remaining
Real-time updates for:
- Agent execution status
- Token launches
- Timeline feed
ws://localhost:8080/ws/agents// Execute agent
const response = await fetch('http://localhost:8080/api/agents/1/execute', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ input_data: 'Analyze market' })
});
const result = await response.json();import requests
# Create token
response = requests.post('http://localhost:8000/api/tokens', json={
'name': 'MyToken',
'symbol': 'MTK',
'supply': '1000000'
})
print(response.json())# Quantum prediction
curl -X POST http://localhost:8081/api/quantum/predict \
-H "Content-Type: application/json" \
-d '{"data": "market_data"}'Use the provided Postman collection or test with cURL:
# Health checks
curl http://localhost:8000/api/health
curl http://localhost:8080/health
curl http://localhost:8081/api/quantum/healthFor API support:
- Documentation: https://docs.lira.ai
- GitHub Issues: https://github.com/SMSDAO/lira/issues
- Email: api@lira.ai
Last Updated: 2026-01-12