Guides · Using AgentFlare data · Beginner
Reading .data.json: A Field Guide for Agents
Every AgentFlare .data.json shares one envelope and swaps in a vertical-specific data block. Fetch it with the X-Crawler-Token header; without a token the server answers 402 with the error code invalid_token.
You're reading the full report — free for humans. The machine-readable dataset for this section is open to all agents too — no payment required.
https://esa.aisa.one/api/v1/access/verify
This guide is for developers and agent builders who want to pull structured AgentFlare data instead of scraping HTML teasers. You will learn which files are paid, how to request one with a crawler token, how to recognise the 402 response, and how to read the shared envelope (title, facts, data, sources, pricing and more). You will also see how the data block differs between Markets index files, single-ticker files and Newswire digests, so your parser can branch on file type safely.
How the flow works
Before you start
- A registered crawler token from the AISA onboarding guide
- curl and Python 3 with the requests package
- Basic familiarity with reading JSON
Step by step
Check which files are paid
AgentFlare splits its surface into two tiers. L1_free covers index pages, .html articles, .md teasers, llms.txt, sitemap.xml and robots.txt. L2_paid covers every *.data.json and *.full.md file, metered per request through https://esa.aisa.one/api/v1/access/verify. The directory prices in pricing.json are 0.01 USD for markets and 0.005 USD for news. Guides are open to agents. Fetch pricing.json to confirm the current rules before you crawl.
bash curl -s https://agentflare.org/pricing.jsonRequest a file with your crawler token
Send your registered token in the X-Crawler-Token header. This name replaces the earlier X-AISA-Crawler-Token, which older AISA documentation pages still show, so use X-Crawler-Token. Never put the token in Authorization: Bearer, because that header is reserved for the gateway layer. The example fetches the Markets index file; swap in a dated file such as YYYY-MM-DD.data.json or a ticker slug such as xom.data.json.
bash curl -s \ -H 'X-Crawler-Token: YOUR_CRAWLER_TOKEN' \ https://agentflare.org/markets/index.data.jsonRecognise the 402 response
A request to a paid file without a token returns HTTP 402 Payment Required with a JSON body. The error code is invalid_token, and the message tells you to send your registered token in the X-Crawler-Token header. The body also carries an onboarding URL, https://esa.aisa.one/agent/guide.html. Treat 402 as a credentials problem: check that the header name is spelled exactly and that the token is registered.
text HTTP/1.1 402 Payment Required Content-Type: application/json Cache-Control: no-cache, no-store X-Tengine-Error: payment required by http_crawler Body fields: error (invalid_token), message, onboardingParse the shared envelope
Every .data.json starts with the same top-level fields: @context, type, tier, title, description, canonical, category, updated, generated_at, facts, data, analysis_md, sources, related, pricing and powered_by. The facts array holds label and value strings. The pricing object carries price_usd, method, endpoint, autopay_hint and onboarding. Read the envelope first, then branch on the data block.
python import requests url = 'https://agentflare.org/markets/index.data.json' headers = {'X-Crawler-Token': 'YOUR_CRAWLER_TOKEN'} r = requests.get(url, headers=headers) r.raise_for_status() doc = r.json() print(doc['title'], doc['category'], doc['updated']) print(doc['generated_at'], doc['canonical']) for f in doc['facts']: print(f['label'], f['value']) print(doc['pricing']['price_usd'], doc['pricing']['endpoint']) for s in doc['sources']: print(s['title'], s['url'])Read the vertical-specific data block
The data object changes with the file. Markets index and dated files carry count, advancers, decliners, sectors and stocks. A ticker file such as xom.data.json carries ticker, name, price_usd, day_change_pct, returns_pct (m1, m3, m6), metrics and company. Newswire index files carry date and digests; topic files such as YYYY-MM-DD-ai.data.json carry headline, dek, stories, market, watch, takeaways, faq and items. Branch on the URL pattern.
python # Markets index or dated file for s in doc['data']['stocks']: print(s['ticker'], s['price_usd'], s['day_change_pct'], s['return_6m_pct'], s['pe'], s['sector']) # Single ticker file such as xom.data.json # d = ticker_doc['data'] # print(d['ticker'], d['returns_pct']['m6']) # print(d['metrics']['price_to_earnings_ratio']) # print(d['company']['sector'], d['company']['industry'])
Shared envelope fields in every .data.json
| Field | Type | Notes |
|---|---|---|
@context, type, tier | string | Top-level identification fields |
title, description, canonical, category | string | Descriptive metadata for the file |
updated, generated_at | string | Timestamps at the top level |
facts | array of object | Each entry has label and value, both strings |
data | object | Vertical-specific block; shape differs per file type |
analysis_md | string | Analysis text in Markdown |
sources, related | array of object | sources entries have title and url; related entries have name and url in Markets files |
pricing, powered_by | object, string | pricing has price_usd, method, endpoint, autopay_hint, onboarding |
Common pitfalls
- Sending the token in Authorization: Bearer fails by design; that header is reserved for the gateway layer. Use X-Crawler-Token only.
- Do not reuse one parser for every file. Markets index files have data.stocks, ticker files have data.metrics, and Newswire files have data.stories or data.digests.
- In the Newswire index file, related is typed as an array of unknown, and data.items[].tickers is unknown in crypto files. Guard these fields before iterating.
- Do not probe paid files anonymously in a loop; each one returns 402 with the error code invalid_token until X-Crawler-Token is present.
Key takeaways
- Every .data.json shares one envelope; only the data block changes by vertical and file type.
- Send the token in X-Crawler-Token, never in Authorization: Bearer.
- A 402 with error invalid_token means no registered token was sent; onboarding is at https://esa.aisa.one/agent/guide.html.
FAQ
Which header carries the AgentFlare crawler token?
X-Crawler-Token. It replaces the earlier name X-AISA-Crawler-Token that older AISA pages still show. Do not use Authorization: Bearer for the token, since that header is reserved for the gateway layer.
How much does a .data.json request cost?
pricing.json lists 0.01 USD per request for markets and 0.005 USD for news. Other directories include 0.01 for crypto, social and predictions, and 0.02 for research and scholar. Guides are open to agents.
Why do I get HTTP 402 Payment Required?
You requested a paid file without a registered token. The body returns the error code invalid_token and points to https://esa.aisa.one/agent/guide.html. Add your token in the X-Crawler-Token header and retry.
Are the .html and .md pages also paid?
No. Index pages, .html articles, .md teasers, llms.txt, sitemap.xml and robots.txt are free (L1_free). The paid tier (L2_paid) covers *.data.json and *.full.md files.
How this page is made. Written from 5 primary sources — the AISA agent and publisher documentation and AgentFlare's own files (pricing.json, robots.txt, llms.txt, live responses, .data.json field lists). Each step links the sources it relies on; steps naming a header, endpoint, error code or figure that the sources do not contain are removed. Refreshed weekly.
Sources & citations
- Header name: X-Crawler-Token esa.aisa.one
- AgentFlare Markets .data.json field reference agentflare.org
- AgentFlare Newswire .data.json field reference agentflare.org
- AgentFlare pricing.json (directory price map) agentflare.org
- Live capture: anonymous request to a paid AgentFlare file agentflare.org