Nations of War API
A read-only HTTP API for pulling live game data (nations, businesses, the stock market and more) straight from the source.
Read-only. Keys can read data, never change it. Every endpoint is GET.
Getting a key
Keys are personal, one per Discord account, and are minted from Discord, not from this site.
- In the Discord server, run
/developer. - Click Create API Key. Your key is shown once, so copy it somewhere safe.
- Lost it, or think it leaked? Run
/developeragain and hit Regenerate. This invalidates the old key.
The key is only ever displayed at the moment it is created or regenerated. There is no way to look it up again, so treat it like a password.
Base URL
https://api.method-gaming.com
Authentication
Send your key as a Bearer token on every request. The header X-API-Key: <key> also works.
Authorization: Bearer mgk_your_key_here
Example request
# fetch every nation
curl -H "Authorization: Bearer mgk_your_key_here" \
https://api.method-gaming.com/api/v1/nations
Rate limits
Up to 120 requests per minute, per key. Each response includes X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Exceeding the limit returns 429 with a Retry-After header.
Endpoints
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/v1/health | Public | Liveness probe. Returns the API version. No key required. |
| GET | /api/v1 | Key required | Index of available resources. |
| GET | /api/v1/me | Key required | Your own linked account (SteamID, nation, credits) and key usage stats. |
| GET | /api/v1/nations | Key required | Every nation. |
| GET | /api/v1/nations/:name | Key required | One nation by name (case-insensitive). |
| GET | /api/v1/businesses | Key required | Every business. |
| GET | /api/v1/businesses/:id | Key required | One business by id. |
| GET | /api/v1/stock-market | Key required | Current stock market state and prices. |
| GET | /api/v1/terrorists | Key required | Every terrorist organisation. |
| GET | /api/v1/terrorists/:name | Key required | One terrorist organisation by name. |
| GET | /api/v1/news-organizations | Key required | Every news organisation. |
| GET | /api/v1/events/oil-market | Key required | Oil market event state. |
| GET | /api/v1/events/forges | Key required | Active forge jobs. |
| GET | /api/v1/events/schedule | Key required | Scheduled world events. |
| GET | /api/v1/events/action-required | Key required | Pending action-required items. |
Responses
Collections return a JSON array of the raw entity objects; single-item lookups return one object. A successful /api/v1/nations/:name looks like:
{
"name": "Aston",
"ideology": "Democratic",
"gdp": 125000,
"stability": 100,
"currencyName": "Aston Currency",
"currencyValue": 1,
"citizens": 12,
"allies": [],
"enemies": []
// ...plus every other field on the nation
}
Errors
Errors return a JSON body { "ok": false, "error": "..." } with an appropriate status code:
401: missing, invalid, or revoked key
404: unknown endpoint, or item not found
429: rate limit exceeded (see Retry-After)