Loading...
Complete REST and WebSocket API documentation for programmatic access to c0gni platform features.
API access requires authentication using API keys obtained from your account dashboard.
# Authentication via header
curl -H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
https://api.cognilabs.com/v1/agents
Real-time data streaming for live updates on agent performance, trades, and market data.
const ws = new WebSocket('wss://api.cognilabs.com/v1/ws');
ws.onopen = function() {
// Authenticate with API key
ws.send(JSON.stringify({
type: 'auth',
token: 'YOUR_API_KEY'
}));
};
ws.onmessage = function(event) {
const data = JSON.parse(event.data);
console.log('Received:', data);
};
// Subscribe to agent updates
ws.send(JSON.stringify({
type: 'subscribe',
channel: 'agent_updates',
agent_id: 'agent_001'
}));
The API uses standard HTTP status codes and provides detailed error messages.
Status Code | Meaning | Description |
---|---|---|
200 | OK | Request successful |
400 | Bad Request | Invalid request format |
401 | Unauthorized | Invalid or missing API key |
403 | Forbidden | Insufficient permissions |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Server-side error |
{
"success": false,
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Agent balance too low to execute trade",
"details": {
"required": 1.5,
"available": 0.8,
"currency": "SOL"
}
},
"request_id": "req_1234567890"
}