Skip to main content

Headless API Reference Beta

All endpoints live under:

https://api.elfa.ai/widget-api/v1

Every route requires headless authX-Widget-Key + x-user-identifier — except GET /key, which needs only the key. Error codes are listed in the quickstart error contract.

Feature Flags

Widget keys carry a set of feature flags (chat, feed, auto, workspace) configured per key by the Elfa team. Each group below notes the flag it requires; calling a route your key isn't flagged for returns 403 WIDGET_FEATURE_NOT_ENABLED with a missingFeatures array. Markets endpoints are ungated.

Request Semantics

  • userData / limits no-clobber: any request body may carry userData (personalization) and limits (per-user caps). Requests that omit them — including every bodyless GET — preserve the previously stored values for that end-user; they are only replaced when sent again.
  • No per-IP rate limit by design: a partner backend fans out for many end-users from one server IP, so per-IP throttling would punish legitimate traffic. Usage is bounded instead by per-user quota (429 QUOTA_EXCEEDED) and the key's monthly credit budget (402 FREE_CREDITS_EXHAUSTED) on the metered routes, plus an invalid-key attempt limiter.
  • Metered routes: POST /chat/stream and POST /auto/chat are the two routes that enforce per-user quota and the credit budget. POST /auto/chat deliberately counts toward the same chat/session quota buckets as chat/stream.

Key

No feature flag; no x-user-identifier required.

MethodPathPurpose
GET/keyIntrospect your widget key: id, name, partnerName, status, allowedDomains, expiresAt, lastUsedAt. Useful as an auth smoke test. The secret itself is never returned.

Chat

Feature: chat. chat/stream and chat/trending-queries are gated by chat or auto depending on mode: when analysisType is athenaBuilder the auto flag is checked instead of chat.

MethodPathPurpose
POST/chat/streamStream a chat answer as SSE. Body: message, analysisType, optional sessionId, speed, attachments.imageIds, userData, limits. Metered (quota + credits). See the quickstart for the event format.
GET/chat/trending-queriesTrending starter queries to seed a chat UI.
GET/chat/token-questions/:chain/:contractAddressSuggested questions for a specific token.
GET/chat/candlestick-chartCandlestick chart data for chat renders. Query: tradingPair or tokenMarketSlug (one required), plus optional timeRange, candlestickInterval, platform, marketType.
GET/chat/sessionsList the end-user's chat sessions.
GET/chat/sessions/favoritesList the end-user's favorited sessions.
GET/chat/sessions/:sessionIdFetch one session with its conversation history.
GET/chat/sessions/:sessionId/conversations/:convId/rendersFetch chart/trade renders attached to a conversation turn.
PATCH/chat/sessions/:sessionId/favoriteToggle a session's favorite flag.
PATCH/chat/sessions/:sessionId/titleRename a session.
POST/chat/sessions/:sessionId/closeClose a session.
PATCH/chat/conversations/:convId/voteUp/down-vote a conversation turn.

Auto

Feature: auto. Condition queries ("plans") the end-user builds and runs — same query model as the Auto product. Drafts are unactivated queries; convert activates a draft.

MethodPathPurpose
POST/auto/chatBuilder chat — natural language to query draft. Metered (counts toward the chat quota buckets).
POST/auto/queries/validateValidate a query JSON without creating it.
POST/auto/queries/previewPreview what a query would match right now.
GET/auto/queries/draftsList the end-user's query drafts.
POST/auto/queries/draftsCreate or update a draft.
GET/auto/queries/drafts/:idFetch one draft.
DELETE/auto/queries/drafts/:idDelete a draft.
POST/auto/queries/drafts/:id/validateValidate a stored draft.
POST/auto/queries/drafts/:id/previewPreview a stored draft.
POST/auto/queries/drafts/:id/convertConvert (activate) a draft into a live query.
GET/auto/queriesList the end-user's active queries.
POST/auto/queriesCreate a query directly from query JSON.
GET/auto/queries/:idFetch one query.
GET/auto/queries/:id/eqlFetch the compiled EQL for a query.
GET/auto/queries/:id/evaluationsList a query's evaluation history.
GET/auto/queries/:id/sessionsList LLM sessions produced by a query's llm actions.
GET/auto/queries/:id/sessions/:sessionIdFetch one LLM session's details.
POST/auto/queries/:id/cancelCancel a running query.
DELETE/auto/queries/:idDelete a query.
GET/auto/executionsList trigger executions across the end-user's queries.
GET/auto/executions/:idFetch one execution.

Feed

Feature: feed. Responses are cached for 60 seconds.

MethodPathPurpose
GET/insightCurated market insight feed.
GET/sentimentMarket sentiment data.
GET/feed/:id/detailDetail for one feed item.

Feature: chat.

MethodPathPurpose
GET/searchSearch tokens and accounts. Query: keyword, searchType (array of token, ondemandToken, account), optional compact.
GET/search/unifiedUnified search across types. Query: keyword.

Workspace

Feature: workspace. Per-end-user encrypted secret store and delivery artifacts for workspace (sandbox) tools. Secrets are scoped to the (widgetKey, endUser) identity.

MethodPathPurpose
POST/workspace/secretsSet a named secret for the end-user.
GET/workspace/secretsList the end-user's secret names (values are never returned).
DELETE/workspace/secrets/:nameDelete a secret.
GET/workspace/delivery/:idDownload a delivery artifact produced by a workspace run.

Markets

No feature flag required.

MethodPathPurpose
POST/markets/infoMarket info for a token. Body: either preference: "symbol" with symbol, or chain + address.