Skip to content

Castles API

Castles API connects game servers to protection, reports their current state, and provides access to recorded attack events.

https://api.castles.pro

All requests use HTTPS. Production integrations must validate the server certificate.

Castles API has two independent credential scopes.

Scope Authentication Purpose
Game server management Authorization: Bearer <token> Games, project networks, and protected server lifecycle
Attack events X-API-Key: <api_key> Attack lists, event details, charts, and traffic distributions

Credentials are issued separately. Do not send a Bearer token to attack endpoints or an attack API key to server management endpoints.

https://api.castles.pro/<project>/v2

<project> is the project identifier issued during onboarding. Examples use <token>, <api_key>, and documentation-only IP addresses.

  1. Obtain the project identifier and its Bearer token from Castles.
  2. Request the available game profiles.
  3. Request the networks assigned to the project.
  4. Confirm that the game server address belongs to an assigned network.
  5. Select a game profile and validate all supplied ports against its ranges.
  6. Add the server to protection.
  7. Read the server and verify protection.status.

Game servers

List, create, inspect, and remove protected game servers. Open server API

Attack events

Query attacks, details, charts, and traffic distributions. Open attack API

Errors and security

Response codes, secret handling, and support diagnostics. Open security guide

Request and response bodies use JSON. Send Content-Type: application/json with requests that contain a body. Ports are integers from 1 to 65535 and must also match the range allowed for the selected game.

Attack timestamps use ISO 8601 and are normally returned in UTC.