Skip to main content

Enums and Errors

Every enum value and every error code on /v2/* and /x402/v2/*, in one place. Auto has its own: see Auto.

Enums​

Chat​

FieldValuesMeaning
analysisTypechat, macro, summary, tokenIntro, tokenAnalysis, accountAnalysisWhat kind of answer to produce. Default chat. Each needs different inputs: see Analysis Types
speedfast, expert, adaptiveResponse quality mode. Default expert. adaptive is not available on x402
data.sources[].kindx_post, x_account, telegram, dex, explorer, prediction_market, webWhat a source link points at: a post on X, an X profile, a Telegram channel or message, a DEX pair or token page, a block-explorer page, a Polymarket or Kalshi market, or any other page. A string, not a closed enum: treat a value you do not recognise as web

POST /v2/chat/stream sends events whose data: payload is one of these types:

EventMeaning
session_infosessionId and analysisType
titleA generated session or analysis title
textIncremental Markdown content
text_completeIncremental text has finished
statusA progress update
creditsCredits consumed
completeFinal sessionId, success and creditsConsumed, plus sources when the request set includeSources: true
invalid_requestSafety checks rejected the query
errorThe stream failed

The stream ends with data: [DONE]. A : keep-alive comment may arrive during long gaps. See Chat Stream.

Mentions​

FieldValuesMeaning
data[].typepost, repost, quote, reply, note, articleThe kind of X post. Returned by top mentions, keyword mentions and token news
searchType (parameter)and, orand: every keyword must match. or: any keyword matches. On keyword mentions and event summary. Event summary defaults to or on /v2 and and on /x402/v2
FieldValuesMeaning
chainethereum, solanaThe chain of a trending contract address, on X and Telegram

Narratives​

FieldValuesMeaning
timeFrame (parameter)day, weekThe period trending narratives analyses. Default day

Key Status​

FieldValuesMeaning
statusactive, revoked, expired, payment_requiredThe state of the key. isExpired and expiresAt sit beside it
billingModedeposit, arrearsA prepaid balance, or a subscription billed after use

See Key Status.

Query Values​

ParameterValues
timeWindowA duration such as 30m, 1h, 4h, 24h, 7d, 30d. See Time Windows
from, toUnix timestamps

Errors​

A rejected /v2 request returns the standard error body:

{
"code": "ERR_INVALID_PARAMETER",
"message": "Invalid parameters",
"details": [{ "field": "query.keywords", "message": "keywords is required" }],
"errorId": "9d832e9b",
"requestId": "715b9dc6-a0a3-4830-bf1e-bd518c7406c6"
}

Branch on the HTTP status first, then on code. Do not match on message. Parts of the x402 surface reject with a short { "error": "..." } body instead, with no code. Both shapes, and how to handle them together, are in Errors.

CodeHTTPMeansNext step
ERR_UNAUTHORIZED401Missing, invalid or expired API keyCheck the x-elfa-api-key header. See Authentication
ERR_FORBIDDEN403The key is valid but not entitled to this endpointCheck your plan against Pricing
ERR_INSUFFICIENT_CREDITS402Not enough credits for the call. API-key surface onlyTop up, or wait for the monthly reset
ERR_BAD_REQUEST400The request was malformedRead message, fix and resend
ERR_INVALID_PARAMETER400A parameter is missing or invalidRead details for the field
ERR_NOT_FOUND404No route, or the resource does not existCheck the path against the API reference
ERR_RATE_LIMITED429Request rate exceededBack off and retry. See Rate Limits
ERR_RATE_LIMIT_EXCEEDED429Request rate exceeded, raised by a different limiterSame handling. Branch on 429, not on which code you got
ERR_SERVICE_UNAVAILABLE503A dependency the endpoint needs declined or could not serve the requestRetry with backoff. A 503 is not an empty result
EXTERNAL_API_ERRORupstream's statusAn upstream service returned an error, so this is not always 5xxRetry if the status is 5xx. Otherwise fix the request
EXTERNAL_API_REQUEST_FAILED500An upstream service did not respondRetry with backoff
INTERNAL_SERVER_ERROR500Unhandled failure on our sideRetry once. If it persists, send us errorId and requestId

Not every code starts with ERR_. New codes can appear without a breaking change: treat an unrecognised code as its HTTP status implies.

Errors specific to one endpoint, such as a keyword mentions request with neither keywords nor accountName, are on its resource page under Errors.

402 on x402​

On /x402/v2/* a 402 is not an error. It is the payment handshake: the body is an empty object {}, and the quote is in the base64-encoded PAYMENT-REQUIRED response header. Read the header and pay. See x402.

Which Failures to Retry​

  • Retry with backoff: 429, 503, and 500 (INTERNAL_SERVER_ERROR, EXTERNAL_API_REQUEST_FAILED, or EXTERNAL_API_ERROR with a 5xx status).
  • Do not retry unchanged: 400, 401, 402, 403 and 404. The same request fails the same way. Change the request, the key or the balance first.

Reporting a Failure​

Every response carries an x-request-id header. Send it to support with the errorId from the body when there is one, the endpoint and the time.