### C# example using HttpClient Source: https://docs.elfa.ai/api/v3/endpoints/top-accounts/ C# code example for making a GET request to the Top Accounts endpoint using HttpClient, with the x-elfa-api-key header. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.elfa.ai/v3/people/accounts"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("x-elfa-api-key", ""); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# example using HttpClient Source: https://docs.elfa.ai/api/v3/endpoints/equity-call-book/ C# code example using HttpClient to make a GET request to the equity call book endpoint. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.elfa.ai/v3/market/equity/call-book"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("x-elfa-api-key", ""); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# example using HttpClient Source: https://docs.elfa.ai/api/v3/endpoints/key-status/ C# code example using HttpClient to make a GET request to the key-status endpoint with the x-elfa-api-key header. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.elfa.ai/v3/key-status"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("x-elfa-api-key", ""); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### History and servedFrom Example Source: https://docs.elfa.ai/api/v3/concepts/ Example showing a GET request for events with a from timestamp and the servedFrom response indicating the actual range served. ```text GET /v3/events?from=1785801600 asked from 4 Aug 2026 -> "servedFrom": 1788307200 answered from 2 Sep 2026, 00:00 UTC ``` -------------------------------- ### C# example using HttpClient Source: https://docs.elfa.ai/api/v3/endpoints/list-calls/ C# code to make a GET request to /v3/calls with the required headers. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.elfa.ai/v3/calls"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("x-elfa-api-key", ""); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# example using HttpClient Source: https://docs.elfa.ai/api/v2/endpoints/top-mentions/ C# code to make a GET request to the Top Mentions endpoint with the required x-elfa-api-key header. Uses HttpClient and async/await. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.elfa.ai/v2/data/top-mentions"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("x-elfa-api-key", ""); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Install @x402/fetch dependencies Source: https://docs.elfa.ai/get-started/x402/ Install the required packages for using @x402/fetch: @x402/fetch, @x402/evm, @x402/core, and viem. ```bash npm install @x402/fetch @x402/evm @x402/core viem ``` -------------------------------- ### First Request Example (TypeScript) Source: https://docs.elfa.ai/tools/sdks/ Example of initializing the ElfaSDK and making a trending tokens and keyword mentions request. ```APIDOC ## First Request Example (TypeScript) ### Description Example of initializing the ElfaSDK and making a trending tokens and keyword mentions request. ### Code ```typescript import { ElfaSDK } from "@elfa-ai/sdk"; const elfa = new ElfaSDK({ elfaApiKey: process.env.ELFA_API_KEY! }); const trending = await elfa.getTrendingTokens({ timeWindow: "24h" }); const mentions = await elfa.getKeywordMentions({ keywords: "bitcoin,ethereum", timeWindow: "1h", }); ``` ``` -------------------------------- ### Install @x402/axios dependencies Source: https://docs.elfa.ai/get-started/x402/ Install the required packages for using @x402/axios: @x402/axios, @x402/evm, @x402/core, and viem. ```bash npm install @x402/axios @x402/evm @x402/core viem ``` -------------------------------- ### GET /v2/key-status JSON response example Source: https://docs.elfa.ai/api/v2/account/ Example JSON response from the key-status endpoint, showing the structure of key information, usage, limits, and billing details. The spec's example uses placeholder values. ```json { "success": true, "data": { "id": 1, "key": "string", "name": "string", "status": "active", "dailyRequestLimit": 1, "monthlyRequestLimit": 1, "expiresAt": "string", "createdAt": "string", "updatedAt": "string", "requestsPerMinute": 1, "email": "string", "project": "string", "allowOverage": true, "maxOverage": 1, "spendCapCredits": 1, "bonusCredits": 1, "bonusCreditsExpiresAt": "string", "userId": 1, "emailNotificationsEnabled": true, "lastEmailSentAt": "string", "lastUsagePercentNotified": 1, "spendAlertThreshold": "string", "spendAlertMaxFrequencyHours": 1, "totalSpendAlerted": "string", "athenaEnabled": true, "scopes": ["string"], "tier": "string", "depositCredits": 1, "billingMode": "deposit", "usage": { "monthly": 1, "daily": 1 }, "limits": { "monthly": 1, "daily": 1 }, "isExpired": true, "remainingRequests": { "monthly": 1, "daily": 1 } } } ``` -------------------------------- ### Standing Example Output Source: https://docs.elfa.ai/api/v3/concepts/ Example output showing top accounts by standing and by alphaScore, with dates. ```text Top accounts by standing, 2 Oct 2026: 1. blknoiz06 2. solana 3. elonmusk Top accounts by alphaScore, 13 Oct 2026: 1. Banana3Stocks 2. lunanomacrypto 3. insomniacxbt ``` -------------------------------- ### C# example for trending contract addresses Source: https://docs.elfa.ai/api/v2/x402/trending-cas-twitter/ Uses HttpClient to send a GET request to the endpoint with Accept header. Requires .NET HttpClient. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.elfa.ai/x402/v2/aggregations/trending-cas/twitter"); request.Headers.Add("Accept", "application/json"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Example successful response with sample values Source: https://docs.elfa.ai/api/v3/endpoints/equity-call-book/ Example JSON response with sample values for a successful request. ```json { "bars": [ { "barAt": 1, "live": true, "longShare": 1, "shortShare": 1, "crowdingPercentile": 1, "accountCount": 1, "pulse24": 1, "pulse24LongShare": 1, "pulse6": 1, "pulse6LongShare": 1, "formulaVersion": "string", "computedAt": 1 } ], "nextCursor": "string", "hasMore": true, "servedFrom": 1 } ``` -------------------------------- ### JavaScript API v3 usage example Source: https://docs.elfa.ai/tools/sdks/ Shows how to use the JavaScript v3 client to find an entity by query, fetch events within a time range, and get positioning. Note that `from` is required in seconds (milliseconds cause a 400 error), and an empty events reply indicates a quiet range, not an error. ```typescript // Check the name: the first match may not be the asset you meant. const { entities } = await elfa.v3.getEntities({ q: "btc", entityType: ["token"], limit: 1 }); if (entities.length === 0) throw new Error("no exact match"); const id = entities[0].id; // from is required, in seconds. Milliseconds are a 400. // An empty events reply is a quiet range, not an error. const from = Math.floor(Date.now() / 1000) - 86400; const { events } = await elfa.v3.getEvents({ entityIds: [id], from, limit: 10 }); const positioning = await elfa.v3.getPositioning({ entityId: id }); ``` -------------------------------- ### Example successful response Source: https://docs.elfa.ai/api/v3/endpoints/top-accounts/ Another example of a successful response, with sample values for the fields. ```json { "accounts": [ { "rank": 1, "handle": "string", "name": "string", "followerCount": 1, "verified": true, "standing": 1, "track": { "alphaScore": 1, "hitRate": 1, "avgReturn": 1, "scoredEpisodes": 1, "totalEpisodes": 1 } } ], "nextCursor": "string", "hasMore": true } ``` -------------------------------- ### Install TypeScript SDK Source: https://docs.elfa.ai/tools/sdks/ Install the @elfa-ai/sdk package using npm. Requires Node 22 or newer. ```APIDOC ## Install TypeScript SDK ### Description Install the @elfa-ai/sdk package using npm. Requires Node 22 or newer. ### Command ```bash npm install @elfa-ai/sdk ``` ``` -------------------------------- ### GET /v3/entities Source: https://docs.elfa.ai/api/v3/endpoints/resolve-entities/ Turns what a caller holds into the id every other v3 endpoint takes. See the guide for behaviour, fields and examples. ```APIDOC ## GET /v3/entities ### Description Turns what a caller holds into the id every other v3 endpoint takes. ### Method GET ### Endpoint /v3/entities ### Plan Access PAYG, Grow and Enterprise ### Cost Free until 31 October 2026 ### Data Recency Computed at ingest in real time ### Rate Limit 60 to 120 RPM by plan ### Responses - 200: Ok - 400: Invalid parameter - 401: Missing or invalid API key - 403: Key is not scoped for this endpoint - 429: Rate limit exceeded ``` -------------------------------- ### GET /v3/entities response example Source: https://docs.elfa.ai/api/v3/entities/ Example JSON response from GET /v3/entities?q=bio&limit=2, showing a token and an equity sharing the ticker BIO. Both score 0.9, with the token ranked first. ```json { "entities": [ { "id": "584f4b42-abf9-4bf4-b5d5-193531f4ab43", "entityType": "token", "name": "Bio Protocol", "symbol": "BIO", "handle": null, "matchedOn": "symbol", "score": 0.9, "externalIds": { "coingeckoId": "bio-protocol", "figi": null, "cik": null } }, { "id": "54cc5269-fa91-4e5a-b8a1-d4a38534c303", "entityType": "equity", "name": "Bio-Rad Laboratories, Inc.Class A", "symbol": "BIO", "handle": null, "matchedOn": "symbol", "score": 0.9, "externalIds": { "coingeckoId": null, "figi": "BBG000DY28W5", "cik": "0000012208" } } ], "nextCursor": "P5O7xFKK.MC45fDAuMDAwOTA3NDQxMDE2MzMzOTM4M3wxODA3NA", "hasMore": true } ``` -------------------------------- ### Smart Stats JSON Response Example Source: https://docs.elfa.ai/api/v2/accounts/ Example JSON response from the `GET /v2/account/smart-stats` endpoint. The spec's example uses placeholder values. ```json { "success": true, "data": { "averageReach": 1, "averageEngagement": 1, "smartFollowingCount": 1 } } ``` -------------------------------- ### First request with ElfaSDK (TypeScript) Source: https://docs.elfa.ai/tools/sdks/ Initialize the SDK with your API key and fetch trending tokens and keyword mentions. Uses process.env.ELFA_API_KEY. ```typescript import { ElfaSDK } from "@elfa-ai/sdk"; const elfa = new ElfaSDK({ elfaApiKey: process.env.ELFA_API_KEY! }); const trending = await elfa.getTrendingTokens({ timeWindow: "24h" }); const mentions = await elfa.getKeywordMentions({ keywords: "bitcoin,ethereum", timeWindow: "1h", }); ``` -------------------------------- ### Top Mentions curl Request Example Source: https://docs.elfa.ai/api/v2/mentions/ Example curl command to call GET /v2/data/top-mentions with the x-elfa-api-key header and query parameters ticker=DOGE, timeWindow=24h, and pageSize=2. ```bash curl -H "x-elfa-api-key: $ELFA_API_KEY" \ "https://api.elfa.ai/v2/data/top-mentions?ticker=DOGE&timeWindow=24h&pageSize=2" ``` -------------------------------- ### Smart Stats curl Request Example Source: https://docs.elfa.ai/api/v2/accounts/ Example curl command to call the `GET /v2/account/smart-stats` endpoint. It uses the `x-elfa-api-key` header and the `username` query parameter. ```bash curl -H "x-elfa-api-key: $ELFA_API_KEY" \ "https://api.elfa.ai/v2/account/smart-stats?username=elfa_ai" ``` -------------------------------- ### C# example for creating a query Source: https://docs.elfa.ai/auto/reference/x402/create-query/ C# code using HttpClient to POST to the create query endpoint with a JSON body. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://api.elfa.ai/x402/v2/auto/queries"); request.Headers.Add("Accept", "application/json"); var content = new StringContent("{\n \"query\": {\n \"conditions\": {},\n \"actions\": [\n {\n \"stepId\": \"string\",\n \"type\": \"webhook\",\n \"params\": {}\n }\n ],\n \"expiresIn\": \"string\"\n },\n \"title\": \"BTC breakout alert\",\n \"description\": \"Notify when BTC is above 100k so I can review the breakout setup.\"\n}", null, "application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Token News JSON Response Example Source: https://docs.elfa.ai/api/v2/mentions/ Example response body for the GET /v2/data/token-news endpoint. Shows the structure with success flag, data array containing mention fields, and metadata with pagination. Placeholder values are used in the spec. ```json { "success": true, "data": [ { "tweetId": "string", "link": "string", "likeCount": 1, "repostCount": 1, "viewCount": 1, "quoteCount": 1, "replyCount": 1, "bookmarkCount": 1, "mentionedAt": "string", "type": "repost", "repostBreakdown": { "ct": 1, "smart": 1 } } ], "metadata": { "pageSize": 1, "page": 1, "total": 1 } } ``` -------------------------------- ### Keyword Mentions API response example Source: https://docs.elfa.ai/api/v2/mentions/ Example JSON response from the GET /v2/data/keyword-mentions endpoint. Shows a mention object with tweetId, link, engagement counts, mentionedAt, type, account, and repostBreakdown. The metadata includes total and cursor for pagination. ```json { "success": true, "data": [ { "tweetId": "2045519677062066348", "link": "https://x.com/BillyM2k/status/2045519677062066348", "likeCount": 0, "repostCount": 0, "viewCount": 0, "quoteCount": 0, "replyCount": 0, "bookmarkCount": 0, "mentionedAt": "2026-04-18T15:07:49+00:00", "type": "post", "account": { "username": "BillyM2k", "isVerified": false }, "repostBreakdown": { "smart": 0, "ct": 0 } } ], "metadata": { "total": 1, "cursor": 1776524869000 } } ``` -------------------------------- ### JSON response from /v3/key-status Source: https://docs.elfa.ai/api/v3/account/ Example response showing a PAYG key with deposit billing, user owner, five scopes, credit usage, and a history timestamp. The credits.limit and resetsAt are null for prepaid keys. ```json { "plan": "payg", "billingMode": "deposit", "owner": "user", "scopes": ["key-status", "chat", "events", "calls", "entities"], "credits": { "limit": null, "used": 407, "remaining": 2223, "resetsAt": null, "requestsPerMinute": 60 }, "historyFrom": 1788307200 } ``` -------------------------------- ### Top Mentions JSON Response Example Source: https://docs.elfa.ai/api/v2/mentions/ Example response from GET /v2/data/top-mentions showing the envelope { success, data, metadata } and a flat array of mentions with engagement metrics. Note that top mentions does not return an account object per mention. ```json { "success": true, "data": [ { "tweetId": "2045186844212756697", "link": "https://x.com/BillyM2k/status/2045186844212756697", "likeCount": 465, "repostCount": 45, "viewCount": 15914, "quoteCount": 10, "replyCount": 62, "bookmarkCount": 12, "mentionedAt": "2026-04-17T17:05:16+00:00", "type": "post", "repostBreakdown": { "smart": 0, "ct": 0 } } ], "metadata": { "total": 52, "page": 1, "pageSize": 2 } } ``` -------------------------------- ### Preview the query with /v3 endpoints Source: https://docs.elfa.ai/guides/alerts-with-auto/ Run the query over the last day to see what a condition with the same filters would have fired on. Requires a Pay-as-you-go, Grow, or Enterprise key. ```text GET /v3/entities?q=eth&entityType=token&limit=1 -> entities[0].id: Ethereum GET /v3/events?entityIds=&implication=bearish&from= -> the bearish ETH events of the last day. Too many? Add eventType or alertAction=alert. None? Drop a filter ``` -------------------------------- ### Install @elfa-ai/sdk with npm Source: https://docs.elfa.ai/tools/sdks/ Install the TypeScript/JavaScript SDK. Requires Node 22 or newer from v6 onward; pin @elfa-ai/sdk@5 for older runtimes. ```bash npm install @elfa-ai/sdk ``` -------------------------------- ### C# example for trending contract addresses Source: https://docs.elfa.ai/api/v2/endpoints/trending-cas-twitter/ C# code using HttpClient to send a GET request to the trending-cas/twitter endpoint with the API key header. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.elfa.ai/v2/aggregations/trending-cas/twitter"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("x-elfa-api-key", ""); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Request body example Source: https://docs.elfa.ai/auto/reference/x402/create-query/ Example JSON body for the create query request, including query conditions, actions, expiresIn, title, and description. ```json { "query": { "conditions": {}, "actions": [ { "stepId": "string", "type": "webhook", "params": {} } ], "expiresIn": "string" }, "title": "BTC breakout alert", "description": "Notify when BTC is above 100k so I can review the breakout setup." } ``` -------------------------------- ### GET /v3/events?sort=relevant&assetClass=crypto&limit=10 Source: https://docs.elfa.ai/api/v3/events/ Example request for relevance-ranked events. Note that range parameters are refused with sort=relevant, and paging is based on the first page's ranking. ```text GET /v3/events?sort=relevant&assetClass=crypto&limit=10 ``` -------------------------------- ### Example prompt for building an Auto query Source: https://docs.elfa.ai/auto/capabilities/ A sample prompt that instructs Builder Chat to build an Auto query with a title, description, symbol monitoring, trigger condition, one-time trigger, expiry, and webhook action. ```text Build an Auto query: - title: "BTC/ETH RSI oversold on 1h" - description: human-readable thesis for why we want this alert (1-2 sentences) - monitor BTC and ETH RSI(14) on 1h - trigger when crosses below 30 - one-time trigger, expires in 24h - action: webhook to my endpoint Return ready-to-submit query JSON. ``` -------------------------------- ### C# HttpClient Request for Trending Narratives Source: https://docs.elfa.ai/api/v2/x402/trending-narratives/ C# code example using HttpClient to send a GET request to the trending narratives endpoint. Adds Accept header for JSON and prints the response. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.elfa.ai/x402/v2/data/trending-narratives"); request.Headers.Add("Accept", "application/json"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Token News curl Request Source: https://docs.elfa.ai/api/v2/mentions/ Example curl command to call the GET /v2/data/token-news endpoint. Uses the x-elfa-api-key header with the ELFA_API_KEY environment variable and includes query parameters coinIds, timeWindow, and pageSize. ```bash curl -H "x-elfa-api-key: $ELFA_API_KEY" \ "https://api.elfa.ai/v2/data/token-news?coinIds=bitcoin&timeWindow=7d&pageSize=1" ``` -------------------------------- ### Use @x402/axios to make a paid request Source: https://docs.elfa.ai/get-started/x402/ Set up an EVM signer on Base, register the ExactEvmScheme, wrap axios, and make a GET request to the keyword-mentions endpoint with query parameters. ```typescript import { wrapAxiosWithPayment } from "@x402/axios"; import { ExactEvmScheme, toClientEvmSigner } from "@x402/evm"; import { x402Client } from "@x402/core/client"; import { createPublicClient, http } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import { base } from "viem/chains"; import axios from "axios"; const account = privateKeyToAccount("0xYOUR_PRIVATE_KEY"); const publicClient = createPublicClient({ chain: base, transport: http() }); const signer = toClientEvmSigner(account, publicClient); const client = new x402Client().register( "eip155:8453", new ExactEvmScheme(signer), ); const x402Axios = wrapAxiosWithPayment(axios, client); const { data } = await x402Axios.get( "https://api.elfa.ai/x402/v2/data/keyword-mentions", { params: { keywords: "bitcoin", timeWindow: "24h" } }, ); ``` -------------------------------- ### SSE response event stream Source: https://docs.elfa.ai/widget/headless-quickstart/ Example of the Server-Sent Events response from the chat stream. Each event is a data: line with JSON containing a type discriminator. Concatenate text events for the answer, use complete to get sessionId and convId, and [DONE] terminates the stream. A mid-stream failure emits an error event before [DONE]. ```text data: {"type":"session_info","sessionId":"…"} data: {"type":"title","title":"BTC price action"} data: {"type":"text","content":"Bitcoin is…"} data: {"type":"text","content":" trading higher after…"} data: {"type":"status","status":"Searching mentions…"} data: {"type":"complete","sessionId":"…","convId":123,"speed":"expert","success":true} data: [DONE] ``` -------------------------------- ### x402 vs API Key Source: https://docs.elfa.ai/get-started/x402/ Comparison of authentication methods: API Key and x402. x402 requires no setup, uses a wallet for identity, and bills per request in USDC. ```APIDOC ## x402 vs API Key ### Description Comparison of the two authentication methods: API Key and x402. ### Authentication Methods #### API Key - **Setup**: Register, get key - **Auth Header**: `x-elfa-api-key` - **Billing**: Monthly credits or PAYG - **Identity**: API key - **Rate Limit**: Per API key (60-120 RPM) - **Best For**: Apps, dashboards #### x402 - **Setup**: None — just a wallet - **Auth Header**: `PAYMENT-SIGNATURE` (x402 v2) - **Billing**: Per-request USDC - **Identity**: Wallet address - **Rate Limit**: 1,000 RPM baseline (currently per client IP) - **Best For**: AI agents, bots ### Notes - Both access modes are independent. - x402 does not consume API key credits. ``` -------------------------------- ### Preview asset values and condition JSON for mindshare plan Source: https://docs.elfa.ai/auto/mindshare/ Shows a GET request to read current mindshare values and a JSON condition object that sets a threshold beyond the current values to avoid immediate firing. The example uses SOL with rank 14, share 3.1, changePct 18.4, and hot false. ```text GET /v3/market/crypto/mindshare?period=24h&limit=50 -> SOL: rank 14, share 3.1, changePct 18.4, hot false ``` ```json { "source": "mindshare", "method": "rank_24h", "args": { "asset": "SOL", "market": "crypto" }, "operator": "crosses_below", "value": 10 } ```