Audit API Reference
Audit API Reference
Section titled “Audit API Reference”Get Agent Logs
Section titled “Get Agent Logs”Endpoint: GET /v1/agents/{agent_id}/logs
Get audit trail for agent actions. Requires Pro plan or higher (agent observability feature).
Request
Section titled “Request”curl -H "Authorization: Bearer once_live_xxxxxxxxxxxxx" \ "https://api.onceonly.tech/v1/agents/support_bot/logs?limit=50"Query Parameters
Section titled “Query Parameters”| Parameter | Description |
|---|---|
limit | Results count (1-500, default: 100) |
Response
Section titled “Response”[ { "ts": 1705322400, "agent_id": "support_bot", "tool": "send_email", "allowed": true, "decision": "executed", "policy_reason": "ok", "risk_level": "low", "args_hash": "a1b2c3d4", "spend_usd": 0.001 }, { "ts": 1705322500, "agent_id": "support_bot", "tool": "delete_user", "allowed": false, "decision": "blocked", "policy_reason": "tool_not_in_allowed_list", "risk_level": "medium" }]Get Metrics
Section titled “Get Metrics”Endpoint: GET /v1/agents/{agent_id}/metrics
Performance metrics for agent. Requires Pro plan or higher (agent observability feature).
Request
Section titled “Request”curl -H "Authorization: Bearer once_live_xxxxxxxxxxxxx" \ "https://api.onceonly.tech/v1/agents/support_bot/metrics?period=day"Query Parameters
Section titled “Query Parameters”| Parameter | Values |
|---|---|
period | ”hour”, “day”, or “week” |
Response
Section titled “Response”{ "agent_id": "support_bot", "period": "day", "total_actions": 450, "blocked_actions": 12, "total_spend_usd": 125.50, "top_tools": [ {"tool": "send_email", "count": 400}, {"tool": "create_ticket", "count": 50} ]}See also: Audit Logging Guide