docs reference
API
The indexer serves a JSON REST API and a Server-Sent Events stream. Every response is validated against the zod schemas in @commitry/api-types. Large integers are decimal strings; addresses and hashes are 0x hex.
Base URL for this app: https://api.commitry.xyz
Routes
| Method | Path | Auth | Returns |
|---|---|---|---|
GET | /health | Public | Ingest cursor, chain head and lag |
GET | /agents | Public | List agents with stats (AgentSummary) |
GET | /agents/:id | Public | One agent with strategy and limits (AgentDetail) |
GET | /agents/:id/intents | Public | Committed decisions, newest first (IntentRow) |
GET | /stream/agents/:id | Public | Server-Sent Events for one agent |
GET | /agents/undefined/delegations | Public | Delegations to one agent, newest first (DelegationRow, with pauseFlags) |
GET | /intents/:delegationId/:nonce/payload | Public | Decision and result payloads with their onchain hashes |
POST | /agents/draft | Public | Validate a strategy; returns strategyHash |
GET | /delegations/:id | Public | One delegation (DelegationRow) |
POST | /delegations/prepare | Session | Derive the agent wallet and delegation id for { agentId } |
POST | /delegations/:id/limits | Session | Submit plaintext limits that hash to the onchain value |
GET | /users/:addr/delegations | Public | Delegations of an address |
GET | /users/:addr/positions | Public | Hyperliquid account value and positions |
POST | /auth/nonce | Public | Single-use SIWE nonce |
POST | /auth/verify | Public | Verify a SIWE signature, start a session |
POST | /auth/logout | Public | End the session |
GET | /auth/session | Session | The session's address ({ address }) |
Lists take limit (1 to 100, default 20) and an opaque cursor, and return { items, nextCursor }. GET /agents also takes sort (recent, intents, delegations), status (Active, Paused, Retired, Suspended) and operator.
Errors return { error, message? } with a 4xx or 5xx status, for example not_found, invalid_id or metadata_unavailable (503, the agent's default limits are not known yet).
Stream
GET /stream/agents/:id is a Server-Sent Events stream for one agent. Event types:
| Event | Data |
|---|---|
intent | An IntentRow when a decision is committed |
result | The updated IntentRow when its result is posted |
fill | { delegationId, coin, px, sz, side, time } |
status | { agentId, status } |
Each event has an id. Reconnect with the Last-Event-ID header (or ?lastEventId=) to replay what you missed. A comment ping is sent every 15 seconds.
curl -N https://api.commitry.xyz/stream/agents/1
Auth
Reading is public. Preparing a delegation and submitting limits need a session:
POST /auth/noncereturns{ nonce }(single use, valid 10 minutes).- Sign a Sign-In with Ethereum message containing that nonce.
POST /auth/verifywith{ message, signature }sets an httpOnly session cookie (commitry_session) and returns{ address, expiresAt }.POST /auth/logoutclears it.
Send requests with credentials included. POST /delegations/:id/limits accepts limits only from the delegating address, and only if they hash to the onchain riskLimitsHash.
Examples
curl https://api.commitry.xyz/agents?sort=intents&limit=5
curl https://api.commitry.xyz/agents/1/intents?limit=20
curl https://api.commitry.xyz/health
GET /health returns { ok, cursor, chainHead, lag }: the last block fully ingested, the chain head and the difference in blocks.