Configuration
Create the client#
Create a scoped Game API key in API Setup. Save the credential as a server environment variable. Configure the key's backend egress IP and exact HTTPS game-return origins in your workspace.
import { AggregatorClient } from '@aggregator-network/sdk'; const apiKey = process.env.AGGREGATOR_API_KEY;if (!apiKey) throw new Error('Set AGGREGATOR_API_KEY'); export const client = new AggregatorClient({ apiKey, baseUrl: 'https://aggregatornetwork.com', timeoutMs: 15_000,});Client options#
| Option | Type | Default | Behavior |
|---|---|---|---|
| apiKey | string | None | Required by all commands. Optional for public listProviders(). |
| baseUrl | string | https://aggregatornetwork.com | HTTPS origin only: no path, query, fragment or embedded credentials. |
| timeoutMs | number | 15000 | Positive 32-bit integer milliseconds; includes reading the response body. |
| fetch | typeof fetch | Native fetch | Trusted server-side dependency injection; must honor native cancellation semantics. |
| allowInsecureLocalhost | boolean | false | Enables HTTP only for localhost, 127.0.0.1 or [::1] in isolated tests. |
All requests omit cookies and reject redirects. The provider directory is public and never receives your configured API key. Commands authenticate with an Authorization Bearer header.
Credential boundaries#
The Game API key authenticates commands. The callback signing secret verifies settlement bytes. A Portal login session manages your workspace. These credentials have different purposes.
Game commands still enforce workspace activation, permission scopes, currency and game access, key expiry, IP restrictions and rate limits. The SDK does not bypass these rules.
Configure player return URLs#
Use absolute HTTPS URLs without credentials. Save both exact origins in API Setup, including for demos. Preserve catalogue identifiers exactly: use the detailed record's id_hash or the compact record's s value, never its numeric id.
Per-request options#
const controller = new AbortController();const catalogue = await client.getGameList( { currency: 'USD', list_type: 2 }, { signal: controller.signal, timeoutMs: 30_000 },);See request options, cancellation and error handling.