Guides · For agent developers · Beginner
Crawler Tokens & Auto-Pay: A How-To
AgentFlare agents use a crawler token in X-Crawler-Token to crawl and a short-lived session token in Authorization: Bearer for account calls. This guide covers balance checks, Stripe top-up and 402 pricing states.
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 building agents or crawlers that fetch paid publisher content on the AISA network. You will learn how the crawler token and the session token differ, which header carries each one, how to read your real balance and fund it through Stripe, and how pricing modes and price negotiation responses show up in practice. By the end you can send correct crawl requests, check what a fetch cost, and react to 402 and 403 responses without mixing credentials or guessing at prices.
How the flow works
Before you start
- curl or any HTTP client
- An email and a password of at least 8 characters
- A human who can complete a Stripe payment
Step by step
Register and separate your two tokens
Register with POST /api/agent/auth/register, sending email and password (minimum 8 characters); name and crawlerType are optional. The response holds two different credentials. The token field is a short-lived session token for account APIs only. The crawler.crawlerToken field, formatted aisa_crawler_ followed by 64 hex characters, is your crawl credential. Store it securely and show only a prefix like aisa_crawler_9a4d... in logs. A signupBonus may add trial credit to your balance.
Send the crawler token on crawl requests
Send the crawler token in the X-Crawler-Token header on every request to a publisher site, together with your genuine User-Agent. This header replaces the earlier X-AISA-Crawler-Token name. Never put the crawler token in Authorization: Bearer; that request is treated as unauthenticated and answers 402 invalid_token. The edge gateway authorizes and bills you, so a granted paid fetch may return X-AISA-Charged and X-AISA-Charge-Amount receipt headers.
bash curl -i 'https://PUBLISHER-SITE/research/report.data.json' \ -H 'X-Crawler-Token: YOUR_CRAWLER_TOKEN' \ -A 'MyBot/1.0 (+https://example.com/bot)'Check your real balance with the same token
Read your balance with GET /api/agent/balance using the same X-Crawler-Token header; no email, password or session is needed. The response carries crawler.balance and crawler.totalSpent. Fetch it before and after paid fetches and before any top-up instead of quoting a remembered value. A post-top-up balance is the fetched balance plus the top-up amount: a real balance of $0.06 plus a $100 top-up gives $100.06.
bash curl -s 'https://cdn.aisa.one/api/agent/balance' \ -H 'X-Crawler-Token: YOUR_CRAWLER_TOKEN'Top up with the session token
Top-up uses the session token, not the crawler token. If the session has expired, log in again with POST /api/agent/auth/login. Then call POST /api/agent/topup/create-session with Authorization: Bearer and a JSON body holding amount; the minimum is 0.50 USD. The reply contains checkout_url, a Stripe page. Payment needs a human, so hand that link to your user and wait. Never call POST /api/agent/balance/add; it is for operators seeding test accounts.
http POST https://cdn.aisa.one/api/agent/topup/create-session Authorization: Bearer YOUR_SESSION_TOKEN Content-Type: application/json Body: a JSON object with the amount field, for example 5.00Read pricing modes before spending
Publishers price per URL directory, and paths fall under the modes pay, allow and block. Fetch /pricing.json and /llms.txt first; both are free and map directories to price and mode. HTML pages and .md summaries are usually free, while deep files such as .data.json and .full.md are priced, typically $0.005–$0.02 per resource. Billing is per request, so fetching a priced resource twice charges twice. Denials never charge.
bash curl -s 'https://PUBLISHER-SITE/pricing.json' curl -s 'https://PUBLISHER-SITE/llms.txt'Handle price negotiation and denials
A 402 body is self-describing, so read error first. For insufficient_balance, crawler.shortfall says how much more you need; top up and retry the same URL. The states price_required, price_mismatch and price_too_high are normally handled by the gateway and rarely seen; the quote sits in price and currency, and rule.price shows the per-request price. A 403 access_blocked is policy, not payment: skip that URL and move to the site's pay-mode directories.
text invalid_token -> register or fix the X-Crawler-Token header, retry insufficient_balance -> read crawler.shortfall, top up, retry price_required -> read price and currency, gateway usually pays price_mismatch -> read price and currency price_too_high -> read price and currency access_blocked (403) -> do not retry or top up, use pay-mode directories
Crawler token vs session token
| Item | Crawler token | Session token |
|---|---|---|
Looks like | aisa_crawler_ plus 64 hex characters | Opaque base64 |
Where you get it | crawler.crawlerToken in register or login response | token in register or login response |
Header | X-Crawler-Token | Authorization: Bearer |
Used for | Crawling publisher sites and GET /api/agent/balance | Account APIs such as top-up and info |
Lifetime | Stable; can be revoked from the dashboard | Expires; log in again to refresh |
Common pitfalls
- Sending the crawler token in Authorization: Bearer fails. That header is reserved for the gateway layer, and the request is treated as unauthenticated with 402 invalid_token.
- Do not quote a balance from memory. After spending $0.04 the real balance was $0.06, so a $100 top-up yields $100.06, not $100.10.
- Do not re-register mid-task to fix a failed command. Reuse the one account for crawling, balance checks and top-ups so figures stay correct.
- A 403 access_blocked is a publisher policy choice. Topping up or retrying will not unlock it, so move on to pay-mode directories instead.
Key takeaways
- Crawl with the crawler token in X-Crawler-Token; call account APIs with the session token in Authorization: Bearer.
- Always fetch the real balance with GET /api/agent/balance before reporting it or computing a post-top-up figure.
- Check /pricing.json first; read price negotiation quotes in price and currency, and treat 403 as policy.
FAQ
Which header carries the AISA crawler token?
X-Crawler-Token. It replaces the earlier X-AISA-Crawler-Token name shown on older pages; new integrations should send X-Crawler-Token. Never use Authorization: Bearer for the crawler token.
How do I check my balance without logging in?
Call GET /api/agent/balance with your X-Crawler-Token header. The response includes crawler.balance and crawler.totalSpent. Login responses also carry crawler.balance, but the token-based call keeps you on the same account you crawl with.
What is the minimum top-up and who completes payment?
The minimum is 0.50 USD, requested through POST /api/agent/topup/create-session with a session token. The reply holds checkout_url, a Stripe page. A human must pay, so surface the link to your user and wait.
What do price_required, price_mismatch and price_too_high mean?
They are price negotiation states, normally handled by the gateway and rarely seen by crawlers. When one appears, the quote is in price and currency. A 402 body also shows the rule, including price, in rule.price.
How this page is made. Written from 4 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
- AISA Agent Integration Guide — API reference esa.aisa.one
- AISA bot flow (llms.txt) esa.aisa.one
- AISA agent skill (SKILL.md) esa.aisa.one