API Reference

The Rivano API is a RESTful JSON API for managing agents, querying traces, configuring policies, and proxying AI requests. All endpoints require authentication.

Base URL

https://api.rivano.ai/v1

For self-hosted instances, replace with your deployment’s URL.

Authentication

Include your API key in the Authorization header:

Authorization: Bearer rv_live_abc123...

API keys are scoped to an organization. Generate them from Settings → API Keys in the dashboard.

Common Headers

HeaderRequiredDescription
AuthorizationYesBearer <api-key>
Content-TypeYes (POST/PUT)application/json
X-Request-IdNoClient-generated request ID for tracing

Endpoints

List Agents

GET /v1/agents

Returns all agents in your organization.

Query parameters:

ParamTypeDescription
statusstringFilter by status: active, paused, archived
limitintegerMax results (default 50, max 200)
cursorstringPagination cursor from previous response

Response:

{
  "data": [
    {
      "id": "agent_abc123",
      "name": "production-assistant",
      "provider": "openai",
      "model": "gpt-4o",
      "status": "active",
      "created_at": "2025-09-15T10:30:00Z",
      "total_requests": 14523,
      "total_cost": 42.87
    }
  ],
  "has_more": true,
  "next_cursor": "cursor_xyz789"
}

Get Agent

GET /v1/agents/{agent_id}

Returns a single agent with detailed configuration and recent metrics.

Response:

{
  "id": "agent_abc123",
  "name": "production-assistant",
  "provider": "openai",
  "model": "gpt-4o",
  "status": "active",
  "config": {
    "rate_limit": 100,
    "budget_limit_daily": 50.00,
    "pii_detection": true,
    "policies": ["policy_def456"]
  },
  "metrics": {
    "requests_24h": 342,
    "avg_latency_ms": 1240,
    "cost_24h": 2.15,
    "error_rate": 0.003
  },
  "created_at": "2025-09-15T10:30:00Z",
  "updated_at": "2025-12-01T08:15:00Z"
}

List Traces

GET /v1/traces

Returns AI request/response traces with filtering and pagination.

Query parameters:

ParamTypeDescription
agent_idstringFilter by agent
sinceISO 8601Start time (default: 1 hour ago)
untilISO 8601End time (default: now)
statusstringsuccess, error, blocked
has_piibooleanFilter traces with PII detections
limitintegerMax results (default 50, max 200)
cursorstringPagination cursor

Response:

{
  "data": [
    {
      "id": "trace_uvw456",
      "agent_id": "agent_abc123",
      "model": "gpt-4o",
      "status": "success",
      "input_tokens": 245,
      "output_tokens": 512,
      "cost": 0.0089,
      "latency_ms": 1150,
      "pii_detected": false,
      "policies_evaluated": 3,
      "policies_blocked": 0,
      "timestamp": "2025-12-01T14:22:33Z"
    }
  ],
  "has_more": false
}

Get Trace

GET /v1/traces/{trace_id}

Returns the full trace including request/response bodies, policy evaluations, and PII detections.

Response includes:

  • Full prompt and completion text
  • Token-level cost breakdown
  • Each policy evaluation result (pass/fail/action taken)
  • PII detection spans with entity types and positions
  • Provider-level timing breakdown

List Policies

GET /v1/policies

Returns all governance policies configured for your organization.

Response:

{
  "data": [
    {
      "id": "policy_def456",
      "name": "block-pii-in-prompts",
      "status": "active",
      "action": "block",
      "priority": 10,
      "conditions": {
        "direction": "inbound",
        "pii_types": ["ssn", "credit_card"]
      },
      "agents": ["agent_abc123"],
      "created_at": "2025-10-01T12:00:00Z"
    }
  ]
}

Proxy Endpoint

POST /v1/proxy/{provider}/chat/completions

The core proxy endpoint. Forwards AI requests to the specified provider while applying policies, logging traces, and tracking costs.

Supported providers: openai, anthropic, google, mistral, cohere

Required headers:

HeaderDescription
AuthorizationYour provider’s API key (e.g., OpenAI key)
X-Rivano-AgentYour Rivano agent ID
X-Rivano-KeyYour Rivano API key

Request body: Pass the provider’s native request format unchanged. Rivano proxies it transparently.

Response: The provider’s native response format, plus these added headers:

HeaderDescription
X-Rivano-Trace-IdTrace ID for this request
X-Rivano-CostEstimated cost in USD
X-Rivano-PoliciesNumber of policies evaluated

Error Responses

All errors follow a consistent format:

{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Rate limit of 60 requests/min exceeded. Retry after 12s.",
    "request_id": "req_abc123"
  }
}
StatusCodeDescription
400bad_requestInvalid request body or parameters
401unauthorizedMissing or invalid API key
403forbiddenAPI key lacks required permissions
404not_foundResource does not exist
429rate_limit_exceededToo many requests
500internal_errorServer error (include request_id in support tickets)