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 your processor / data source configuration:.setGateway(...)→ you need a key. This is the case for Substrate (SubstrateBatchProcessor), Tron (TronBatchProcessor), and any EVM/Solana squid still on a legacy gateway..setPortal(...)(Portal-based) or neither.setGateway()nor.setPortal()(RPC-only) → nothing to do; those paths don’t use a v2 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: