Skip to content

Swagger examples

This page is the common request catalog for game profiles, project networks, protected servers, attack incidents, raw events, and traffic. The examples are static and never send or store credentials.

Limits and behavior are described in the matching API section. The planned server update operation is not listed here until it is approved for production integrations.

Complete API examples

Castles API request catalog

Static Swagger-style requests and shortened responses for every currently implemented public operation.

Examples only
Castles API has two independent credential scopes. Use only the header shown for each group.

These examples do not send requests or store credentials. Replace placeholders locally and keep secrets out of URLs and logs.

Game profiles and protected servers

Project-scoped operations for profiles, networks, and server lifecycle.

Authorization: Bearer <token>
GET/{project}/v2/games

List game profiles available to the project.

Example parameters

Pathprojectexample-project

Request

curl
curl \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/example-project/v2/games'

Response

200 Successful response
json
[
  {
    "id": "ark",
    "name": "ARK: Survival Evolved",
    "main_port_id": "game"
  }
]
Response schema
[]GameProfile[]
[].idstring
[].namestring
[].main_port_idstring
GET/{project}/v2/network

List networks assigned to the project.

Example parameters

Pathprojectexample-project

Request

curl
curl \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/example-project/v2/network'

Response

200 Successful response
json
[
  "192.0.2.0/24",
  "198.51.100.0/24"
]
Response schema
[]string[]
[] valueCIDR string
GET/{project}/v2

List protected servers with pagination and an optional end-user filter.

Example parameters

Pathprojectexample-project
Querystart0
Querylength50
QueryendUsercustomer-example

Request

curl
curl \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/example-project/v2?start=0&length=50&endUser=customer-example'

Response

200 Successful response
json
{
  "rows": [
    {
      "game": "ark",
      "ipAddress": "192.0.2.10",
      "enduser": "customer-example",
      "ports": {
        "game": 29016,
        "query": 29015,
        "rcon": 29020
      },
      "protection": {
        "status": "online",
        "address": "192.0.2.10/29016",
        "additional": "query:29015, rcon:29020",
        "comment": "Protected game server"
      }
    }
  ],
  "total_count": 1
}
Response schema
rows[]GameServer[]
total_countinteger
GET/{project}/v2/{ip_address}

List protected servers registered on one public address.

Example parameters

Pathprojectexample-project
Pathip_address192.0.2.10

Request

curl
curl \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/example-project/v2/192.0.2.10'

Response

200 Successful response
json
[
  {
    "game": "ark",
    "ipAddress": "192.0.2.10",
    "enduser": "customer-example",
    "ports": {
      "game": 29016,
      "query": 29015,
      "rcon": 29020
    },
    "protection": {
      "status": "online",
      "address": "192.0.2.10/29016",
      "additional": "query:29015, rcon:29020",
      "comment": "Protected game server"
    }
  }
]
Response schema
[]GameServer[]
[].ipAddressIPv4 string
[].portsPorts
GET/{project}/v2/{ip_address}/{main_port}

Load one protected server by address and primary port.

Example parameters

Pathprojectexample-project
Pathip_address192.0.2.10
Pathmain_port29016

Request

curl
curl \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/example-project/v2/192.0.2.10/29016'

Response

200 Successful response
json
{
  "game": "ark",
  "ipAddress": "192.0.2.10",
  "enduser": "customer-example",
  "ports": {
    "game": 29016,
    "query": 29015,
    "rcon": 29020
  },
  "protection": {
    "status": "online",
    "address": "192.0.2.10/29016",
    "additional": "query:29015, rcon:29020",
    "comment": "Protected game server"
  }
}
Response schema
gamestring
ipAddressIPv4 string
enduserstring
portsPorts
protectionProtection
POST/{project}/v2/{ip_address}

Add a game server to protection.

Example parameters

Pathprojectexample-project
Pathip_address192.0.2.10

Request

curl
curl \
  -X POST \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"game":"ark","ports":{"game":29016,"query":29015,"rcon":29020},"enduser":"customer-example"}' \
  'https://api.castles.pro/example-project/v2/192.0.2.10'

Response

200 Successful response
json
{
  "game": "ark",
  "ipAddress": "192.0.2.10",
  "enduser": "customer-example",
  "ports": {
    "game": 29016,
    "query": 29015,
    "rcon": 29020
  },
  "protection": {
    "status": "online",
    "address": "192.0.2.10/29016",
    "additional": "query:29015, rcon:29020",
    "comment": "Protected game server"
  }
}
Response schema
gamestring
ipAddressIPv4 string
portsPorts
protection.statusprotected | online | updating | deleted
DELETE/{project}/v2/{ip_address}/{main_port}

Remove one protected server after confirming its address and primary port.

Example parameters

Pathprojectexample-project
Pathip_address192.0.2.10
Pathmain_port29016

Request

curl
curl \
  -X DELETE \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/example-project/v2/192.0.2.10/29016'

Response

200 Successful response
json
{
  "status": true
}
Response schema
statusboolean

Attack events and traffic

CIDR-scoped attack incidents, raw events, charts, and aggregate traffic.

X-API-Key: <api_key>
GET/alerts/incidents

List logical incidents after tenant filtering and detector-event grouping.

Example parameters

Querydays7
Querylimit20
Queryseverityhigh,middle

Request

curl
curl \
  -H 'X-API-Key: <api_key>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/alerts/incidents?days=7&limit=20&severity=high,middle'

Response

200 Successful response
json
{
  "status": "success",
  "payload": {
    "total": 1,
    "limit": 20,
    "offset": 0,
    "results": [
      {
        "incidentId": "inc_example_001",
        "target": "192.0.2.44",
        "layer": "L3",
        "active": false,
        "severity": "high",
        "startTime": "2026-08-22T15:23:55Z",
        "stopTime": "2026-08-22T15:45:31Z",
        "peakBps": 209280000000,
        "peakPps": 18100000,
        "sourceEventCount": 2,
        "availableMetrics": [
          "bps",
          "pps"
        ],
        "breakdownAvailable": true
      }
    ]
  }
}
Response schema
payload.totalinteger
payload.limitinteger
payload.offsetinteger
payload.results[]IncidentSummary[]
GET/alerts/incidents/{incidentId}

Load metadata, source events, chart series, and traffic breakdowns for one incident.

Example parameters

PathincidentIdinc_example_001

Request

curl
curl \
  -H 'X-API-Key: <api_key>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/alerts/incidents/inc_example_001'

Response

200 Successful response
json
{
  "status": "success",
  "payload": {
    "incident": {
      "incidentId": "inc_example_001",
      "target": "192.0.2.44",
      "layer": "L3",
      "active": false,
      "severity": "high",
      "availableMetrics": [
        "bps",
        "pps"
      ]
    },
    "sourceEvents": [
      {
        "eventId": "evt_example_001",
        "detector": "BPS",
        "active": false
      }
    ],
    "traffic": {
      "continuous": true,
      "bps": {
        "unit": "bps",
        "peakValue": 209280000000,
        "points": []
      },
      "pps": {
        "unit": "pps",
        "peakValue": 18100000,
        "points": []
      },
      "rps": null
    },
    "breakdown": {
      "topAs": [],
      "topIp": [],
      "topProtocols": []
    }
  }
}
Response schema
payload.incidentIncidentSummary
payload.sourceEvents[]RawEvent[]
payload.trafficTrafficExport
payload.breakdownTrafficBreakdown
GET/alerts/aggregate-traffic

Build one deduplicated traffic series across visible attack targets.

Example parameters

Querydays7
Querymetricbps
Querylayerl3
Queryseverityhigh,middle

Request

curl
curl \
  -H 'X-API-Key: <api_key>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/alerts/aggregate-traffic?days=7&metric=bps&layer=l3&severity=high,middle'

Response

200 Successful response
json
{
  "status": "success",
  "payload": {
    "metric": "bps",
    "fromTime": "2026-08-15T15:45:31Z",
    "toTime": "2026-08-22T15:45:31Z",
    "bucketSeconds": 300,
    "peakValue": 209280000000,
    "lastValue": 0,
    "trafficTargets": 1,
    "trafficEventGroups": 1,
    "collapsedDetectorEvents": 1,
    "maxSimultaneousTargets": 1,
    "points": [
      {
        "timestamp": "2026-08-22T15:25:00Z",
        "value": 209280000000,
        "attackCount": 1,
        "contributors": [
          {
            "eventId": "evt_example_001",
            "layer": "l3",
            "target": "192.0.2.44",
            "value": 209280000000
          }
        ]
      }
    ]
  }
}
Response schema
payload.metricbps | pps | rps
payload.bucketSecondsinteger
payload.points[]AggregatePoint[]
payload.points[].contributors[]TrafficContributor[]
GET/alerts

List individual detector events for audit and low-level diagnostics.

Example parameters

Querydays7
Querylimit10
Queryseverityhigh,middle

Request

curl
curl \
  -H 'X-API-Key: <api_key>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/alerts?days=7&limit=10&severity=high,middle'

Response

200 Successful response
json
{
  "status": "success",
  "payload": {
    "total": 1,
    "limit": 10,
    "offset": 0,
    "results": [
      {
        "uid": "evt_example_001",
        "layer": "L3",
        "target": "192.0.2.44",
        "active": false,
        "detector": "BPS",
        "severity": "high",
        "startTime": "2026-08-22T15:23:55Z",
        "stopTime": "2026-08-22T15:45:31Z",
        "peakBps": 209280000000,
        "peakPps": 18100000,
        "peakRps": null
      }
    ]
  }
}
Response schema
payload.totalinteger
payload.results[]RawEvent[]
payload.results[].uidstring
payload.results[].peakBpsnumber | null
GET/alerts/{layer}/{uid}

Load one individual detector event by layer and event identifier.

Example parameters

Pathlayerl3
Pathuidevt_example_001

Request

curl
curl \
  -H 'X-API-Key: <api_key>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/alerts/l3/evt_example_001'

Response

200 Successful response
json
{
  "status": "success",
  "payload": {
    "uid": "evt_example_001",
    "layer": "L3",
    "target": "192.0.2.44",
    "active": false,
    "detector": "BPS",
    "severity": "high",
    "startTime": "2026-08-22T15:23:55Z",
    "stopTime": "2026-08-22T15:45:31Z",
    "peakBps": 209280000000,
    "peakPps": 18100000
  }
}
Response schema
payload.uidstring
payload.layerL3 | L7
payload.targetstring
payload.activeboolean
GET/alerts/{layer}/{uid}/traffic

Load the original chart series and available Top traffic breakdowns for one event.

Example parameters

Pathlayerl3
Pathuidevt_example_001
Querytypeas

Request

curl
curl \
  -H 'X-API-Key: <api_key>' \
  -H 'Accept: application/json' \
  'https://api.castles.pro/alerts/l3/evt_example_001/traffic?type=as'

Response

200 Successful response
json
{
  "status": "success",
  "source": "provider",
  "continuous": true,
  "payload": {
    "items": [
      {
        "name": "total",
        "data": [
          {
            "timestamp": "2026-08-22T15:24:00Z",
            "bits": 209280000000
          }
        ]
      },
      {
        "name": "AS64500",
        "data": [
          {
            "timestamp": "2026-08-22T15:24:00Z",
            "bits": 72000000000
          }
        ]
      }
    ],
    "tops": {
      "sourceAs": [
        {
          "asn": 64500,
          "companyName": "Example Network",
          "countryCode": "ZZ",
          "bps": 72000000000
        }
      ],
      "ip": [
        {
          "address": "198.51.100.24",
          "countryCode": "ZZ",
          "bps": 31000000000
        }
      ],
      "protocol": [
        {
          "number": 17,
          "name": "UDP",
          "bps": 190000000000
        }
      ],
      "tcpPorts": [],
      "udpPorts": []
    }
  }
}
Response schema
sourceprovider | webhook_observations
continuousboolean
payload.items[]TrafficSeries[]
payload.topsRawTrafficBreakdowns