Authentication
All non-public Arch Indexer API endpoints require an API key. Keys are tied to an account and plan (Free or Enterprise) and are used for both HTTP and WebSocket access.
Getting an API key
- Register a new account via the Developer Portal at
/devor withPOST https://explorer.arch.network/api/v1/v1/auth/register. - Optionally log in with
POST https://explorer.arch.network/api/v1/v1/auth/loginfor backend workflows. - Use the onboarding wizard in the Developer Portal to create your first app.
- From the app dashboard, create additional app-scoped keys as needed for different environments (e.g. Production vs Staging).
Example: create an account
POST https://explorer.arch.network/api/v1/auth/register
Content-Type: application/json
{
"email": "you@example.com",
"password": "a-strong-password"
}Using API keys with REST
Send your key in either of these headers:
Authorization: Bearer <API_KEY>(recommended)X-API-Key: <API_KEY>
curl example
# Mainnet
curl "https://explorer.arch.network/api/v1/mainnet/blocks?limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"
# Testnet
curl "https://explorer.arch.network/api/v1/testnet/blocks?limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"JavaScript example (fetch)
// Mainnet
const res = await fetch('https://explorer.arch.network/api/v1/mainnet/blocks?limit=10', {
headers: {
Authorization: 'Bearer ' + process.env.ARCH_API_KEY,
},
});
const data = await res.json();
// Testnet
const resTestnet = await fetch('https://explorer.arch.network/api/v1/testnet/blocks?limit=10', {
headers: {
Authorization: 'Bearer ' + process.env.ARCH_API_KEY,
},
});
const dataTestnet = await resTestnet.json();Using API keys with WebSockets
WebSocket connections require an API key. Pass it as the apikey query parameter; the same key works for both network-scoped endpoints.
# Mainnet
wss://explorer.arch.network/ws/mainnet?apikey=YOUR_API_KEY
# Testnet
wss://explorer.arch.network/ws/testnet?apikey=YOUR_API_KEYBrowser example
// Use 'wss://explorer.arch.network/ws/testnet' for testnet.
const ws = new WebSocket('wss://explorer.arch.network/ws/mainnet?apikey=' + apiKey);
ws.onopen = () => {
ws.send(JSON.stringify({ method: 'subscribe', topic: 'block' }));
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
console.log('event', msg);
};Apps and app-scoped keys
Each account can own multiple apps. Apps are logical containers for keys and usage – for example, "Wallet backend" or "Analytics dashboard". You create and manage apps and their keys from the Developer Portal; the underlying management APIs are not exposed as part of the public surface area.
Error responses
Authentication errors use a consistent JSON shape:
HTTP 401
{
"error": "missing_api_key",
"message": "API key is required. Provide it via the Authorization: Bearer <key> header or X-API-Key header."
}