Agents on FastNear
This page is the operational starting point for AI agents, crawlers, and automation runtimes using FastNear. The goal is simple: identify the user's actual task, choose one FastNear API first, fetch the smallest useful result, and only widen to another API when there is a clear missing piece.
If you only need the next step
- Need to decide which FastNear API to start with? Use Choosing the Right Surface.
- Need credential handling rules? Use Auth for Agents.
- Need example multi-step workflows? Use Agent Playbooks.
- Need exact endpoint docs now? Go directly to RPC Reference, FastNear API, Transactions API, Transfers API, NEAR Data API, or KV FastData API.
FastNear for agents in one minute
- Use indexed APIs when the user wants a product-shaped answer such as balances, holdings, account history, or transfer history.
- Use RPC Reference when the user needs canonical protocol-native fields, contract calls, or transaction submission.
- Use NEAR Data API when the question is about recent optimistic or finalized blocks and explicit polling.
- Use Snapshots for operator workflows, not application-level data reads.
- One FastNear API key works across the RPC and REST APIs.
- Stop after the first sufficient answer. Do not collect from multiple APIs unless the current result is insufficient.
What to resolve before the first request
Try to identify these inputs before you make a call:
- Network: mainnet or testnet.
- Primary identifier: account ID, public key, transaction hash, receipt ID, block height/hash, contract ID plus storage key, or node/bootstrap task.
- Answer shape: summary, history, canonical protocol output, or operator instructions.
- Freshness requirement: historical, current, optimistic/latest, or finalized/latest.
- Precision requirement: indexed summary is acceptable, or exact canonical node semantics are required.
If one of these is missing, make a small assumption when the likely starting API does not change. Ask a clarifying question only when the wrong API choice would materially change the result.
FastNear APIs at a glance
| API | Start here when... | Typical inputs | Widen only if... |
|---|---|---|---|
| FastNear API | The user wants balances, NFTs, staking, public-key resolution, or an account summary | account_id, public key | The user needs exact canonical node fields |
| RPC Reference | The user wants canonical protocol output, contract calls, validator data, or transaction submission | account_id, block height/hash, method-specific params | The user also needs a higher-level summary or indexed history |
| Transactions API | The user wants transaction, receipt, account, or block execution history | transaction hash, receipt ID, account_id, block identifiers | The user needs exact RPC-level follow-up or finality semantics |
| Transfers API | The user wants transfer-only history | account_id, transfer filters | The question broadens to general execution context |
| NEAR Data API | The user wants recent optimistic or finalized blocks, headers, or latest-block helpers | block height/hash, freshness requirement | The user needs exact canonical block/state follow-up |
| KV FastData API | The user wants indexed contract key history or latest indexed key-value state | contract ID, storage key | The user needs exact on-chain current state |
| Snapshots | The user is standing up infrastructure | network, node type, operator goal | The user shifts to application-level chain questions |
Default workflow
Use this loop unless the task clearly needs something more specialized:
- Translate the user's wording into the task they actually need solved. Examples: account summary, canonical state inspection, transaction investigation, transfer-only history, recent block monitoring, or node bootstrap.
- Pick one FastNear API first. Do not gather from multiple APIs until the first result proves insufficient.
- Pull the smallest relevant docs context. Use the API index page, endpoint page, or Markdown mirror instead of broad unrelated docs.
- Make the first request that matches the user's identifier and expected answer shape.
- Stop if the result is already sufficient to answer the user's question.
- Widen only when you can name the missing piece precisely. Examples: canonical confirmation, broader execution history, fresher block-family data, or exact protocol fields.
Good defaults
When the user's wording is short but the intent is common, these defaults are usually correct:
- "Check this account" usually starts with FastNear API.
- "Check this public key" usually starts with FastNear API for key-to-account resolution.
- "Check this transaction" usually starts with Transactions API.
- "Check this receipt" usually starts with Transactions API.
- "Check this block" usually starts with NEAR Data API for recent-block monitoring or RPC Reference for exact canonical block data.
- "Check this contract key/history" usually starts with KV FastData API.
- "Help me bootstrap a node" starts with Snapshots.
Full routing rules and tradeoffs live in Choosing the Right Surface.
Widen carefully
Good escalation patterns:
- Start with FastNear API, then move to RPC Reference if the user asks for exact canonical confirmation.
- Start with Transactions API, then move to RPC Reference if the user needs protocol-level transaction or receipt follow-up.
- Start with Transfers API, then widen to Transactions API if the user broadens the question beyond transfer events.
- Start with NEAR Data API, then move to RPC Reference if the user needs exact canonical block or state inspection.
Bad pattern:
- Pull from several FastNear APIs before you know what the user actually needs. That usually produces a noisier answer, not a better one.
Authenticate once, reuse everywhere
Public endpoints work without a key. Add a key for higher limits or paid access patterns. The same key works across every FastNear API above; send it either as an HTTP header or a URL parameter:
curl "https://rpc.mainnet.fastnear.com" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
--data '{"method":"block","params":{"finality":"final"},"id":1,"jsonrpc":"2.0"}'
curl "https://rpc.mainnet.fastnear.com?apiKey=${API_KEY}"
Get a key from dashboard.fastnear.com. Operational posture for non-interactive runtimes: Auth for Agents — keys go in env vars or a secret manager, never in browser storage, chat logs, or prompts. Full flow and header details: Auth & Access.
Pull clean docs into a prompt
- Every page has a Copy Markdown button in the top-right toolbar. It emits a navigation-chrome-free Markdown version of the page, ready to paste into a prompt or RAG store.
- The
llms.txtconvention is mirrored here:/llms.txt— index of pages and short descriptions./llms-full.txt— the full docs corpus concatenated into one file.- Russian-locale equivalents live at
/ru/llms.txtand/ru/llms-full.txt.
- Machine-readable site structure for graph-aware ingestion:
/structured-data/site-graph.json(mirrored in/ru/). - Per-page Markdown mirrors live under the same slug with a
.mdsuffix if you prefer direct fetches over the Copy Markdown button.
Per-call hints an agent should know
- Parameter names, response fields, and example payloads are rendered live on each endpoint page. The underlying registry lives at
src/data/generatedFastnearPageModels.jsonif you are mirroring schema into another system. ?network=testnetis supported on specific pages only. Each page calls out its network support in the Auth and availability section; do not assume it works globally.- Pagination tokens (
resume_token,page_token) are opaque. Reuse them verbatim and only with the endpoint plus filter set that produced them. - Status routes: every REST family ships a
/statusand/healthpath for liveness and sync-latency inspection.
What a useful agent answer should contain
- A brief statement of which FastNear API was used and why, especially if the choice was an inference.
- The answer in the shape the user is likely to need next: summary first for humans, exact fields or next-call guidance when the caller is technical.
- Any important caveat about freshness, canonicality, pagination, or network choice.
- A follow-up path only when it is likely to help. Examples: "use RPC for canonical confirmation" or "use Transactions API if you need broader execution context."
Avoid dumping raw payloads when the user is really asking for interpretation.
Next docs by need
- Need routing depth and tradeoffs? Choosing the Right Surface
- Need credential posture and secret handling? Auth for Agents
- Need example workflows? Agent Playbooks