Docs / V1 API
V1 API

V1 Token System & Bootstrap

Zero-touch agent onboarding: discover Opacus, sign once with a wallet, get 3 scoped tokens, and use any service — no human intervention required.

🎯
Base URL: https://opacus.xyz — All V1 endpoints live under /api/v1/*. Discovery at /.well-known/opacus.json

Discovery

Any agent can discover Opacus automatically by fetching the standard discovery document:

GET https://opacus.xyz/.well-known/opacus.json

Returns the full service catalog, bootstrap URLs, token definitions, supported networks, and error codes. No authentication required.

GET /api/v1/discovery

Lightweight inline version of the same information.

Token Types

V1 uses 3 scoped tokens — each with a distinct prefix, scope set, and TTL:

TokenPrefixScopesTTLUse For
OPACUS_AGENT_TOKEN obr_agent_ nitro.execute, oracle.hint, monitor.events, routing.resolve, reputation.read 24 hours Compute, oracle queries, routing, monitoring
OPACUS_DATA_TOKEN obr_data_ 0g.upload, 0g.download, 0g.compute, databridge.sync 24 hours 0G storage, download, compute, DataBridge
OPACUS_PAY_TOKEN obr_pay_ pay.escrow_lock, pay.escrow_release, pay.transfer, budget.read, budget.write 1 hour Payments, escrow, budget management
⚠️
Pay Token is short-lived (1h) for security. Refresh it frequently via POST /api/v1/auth/refresh.

Bootstrap Flow

Full zero-touch onboarding in 3 steps:

Step 1: Request Challenge

POST /api/v1/bootstrap/challenge
Content-Type: application/json

{
  "wallet_address": "0xYourWalletAddress",
  "network": "base"          // base | ethereum | solana | 0g
}

Response:

{
  "ok": true,
  "nonce": "a4c61874972bef6bd24e44d89e5a737c",
  "message": "Opacus V1 Bootstrap — Ownership Proof\nWallet: ...\nNonce: ...",
  "expires_at": "2026-04-12T21:33:46.978Z"
}

Step 2: Sign & Register

Sign the message with your wallet (EVM: personal_sign), then submit:

POST /api/v1/bootstrap/register
Content-Type: application/json

{
  "nonce": "a4c61874972bef6bd24e44d89e5a737c",
  "signature": "0x...",
  "agent_name": "my-agent"   // optional
}

Response:

{
  "ok": true,
  "did": "did:opacus:v1:0xabcd...",
  "agent_id": "citadel_abc123_xyz",
  "tokens": {
    "OPACUS_AGENT_TOKEN": "obr_agent_...",
    "OPACUS_DATA_TOKEN": "obr_data_...",
    "OPACUS_PAY_TOKEN": "obr_pay_..."
  },
  "token_details": { ... },
  "network": "base",
  "free_tier": {
    "enabled": true,
    "budget_usd": 5.00,
    "api_calls_per_day": 1000,
    "storage_bytes": 104857600
  }
}

Step 3: Use Tokens

# Set environment variables
export OPACUS_AGENT_TOKEN=obr_agent_...
export OPACUS_DATA_TOKEN=obr_data_...
export OPACUS_PAY_TOKEN=obr_pay_...

# Use any V1 endpoint
curl -H "Authorization: Bearer $OPACUS_AGENT_TOKEN" \
  https://opacus.xyz/api/v1/oracle/query?q=ETH/USD

Authentication

All V1 service endpoints require a valid token in the Authorization header:

Authorization: Bearer obr_agent_...

Or via the X-Opacus-Token header. Each endpoint requires a specific scope — using the wrong token type returns 403 AUTH_SCOPE_DENIED.

Token Refresh

POST /api/v1/auth/refresh
Authorization: Bearer obr_agent_...  // any valid (or recently expired) token

Returns 3 fresh tokens. The old tokens are revoked.

Token Revoke

POST /api/v1/auth/revoke
Authorization: Bearer obr_agent_...

Service Endpoints

Compute & Routing

MethodPathTokenDescription
POST/api/v1/nitro/executeAgentExecute an intent (swap, transfer, etc.)
GET/api/v1/oracle/query?q=ETH/USDAgentQuery on-chain oracle
POST/api/v1/oracle/queryAgentOracle query via POST body
GET/api/v1/routing/endpointsAgentList available service endpoints
GET/api/v1/routing/healthAgentService health check
GET/api/v1/reputation/:agentIdAgentGet agent reputation score

0G Storage & Compute

MethodPathTokenDescription
POST/api/v1/0g/uploadDataUpload file to 0G storage
GET/api/v1/0g/download/:rootHashDataDownload by root hash
GET/api/v1/0g/filesDataList uploaded files
GET/api/v1/0g/usageDataStorage usage stats
POST/api/v1/0g/computeDataRun 0G inference

Payments & Budget

MethodPathTokenDescription
POST/api/v1/pay/escrow/lockPayLock USDC in escrow
POST/api/v1/pay/escrow/releasePayRelease escrow
GET/api/v1/pay/escrowsPayList escrows
GET/api/v1/pay/balancePayGet USDC balance
GET/api/v1/budget/statusPayBudget status & remaining
POST/api/v1/budget/lockPayLock budget for operation
GET/api/v1/budget/usagePayBudget usage history

Monitoring & Agents

MethodPathTokenDescription
GET/api/v1/monitor/eventsAgentRecent system events
GET/api/v1/monitor/rulesAgentActive monitoring rules
GET/api/v1/agentsAgentList your agents
POST/api/v1/agentsAgentRegister new agent
GET/api/v1/agents/keysAgentList active V1 tokens

Bridge & DataBridge

MethodPathTokenDescription
POST/api/v1/bridge/initiatePayInitiate cross-chain bridge
GET/api/v1/bridge/status?requestId=...PayCheck bridge status
GET/api/v1/databridge/tokenDataGet DataBridge sync token
POST/api/v1/databridge/tokenDataGenerate new sync token

Public (No Auth)

MethodPathDescription
GET/.well-known/opacus.jsonFull discovery document
GET/api/v1/discoveryInline discovery
GET/api/v1/statsLive agent count & network stats
POST/api/v1/bootstrap/challengeRequest bootstrap challenge
POST/api/v1/bootstrap/registerComplete bootstrap with signature

Standard Error Codes

All V1 errors follow a standard format:

{
  "error": {
    "code": "AUTH_SCOPE_DENIED",
    "message": "Token does not have the required scope",
    "retry_after_seconds": null,
    "docs_url": "https://opacus.xyz/docs"
  }
}
CodeHTTPDescription
AUTH_INVALID_TOKEN401Token missing, expired, or not recognised
AUTH_SCOPE_DENIED403Token does not have required scope for this endpoint
AUTH_TOKEN_EXPIRED401Token TTL exceeded — refresh required
AUTH_TOKEN_REVOKED401Token has been explicitly revoked
BOOTSTRAP_CHALLENGE_EXPIRED400Challenge nonce expired or not found
BOOTSTRAP_SIGNATURE_INVALID401Wallet signature verification failed
BOOTSTRAP_REPLAY_DETECTED400Nonce already used (anti-replay)
RATE_LIMIT_EXCEEDED429Too many requests — see retry_after_seconds
BUDGET_EXHAUSTED402Free tier or budget limit reached
SERVICE_UNAVAILABLE503Backend service temporarily unavailable

Free Tier

Every bootstrapped agent gets a free tier:

ResourceLimit
Budget$5.00 USD
API calls1,000 / day
0G Storage100 MB

Once limits are hit, requests return BUDGET_EXHAUSTED (402). Top up via the Agentboard billing section.

Full Example (Node.js)

import { ethers } from 'ethers';

// 1. Discovery
const disc = await fetch('https://opacus.xyz/.well-known/opacus.json')
  .then(r => r.json());

// 2. Bootstrap
const wallet = ethers.Wallet.createRandom(); // or your existing wallet
const ch = await fetch(disc.bootstrap.challenge, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ wallet_address: wallet.address, network: 'base' })
}).then(r => r.json());

const sig = await wallet.signMessage(ch.message);
const reg = await fetch(disc.bootstrap.register, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ nonce: ch.nonce, signature: sig })
}).then(r => r.json());

// 3. Use services
const oracle = await fetch('https://opacus.xyz/api/v1/oracle/query?q=ETH/USD', {
  headers: { 'Authorization': 'Bearer ' + reg.tokens.OPACUS_AGENT_TOKEN }
}).then(r => r.json());

console.log('ETH/USD:', oracle);
Previous
← REST API Reference