API Reference

Complete REST API documentation for Daily AI Agent OS. Base URL: https://api.dailyai.dev/v1

Authentication: All endpoints (except /auth/login) require a Bearer token or API key in the Authorization header: Authorization: Bearer sk-your-key

Run an Agent

POST /v1/agents/{id}/run

Execute a specific agent with the provided parameters. Returns the generated signal or result. Execution is synchronous by default; pass "async": true for non-blocking runs.

Authentication

Requires a valid API key with agents:run scope.

Path Parameters

NameTypeRequiredDescription
idstringRequiredThe agent identifier (e.g., trading, weather, seo)

Request Body

NameTypeRequiredDescription
assetstringRequiredTarget asset ticker or identifier (e.g., "AAPL", "BTC-USD")
strategystringRequiredStrategy to execute: momentum, mean_reversion, breakout, sentiment
timeframestringOptionalAnalysis timeframe: 1m, 5m, 1h, 1d. Default: 1h
risk_levelstringOptionalRisk tolerance: low, medium, high. Default: medium
asyncbooleanOptionalIf true, returns a job ID for polling. Default: false

Request Example

json
{
  "asset": "AAPL",
  "strategy": "momentum",
  "timeframe": "1h",
  "risk_level": "medium"
}

Response (200 OK)

json
{
  "signal_id": "sig_abc123",
  "agent_id": "trading",
  "asset": "AAPL",
  "strategy": "momentum",
  "direction": "long",
  "confidence": 0.87,
  "entry_price": 198.45,
  "stop_loss": 195.20,
  "take_profit": 204.10,
  "metadata": {
    "indicators": ["RSI", "MACD", "EMA_20"],
    "reasoning": "Strong momentum with RSI at 65 and MACD crossover"
  },
  "created_at": "2026-03-25T14:30:00Z"
}

Error Responses

StatusDescription
400Invalid request body — missing required fields or invalid strategy
401Unauthorized — missing or invalid API key
404Agent not found — invalid agent ID
429Rate limit exceeded — wait and retry
500Internal server error — agent execution failed

Code Examples

bash
curl -X POST https://api.dailyai.dev/v1/agents/trading/run \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "asset": "AAPL",
    "strategy": "momentum",
    "timeframe": "1h"
  }'
python
from dailyai import AgentOS

client = AgentOS(api_key="sk-your-key")
signal = client.agents.trading.run(
    asset="AAPL",
    strategy="momentum",
    timeframe="1h"
)
print(signal)
javascript
const response = await fetch('https://api.dailyai.dev/v1/agents/trading/run', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk-your-key',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    asset: 'AAPL',
    strategy: 'momentum',
    timeframe: '1h',
  }),
});
const signal = await response.json();
console.log(signal);

List Agents

GET /v1/agents

Returns a list of all available agents and their capabilities.

Authentication

Requires a valid API key with agents:read scope.

Query Parameters

NameTypeRequiredDescription
categorystringOptionalFilter by category: trading, weather, content
statusstringOptionalFilter by status: active, beta, deprecated

Response (200 OK)

json
{
  "agents": [
    {
      "id": "trading",
      "name": "Trading Signal Agent",
      "category": "trading",
      "description": "Generates buy/sell signals using technical and sentiment analysis",
      "strategies": ["momentum", "mean_reversion", "breakout", "sentiment"],
      "status": "active"
    },
    {
      "id": "weather",
      "name": "Weather Arbitrage Agent",
      "category": "weather",
      "description": "Identifies weather-driven market opportunities",
      "strategies": ["commodity_impact", "energy_demand", "agriculture"],
      "status": "active"
    },
    {
      "id": "seo",
      "name": "SEO Content Agent",
      "category": "content",
      "description": "Generates SEO-optimized content for target keywords",
      "strategies": ["blog_post", "product_description", "meta_tags"],
      "status": "active"
    }
  ],
  "total": 3
}

Error Responses

StatusDescription
401Unauthorized — missing or invalid API key
429Rate limit exceeded

Code Examples

bash
curl https://api.dailyai.dev/v1/agents \
  -H "Authorization: Bearer sk-your-key"
python
from dailyai import AgentOS

client = AgentOS(api_key="sk-your-key")
agents = client.agents.list()
for agent in agents:
    print(f"{agent.id}: {agent.name}")
javascript
const response = await fetch('https://api.dailyai.dev/v1/agents', {
  headers: { 'Authorization': 'Bearer sk-your-key' },
});
const data = await response.json();
console.log(data.agents);

List Signals

GET /v1/signals

Retrieve a paginated list of signals generated by your agents.

Authentication

Requires a valid API key with signals:read scope.

Query Parameters

NameTypeRequiredDescription
assetstringOptionalFilter by asset ticker
strategystringOptionalFilter by strategy name
directionstringOptionallong or short
min_confidencenumberOptionalMinimum confidence threshold (0.0 – 1.0)
limitintegerOptionalResults per page (1–100). Default: 25
offsetintegerOptionalPagination offset. Default: 0
sincestringOptionalISO 8601 datetime — return signals after this time

Response (200 OK)

json
{
  "signals": [
    {
      "signal_id": "sig_abc123",
      "agent_id": "trading",
      "asset": "AAPL",
      "strategy": "momentum",
      "direction": "long",
      "confidence": 0.87,
      "entry_price": 198.45,
      "created_at": "2026-03-25T14:30:00Z"
    }
  ],
  "total": 142,
  "limit": 25,
  "offset": 0,
  "has_more": true
}

Error Responses

StatusDescription
400Invalid query parameters
401Unauthorized
429Rate limit exceeded

Code Examples

bash
curl "https://api.dailyai.dev/v1/signals?asset=AAPL&min_confidence=0.8&limit=10" \
  -H "Authorization: Bearer sk-your-key"
python
signals = client.signals.list(
    asset="AAPL",
    min_confidence=0.8,
    limit=10
)
for s in signals:
    print(f"{s.direction} {s.asset} @ {s.confidence}")
javascript
const url = new URL('https://api.dailyai.dev/v1/signals');
url.searchParams.set('asset', 'AAPL');
url.searchParams.set('min_confidence', '0.8');

const response = await fetch(url, {
  headers: { 'Authorization': 'Bearer sk-your-key' },
});
const data = await response.json();
console.log(data.signals);

Weather Signals

GET /v1/signals/weather

Retrieve weather-based trading signals. These signals identify market opportunities driven by weather patterns, including commodity impacts, energy demand shifts, and agricultural forecasts.

Authentication

Requires a valid API key with signals:read scope.

Query Parameters

NameTypeRequiredDescription
regionstringOptionalGeographic region: us, eu, asia, global
commoditystringOptionalFilter by commodity: natural_gas, wheat, corn, oil
severitystringOptionalWeather event severity: low, medium, high, extreme
limitintegerOptionalResults per page. Default: 25

Response (200 OK)

json
{
  "signals": [
    {
      "signal_id": "wsig_def456",
      "type": "weather_arbitrage",
      "commodity": "natural_gas",
      "region": "us",
      "direction": "long",
      "confidence": 0.92,
      "weather_event": {
        "type": "cold_snap",
        "severity": "high",
        "location": "Northeast US",
        "forecast_date": "2026-03-28",
        "temperature_deviation": -12.5
      },
      "expected_impact": "+8.3% price increase over 5 days",
      "created_at": "2026-03-25T10:00:00Z"
    }
  ],
  "total": 7
}

Error Responses

StatusDescription
401Unauthorized
429Rate limit exceeded

Code Examples

bash
curl "https://api.dailyai.dev/v1/signals/weather?region=us&commodity=natural_gas" \
  -H "Authorization: Bearer sk-your-key"
python
weather_signals = client.signals.weather(
    region="us",
    commodity="natural_gas"
)
for ws in weather_signals:
    print(f"{ws.commodity}: {ws.expected_impact}")
javascript
const response = await fetch(
  'https://api.dailyai.dev/v1/signals/weather?region=us',
  { headers: { 'Authorization': 'Bearer sk-your-key' } }
);
const data = await response.json();
console.log(data.signals);

Login

POST /v1/auth/login

Authenticate with email and password to receive a JWT access token. No API key required for this endpoint.

Authentication

None required.

Request Body

NameTypeRequiredDescription
emailstringRequiredYour account email address
passwordstringRequiredYour account password

Request Example

json
{
  "email": "[email protected]",
  "password": "your-password"
}

Response (200 OK)

json
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "bearer",
  "expires_in": 3600,
  "refresh_token": "rt_abc123def456"
}

Error Responses

StatusDescription
400Missing email or password
401Invalid credentials
429Too many login attempts — account temporarily locked

Code Examples

bash
curl -X POST https://api.dailyai.dev/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "your-password"}'
python
import requests

response = requests.post(
    "https://api.dailyai.dev/v1/auth/login",
    json={"email": "[email protected]", "password": "your-password"}
)
token = response.json()["access_token"]
javascript
const response = await fetch('https://api.dailyai.dev/v1/auth/login', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    email: '[email protected]',
    password: 'your-password',
  }),
});
const { access_token } = await response.json();

Create API Key

POST /v1/auth/api-key

Generate a new API key. Requires JWT authentication (use the /auth/login endpoint first).

Authentication

Requires a valid JWT access token (Bearer token from login).

Request Body

NameTypeRequiredDescription
namestringRequiredA human-readable name for the key
scopesstring[]OptionalPermission scopes. Default: all scopes. Options: agents:read, agents:run, signals:read, webhooks:manage
expires_inintegerOptionalExpiry in seconds. Default: never expires

Response (201 Created)

json
{
  "key_id": "key_xyz789",
  "api_key": "sk-live-abc123def456ghi789",
  "name": "production-key",
  "scopes": ["agents:read", "agents:run", "signals:read"],
  "created_at": "2026-03-25T12:00:00Z",
  "expires_at": null
}
Important: The api_key value is only returned once at creation time. Store it securely — you won't be able to retrieve it again.

Error Responses

StatusDescription
400Missing key name or invalid scopes
401Unauthorized — invalid or expired JWT
409Key name already exists

Code Examples

bash
curl -X POST https://api.dailyai.dev/v1/auth/api-key \
  -H "Authorization: Bearer eyJhbGciOi..." \
  -H "Content-Type: application/json" \
  -d '{"name": "production-key", "scopes": ["agents:run", "signals:read"]}'
python
import requests

response = requests.post(
    "https://api.dailyai.dev/v1/auth/api-key",
    headers={"Authorization": f"Bearer {token}"},
    json={
        "name": "production-key",
        "scopes": ["agents:run", "signals:read"]
    }
)
api_key = response.json()["api_key"]
print(f"Save this key: {api_key}")
javascript
const response = await fetch('https://api.dailyai.dev/v1/auth/api-key', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'production-key',
    scopes: ['agents:run', 'signals:read'],
  }),
});
const { api_key } = await response.json();

WebSocket — Dashboard Stream

WS wss://api.dailyai.dev/ws/dashboard

Real-time streaming connection for the dashboard. Receives live signal updates, agent status changes, and system notifications as they happen.

Authentication

Pass your API key as a query parameter: ?api_key=sk-your-key or in the first message after connection.

Connection

text
wss://api.dailyai.dev/ws/dashboard?api_key=sk-your-key

Message Types (Server → Client)

TypeDescriptionPayload
signal.newA new signal was generatedFull signal object
agent.statusAgent status changed (running, completed, error)Agent ID + status
system.notificationSystem alert or maintenance noticeMessage + severity
heartbeatKeep-alive ping (every 30s)Timestamp

Example Messages

json
// signal.new
{
  "type": "signal.new",
  "data": {
    "signal_id": "sig_realtime001",
    "asset": "TSLA",
    "direction": "short",
    "confidence": 0.76,
    "strategy": "mean_reversion"
  },
  "timestamp": "2026-03-25T15:45:12Z"
}

// agent.status
{
  "type": "agent.status",
  "data": {
    "agent_id": "trading",
    "status": "completed",
    "run_id": "run_xyz789"
  },
  "timestamp": "2026-03-25T15:45:13Z"
}

// heartbeat
{
  "type": "heartbeat",
  "timestamp": "2026-03-25T15:45:30Z"
}

Client Messages

You can send subscription filters to receive only specific event types:

json
{
  "action": "subscribe",
  "channels": ["signal.new", "agent.status"],
  "filters": {
    "assets": ["AAPL", "TSLA", "BTC-USD"]
  }
}

Code Examples

python
import asyncio
from dailyai import AgentOS

async def stream_dashboard():
    client = AgentOS(api_key="sk-your-key")

    async for event in client.dashboard.stream():
        if event.type == "signal.new":
            print(f"New signal: {event.data.asset} {event.data.direction}")
        elif event.type == "agent.status":
            print(f"Agent {event.data.agent_id}: {event.data.status}")

asyncio.run(stream_dashboard())
javascript
const ws = new WebSocket('wss://api.dailyai.dev/ws/dashboard?api_key=sk-your-key');

ws.onopen = () => {
  // Subscribe to specific channels
  ws.send(JSON.stringify({
    action: 'subscribe',
    channels: ['signal.new', 'agent.status'],
  }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  switch (msg.type) {
    case 'signal.new':
      console.log('New signal:', msg.data);
      break;
    case 'agent.status':
      console.log('Agent status:', msg.data);
      break;
  }
};