https://v2.archive.subsquid.io) when self-hosting requires an API key. This
guide takes a squid that reaches such a gateway without a key and adds one.
This affects self-hosted squids only. SQD Cloud deployments relying on
legacy gateways are unaffected — the platform supplies gateway access.
Does this apply to my squid?
Look at yourTronBatchProcessor configuration:
.setGateway(...)→ you need a key. Tron squids ingest historical data through a legacy v2 gateway, so this is the standard case.- No
.setGateway()(RPC-only) → nothing to do; that path doesn’t use a v2 gateway.
Tron has no Portal dataset, so — unlike EVM and Solana — there is no keyless Portal path to
migrate to. Adding a gateway API key is the way forward for Tron squids that keep reading
historical data from a legacy gateway.
1
Get an API key
Register and create a gateway API key at portal.sqd.dev/app:(The same app will also issue Portal API keys in the near future.)
The API keys app
Register and create your gateway API key
2
Update @subsquid packages
- NPM
- PNPM
- Yarn
- Bun
3
Supply the key
The processor reads the key from the Under the hood the gateway client resolves the key as
SQD_API_KEY environment variable by default, so the
simplest option needs no code change — set it in your .env:.env
options.apiKey ?? process.env.SQD_API_KEY
(in @subsquid/util-internal-archive-client), so the env variable is picked up automatically
whether you pass a bare URL or a settings object to .setGateway(...).If you prefer to pass it explicitly (e.g. to read it from a different variable), give
.setGateway(...) a settings object instead of a URL string: