Use your API key with confidence
This page explains the complete developer workflow: create or retrieve a credential, keep it secure, authenticate requests, send parameters, inspect responses, handle failures, monitor activity and optimize application performance.
Your API key is your application credential
API keys identify an integration when your backend communicates with protected Gaming API services. Generate keys from the developer dashboard and give each integration only the permissions it actually needs.
Create a key
Open API Keys, create a credential, select the required scope and copy the secret when it is presented.
Store it safely
Put the key in a server-side environment variable or secret manager. Do not commit it to GitHub or embed it in public HTML.
Use it server-side
Your backend attaches the credential to HTTPS requests. Your browser can call your backend without receiving the privileged key.
Rotate when necessary
Revoke exposed credentials and issue replacements. Separate development, testing and production credentials.
How to request data from the API
Use HTTPS from your trusted backend. The exact production hostname and endpoint paths must come from the deployed API contract; do not invent an endpoint based on this guide.
const response = await fetch(
'https://YOUR-API-HOST/v1/resource',
{
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.GAMING_API_KEY}`,
Accept: 'application/json'
}
}
);
const data = await response.json();YOUR-API-HOST and the resource path with the exact endpoint published for your production API.GET, POST and parameterized requests
Read resources
Use GET when retrieving information. Query parameters are useful for filtering, pagination or selecting a resource.
Create or trigger
Use POST only for operations defined by the API contract. Validate the response before treating an operation as successful.
Request body
For JSON endpoints, send an appropriate Content-Type and validate required fields before making the request.
const response = await fetch('https://YOUR-API-HOST/v1/resource', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.GAMING_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ example: true })
});Understand what the server returns
Always inspect the HTTP status before processing a response as successful. A JSON body can contain useful error details even when the HTTP status indicates failure.
| Status | Meaning | Typical action |
|---|---|---|
| 200 | Successful read or operation | Process the returned data. |
| 201 | Resource created | Store the returned identifier if required. |
| 400 | Invalid request | Fix parameters; do not blindly retry. |
| 401 | Authentication failed | Check credential validity and environment. |
| 403 | Not authorized | Check scopes and permissions. |
| 429 | Rate limit reached | Back off and follow retry guidance. |
| 5xx | Server-side failure | Retry carefully when the operation is safe. |
if (!response.ok) {
throw new Error(`API request failed: ${response.status}`);
}
const data = await response.json();Using live game updates
When the API exposes a production WebSocket gateway, use it for event-driven state updates rather than repeatedly polling an endpoint. Authentication and subscription rules must follow the deployed WebSocket contract.
const socket = new WebSocket(
'wss://YOUR-API-HOST/realtime'
);
socket.onopen = () => console.log('connected');
socket.onmessage = event => {
const message = JSON.parse(event.data);
console.log(message);
};
socket.onclose = () => console.log('disconnected');Errors, retries and idempotency
Client errors
400, 401 and 403 responses usually require a change to the request, credentials or permissions. Repeating the same request normally will not fix the problem.
Rate limits
429 means the service is asking you to slow down. Implement exponential backoff and respect Retry-After when supplied.
Transient failures
Some 5xx or network failures may be temporary. Retry with bounded exponential backoff and a maximum attempt count.
State-changing requests
For operations that change state, use an idempotency mechanism when the API contract provides one so retries do not accidentally duplicate an operation.
for (let attempt = 0; attempt < 3; attempt++) {
try {
// Make request here.
break;
} catch (error) {
await new Promise(r =>
setTimeout(r, 250 * 2 ** attempt)
);
}
}Rate limits and efficient usage
Do not assume a fixed limit unless it is published by your actual API. Build clients that can handle a changing limit safely.
Cache safe reads
Cache data that does not need second-by-second freshness and use conditional requests where supported.
Paginate
Request manageable pages instead of downloading unnecessarily large datasets in a single call.
Back off
When throttled, reduce request frequency rather than opening more concurrent connections.
What your usage dashboard should show
The developer dashboard can provide a dedicated usage view for authenticated API activity. Useful metrics include request count, successful requests, errors, recent API access, active credentials and timestamps.
Measure API performance correctly
Latency shown by a browser health check measures the path from the user's browser to the public site. It is not the same as authenticated API latency. For real API performance, measure the actual API request from your backend and record status, duration and endpoint.
Protect every request
Never log secrets
Redact API keys, access tokens, passwords and authorization headers from application logs.
Use HTTPS
Production API requests should use HTTPS. Real-time production connections should use WSS.
Least privilege
Use the smallest scope that your application needs and separate credentials by environment.
Rotate exposure
If a key is exposed, revoke it and issue a replacement immediately. Investigate where it was leaked.
Common usage questions
Can I put my API key in my website JavaScript?
No. Browser code is visible to users. Use a secure backend to keep privileged credentials private.
How do I know the exact API endpoint?
Use the endpoint defined by your deployed API documentation. This page intentionally uses placeholders where a production endpoint has not been formally published.
Should every failed request be retried?
No. Client errors such as 400, 401 and 403 generally need correction. Retry only transient failures and use bounded backoff.
What is the difference between usage and performance?
Usage measures how much the API is being used. Performance measures how quickly and reliably requests and real-time connections are served.