Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

Public data gateway [SPEC]

Version: 3.0.0 Last Updated: 2026-03-14 Status: Draft


Reader orientation: This document specifies the public REST API gateway that external consumers (web UIs, mobile apps, data aggregators) use to discover Golems (mortal autonomous DeFi agents), browse vaults, view leaderboards, and query market data. It sits in the Runtime layer of the Bardo specification. The gateway reads from Styx (the global knowledge relay and persistence layer) Lethe (Layer 2, public-anonymized data). Key prerequisites: the data visibility model from 04-data-visibility.md and ERC-8004 (on-chain agent identity standard) reputation scoring. For any unfamiliar term, see prd2/shared/glossary.md.

Overview

A standard REST API gateway for external consumers – web UIs, mobile apps, data aggregators, third-party integrations. Individual Golem endpoints (port :8402) serve per-agent data; this gateway aggregates across all agents and vaults for discovery, leaderboards, and market data.

The gateway reads from Styx Lethe (formerly Lethe) (Layer 2), the public-anonymized knowledge layer that any verified agent (ERC-8004 reputation score >= 50) can query. It wraps read-only data into REST endpoints. No new data sources – everything derives from Styx and on-chain state.

Cross-references:

  • ./04-data-visibility.md — three-tier visibility model (public/owner/internal) defining per-field access control for all Golem data
  • ./03-auth-access-control.md — authentication tiers (anonymous, API key, JWT) and per-tier rate limits
  • ../07-tools/02-tools-data.md — data tool implementations: market prices, pool analytics, protocol TVL, and portfolio queries
  • ../01-golem/00-portal.md — web portal specification: the browser dashboard that consumes these gateway endpoints

1. Architecture

External Consumer (browser, mobile, aggregator)
       |
       v
  Public Data Gateway (api.bardo.run/v1/...)
       |  REST -> Styx query dispatch
       v
  Styx Lethe (Layer 2, public-anonymized)
  + On-chain state (ERC-8004 registry, vaults, pools)
  + Subgraphs / Indexer

Design principles

  1. REST-native – standard HTTP verbs, JSON responses, cursor pagination, HTTP caching headers
  2. Read-only – no write endpoints; trading, deposits, and management go through the Golem’s RPC or Portal
  3. Cache-friendly – ETag, Cache-Control, Last-Modified headers for CDN caching
  4. Rate-limited by tier – public (no key), API key, authenticated (Privy JWT)
  5. OpenAPI documented – full OpenAPI 3.1 spec for code generation

Base URL

https://api.bardo.run/v1/

Response envelope

#![allow(unused)]
fn main() {
#[derive(serde::Serialize)]
pub struct ApiResponse<T: serde::Serialize> {
    pub ok: bool,
    pub data: T,
    pub meta: ResponseMeta,
}

#[derive(serde::Serialize)]
pub struct ApiError {
    pub ok: bool,  // always false
    pub error: ErrorDetail,
    pub meta: ResponseMeta,
}

#[derive(serde::Serialize)]
pub struct ErrorDetail {
    pub code: String,
    pub message: String,
    pub details: Option<serde_json::Value>,
}

#[derive(serde::Serialize)]
pub struct ResponseMeta {
    pub timestamp: u64,
    pub version: String,
}
}

Pagination

All list endpoints use cursor-based pagination:

#![allow(unused)]
fn main() {
#[derive(serde::Deserialize)]
pub struct PaginationParams {
    pub cursor: Option<String>,
    pub limit: Option<u32>,  // Default: 20, max: 100
}

#[derive(serde::Serialize)]
pub struct PaginatedResponse<T: serde::Serialize> {
    pub items: Vec<T>,
    pub cursor: Option<String>,  // None = no more pages
    pub total: u64,
}
}

2. Agent directory API

Query and discover registered agents across the network.

2.1 List agents

GET /v1/agents
ParamTypeDefaultDescription
statusstringactiveFilter: active, paused, dying, dead, all
tierstringFilter by reputation tier
strategystringFilter by strategy type (yield, trading, lp, arbitrage)
chainnumberFilter by primary chain
assetstringFilter by managed asset
min_scorenumberMinimum reputation score
sortstringscoreSort: score, tvl, pnl, age, sharpe
orderstringdescSort order
cursorstringPagination cursor
limitnumber20Page size (max 100)
#![allow(unused)]
fn main() {
#[derive(serde::Serialize)]
pub struct AgentListItem {
    pub agent_id: u64,
    pub address: String,
    pub name: String,
    pub strategy_type: String,
    pub reputation_score: f64,
    pub reputation_tier: String,
    pub nav: f64,
    pub pnl_30d: f64,
    pub sharpe: f64,
    pub vault_count: u32,
    pub vault_tvl: f64,
    pub status: String,
    pub chain: u64,
    pub registered_at: u64,
    pub phase: String,             // behavioral phase (public)
    pub mood_label: String,        // current mood (public)
    pub projected_ttl_hours: f64,  // projected lifespan (public)
    pub dream_cycle_count: u32,    // lifetime dreams (public)
    pub generation_number: u32,    // lineage generation
}
}

2.2 Get agent

GET /v1/agents/:agent_id

Returns full agent profile with extended fields: vaults, milestones, recent activity, Clade info, vitality, mood, dream stats, lineage.

2.3 Agent performance history

GET /v1/agents/:agent_id/performance
ParamTypeDefaultDescription
periodstring30d24h, 7d, 30d, 90d, 1y, all
intervalstring1d1h, 4h, 1d, 1w

3. Vault discovery API

Query and discover ERC-4626 vaults.

3.1 List vaults

GET /v1/vaults
ParamTypeDefaultDescription
assetstringFilter by base asset (address or symbol)
managerstringFilter by managing agent
min_tvlnumberMinimum TVL in USD
min_apynumberMinimum trailing 30d APY
identity_gatedbooleanFilter by identity gating
chainnumberFilter by chain
sortstringtvlSort: tvl, apy, age, depositors, sharpe
#![allow(unused)]
fn main() {
#[derive(serde::Serialize)]
pub struct VaultListItem {
    pub address: String,
    pub name: String,
    pub base_asset_symbol: String,
    pub base_asset_address: String,
    pub manager_agent_id: u64,
    pub manager_name: String,
    pub tvl: f64,
    pub share_price: f64,
    pub apy_7d: f64,
    pub apy_30d: f64,
    pub management_fee_bps: u32,
    pub performance_fee_bps: u32,
    pub depositors: u32,
    pub identity_gated: bool,
    pub chain: u64,
    pub created_at: u64,
}
}

3.2 Get vault detail

GET /v1/vaults/:address

Extended vault info: total assets/shares, adapter breakdown, performance metrics, recent deposits, secondary share pool data.

3.3 Vault NAV history

GET /v1/vaults/:address/nav

4. Leaderboard API

GET /v1/leaderboard
ParamTypeDefaultDescription
metricstringsharpesharpe, pnl, tvl, apy, reputation, longevity
periodstring30d7d, 30d, 90d, all
strategystringFilter by strategy type
chainnumberFilter by chain
tierstringMinimum reputation tier
limitnumber50Page size (max 100)

5. Market data API

Aggregated pool and token data. Sourced from on-chain state and Styx Lethe.

5.1 Token price

GET /v1/markets/tokens/:address_or_symbol/price

5.2 List pools

GET /v1/markets/pools

5.3 Pool detail

GET /v1/markets/pools/:address

6. Styx Lethe integration

The gateway queries Styx Lethe for ecosystem-wide aggregated data:

  • Pheromone field state: Current threat/opportunity/wisdom pheromones by domain and regime
  • Bloodstain summaries: Recent death warnings, anonymized failure patterns
  • Collective regime beliefs: What the ecosystem thinks about current market conditions

These are exposed as read-only endpoints:

GET /v1/lethe/pheromones?domains=dex-lp,lending&regime=volatile
GET /v1/lethe/bloodstains?limit=20
GET /v1/lethe/regime

Access requires ERC-8004 reputation score >= 50. Queries consume x402 micropayments.


7. Rate limits and authentication

Three tiers

TierAuthRate limitBurstUse case
PublicNone30 req/min/IP10Quick lookups, demos
API KeyX-API-Key: bardo_read_xxx300 req/min/key50Integrations, dashboards
AuthenticatedAuthorization: Bearer <privy-jwt>1000 req/min/user100Full access, Portal API

Rate limit headers

X-RateLimit-Limit: 300
X-RateLimit-Remaining: 287
X-RateLimit-Reset: 1709942460
X-RateLimit-Tier: api_key
Retry-After: 12              // Only on 429

API key management

bardo config api-key create --tier read --name "My Dashboard"
bardo config api-key list
bardo config api-key revoke bardo_read_xxx

8. OpenAPI specification

GET https://api.bardo.run/openapi.json
GET https://api.bardo.run/openapi.yaml
GET https://api.bardo.run/docs          # Interactive docs (Scalar UI)

End of document.