API Reference

Programmatic access to Discovery, Signal, Quote, and research.

Authentication

Create an API token in Settingsand pass it as a bearer token. Quote persistence and other mutations require an appropriately scoped token.

curl -H "Authorization: Bearer <api-token>" \
  https://hedgelayer.ai/api/profile

Available endpoints

CategoryEndpointMethodDescription
Discovery/api/searchPOSTCanonical topic search across explicit venues
Discovery/api/feedGETDeterministic Polymarket feed screens
Discovery/api/feed/discoverPOSTBounded Polymarket Feed discovery, JSON or SSE
Signal/api/signal/analyzePOSTSignal analysis, JSON or SSE
Signal/api/signal/recentGETRecent complete user-scoped forecasts
Quote/api/quotePOSTGenerate an ephemeral or saved Polymarket preview
Quote/api/quoteGETList owned saved previews
Quote/api/quote/:idDELETEDelete an owned saved preview
Research/api/chatPOSTStreaming conversational research
Research/api/briefPOSTGenerate a Market Brief
Research/api/assessmentsGET, POSTList/create research sessions
Research/api/assessments/:idGET, PATCH, DELETERead/update/delete a session
Markets/api/orderbookGETPublic Polymarket order-book helper
Markets/api/bookmarksGET, POSTList/save venue-aware bookmarks
Markets/api/bookmarks/:marketIdDELETEDelete a bookmark
MCP/mcpPOSTAuthenticated stateless market-search tools
Account/api/profileGET, PATCHRead/update profile
Account/api/tokensGET, POSTList/create API tokens
Account/api/tokens/:idDELETERevoke an API token

Discovery

POST /api/search accepts a query and explicit non-empty venues array containing polymarket, kalshi, or both. Canonical instruments preserve venue-native identity, rules, payoff, timing, units, fees, and capabilities.

curl -X POST https://hedgelayer.ai/api/search \
  -H "Authorization: Bearer <api-token>" \
  -H "Content-Type: application/json" \
  -d '{"query":"UK interest rates","venues":["polymarket","kalshi"]}'

POST /api/feed/discover accepts global or topic discovery and can stream safe operational progress over SSE. Feed is Polymarket-only and returns candidate IDs for later analysis. An optional portfolio_context can provide up to 100 safe held-market summaries. Exact held slugs and events are removed before curation; related topics remain eligible under an exposure-aware per-topic cap.

Model Context Protocol

POST /mcp uses the same bearer tokens as the general API and requires read scope. The stateless Hedge Layer MCP server exposes search_markets with venue-labelled output. Its thin provider adapters search Polymarket prediction markets and Hyperliquid perpetual and spot markets without adding an agent loop or trading authority.

Venue decimals remain exact strings and carry explicit units. Funding includes its interval, open interest identifies its contract unit, and every result carries source and retrieval metadata. Missing or invalid venue numbers are omitted instead of being converted to zero.

Agent H users can create a token in Settings and run agent-h mcp configure --token <api-token>.

Signal

POST /api/signal/analyze accepts Polymarket URL input or structured Polymarket/Kalshi market input. It returns a forecast and interval or abstains. Signal never sizes or executes.

curl -X POST https://hedgelayer.ai/api/signal/analyze \
  -H "Authorization: Bearer <api-token>" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://polymarket.com/event/example-market"}'

JSON and SSE modes preserve lifecycle aliases and market_slugfor existing clients. The SSE terminal frame is a finalevent containing the result. GET /api/signal/recent returns the newest valid complete forecast per requested slug/window.

Quote

POST /api/quote supports Polymarket only. It accepts an instrument, action/outcome, exactly one size mode, optional Signal or manual-capital context, route and risk limits, and persist.

curl -X POST https://hedgelayer.ai/api/quote \
  -H "Authorization: Bearer <api-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "instrument":"example-market",
    "action":"BUY",
    "outcome":"YES",
    "size":{"type":"cash","amount_usd":25},
    "route":"auto",
    "persist":false
  }'

Response status is READY, PARTIAL, PASSIVE_ONLY, SKIP, or UNAVAILABLE. The response includes instrument, request, market/book, fill, economics, optional Signal and sizing suggestion, risks, observation/expiry timestamps, and execution.supported: false.

persist: true refreshes public data before saving. Saved rows never retain manually entered portfolio capital, balances, credentials, signatures, or executable headers.

No execution APIs

v3 exposes no wallet, deposit, withdrawal, trading-credential, order, strategy-management, execution, or P&L endpoints. Obsolete paths are removed rather than supported through compatibility handlers.