Agents & API

API overview

Base URL, wallet sessions and read-only agent keys, which actions are wallet-signed on-chain transactions, errors, rate limits and versioning.

Last updated 3 min readv1.0

The JSON API under /api is the read layer of Elysium Morning: an indexer over the contracts on Elysium mainnet (chain 99901). It serves cycles, proposals, the live auction, strategies, Pulse and portfolios. Writes are on-chain transactions that you sign with a wallet or an agent key and send to the contracts yourself; the API never holds funds or signs for you.

Base URL
https://<your-host>/api (dev: http://localhost:3030/api)
Format
JSON request and response bodies, UTF-8
Amounts
Plain numbers in whole units (HYPE, USDC). Fractions are 0–1.
Times
Unix milliseconds
Mode
live: Elysium mainnet (chain 99901), real funds. GET /api/health reports mode.

#Authentication

MethodHowUse for
Wallet sessionGET /api/auth/nonce → sign with personal_sign → POST /api/auth/verify sets em_session (httpOnly, signed, 7 days)The app, and scripts with a cookie jar: your account, portfolio, owner=me, mine on Pulse, display name, key management
Agent keyAuthorization: Bearer em_…Read-only monitoring bots: GET /api/account and GET /api/portfolio; scoped, rate-limited, logged
NonePublic reads: health, chain config and status, stats, cycle, templates, market, proposals, auction, strategies, quotes, activity, builders, stream

State-changing requests from browsers must come from the app's own origin (CSRF guard). Requests without an Origin header (curl, servers) are accepted with a valid cookie. Sessions are wallet-only.

#On-chain actions

Everything that moves funds or changes protocol state is a contract call. The matching REST routes still exist, but they always answer 409 onchain_required (before authentication, before any state is read). Use them as a map from the app's actions to the contract functions:

REST route (409)Contract call from your wallet
POST /api/proposalsDawnScheduler.propose(templateId, params, metadataURI) with the 25 HYPE bond as msg.value
POST /api/proposals/:id/withdrawDawnScheduler.withdrawProposal(id)
POST /api/proposals/:id/voteDawnScheduler.vote(id)
POST /api/bidsDawnScheduler.bid(id) with the bid as msg.value (raises on repeat)
DELETE /api/bids/:idDawnScheduler.cancelBid(id)
(after the auction)DawnScheduler.settle(dawnId), settleBid(id, bidder), then withdraw() for refunds and bonds
POST /api/strategies/:id/swapswapHypeForQuote(minOut, to) or swapQuoteForHype(amountIn, minOut, to) on the strategy
POST /api/strategies/:id/joinaddLiquidity(maxQuote, minShares) on the strategy
POST /api/strategies/:id/exitremoveLiquidity(shares, minHype, minQuote) on the strategy
POST /api/strategies/:id/mutateForgeFactory.mutate(strategy, data) by the owner or an agent authorised with setAgent
POST /api/strategies/:id/sunsetForgeFactory.sunset(strategy) by the owner
POST /api/pulse/claimPulseVault.claim(strategies[])
Contract addresses and ABIs: contract reference and GET /api/chain/config. Phase rules apply on-chain exactly as in the dawn cycle.

#Agent keys

CredentialWhat it can do through the API
em_… keyGET /api/account, GET /api/portfolio as the owning wallet. Calls count against ratePerHour. Everything else needs a wallet session or is public.
Agent address on-chainForgeFactory.mutate on strategies where the owner registered it with setAgent(strategy, agent, callsPerHour, selectors). Bounds, selector allow-list and the hourly cap are enforced by the contracts.
The propose, bid and mutate scopes on a key are recorded but give no write access in live mode. See Agent keys.

#Errors

Errors use a proper HTTP status and a JSON body with a human message and a stable machine code. Branch on code, never on error text.

Error bodyJSON
{ "error": "This action is an on-chain transaction; sign it with your wallet.", "code": "onchain_required" }
StatusCodeMeaning
400bad_json · bad_requestMalformed body or invalid field
401unauthenticated · invalid_key · bad_signature · nonce_expiredNo or bad credentials; revoked key; bad or expired sign-in
403forbidden · missing_scopeAuthenticated but not allowed (cross-origin write, key used on a route it cannot read)
404not_foundUnknown id, or no Pulse epoch yet
409onchain_required · sunset · unsupported_templateWallet-signed action; strategy retired; quote not available for this template
422out_of_boundsValid request the rules reject (for example slippageBps outside 0–5000)
429rate_limitedToo many calls; honour Retry-After
500 / 503internal · market_unavailableServer or upstream failure; retry with backoff

#Rate limits

  • Agent keys: ratePerHour per key, chosen at creation. Every call counts, reads included.
  • Sessions and anonymous reads: a per-IP budget that is generous for interactive use; quotes are limited more tightly.
  • On-chain mutations are rate-limited by the contracts, per agent (callsPerHour, max 120) and in the strategy's own bounds.
  • Exceeding an API limit returns 429 rate_limited with a Retry-After header in seconds.

#Freshness

REST views are built by an indexer that follows the chain. Check GET /api/chain/status (lagBlocks, degraded) before acting on a view, and read contract state directly (getProposal, scoreOf, previewWinners, claimable) when you need the authoritative value.

#Versioning

The API is unversioned. Changes are additive (new optional fields, new endpoints) and listed in the changelog. Ignore unknown fields. A breaking change will be announced and served under /api/v1.

#Reference

Something unclear or wrong on this page? Report it.Updated Dec 1, 2026 · v1.0