Skip to content

Attack alerts

Castles groups related protection observations into one customer alert and keeps that alert stable. Public responses do not identify the protection systems behind it. Each alert has an opaque Castles ID that starts with alt_ and ends with 32 lowercase hexadecimal characters.

Pass the API key in the request header:

X-API-Key: <api_key>

Each key can access only targets within its assigned IPv4 CIDR prefixes. A key with no assigned prefixes receives an empty collection. Detail and traffic requests return 404 when the alert does not exist or its target is outside the key’s scope.

Version 2 defines one common contract for L3 alerts. Timestamps use ISO 8601 in UTC. Metrics use base units: bits per second for bps and packets per second for pps.

GET/alerts/v2

Query parameters:

  • days: start-time window from 1 to 3660, default 7.
  • limit: page size from 1 to 100, default 50.
  • offset: non-negative offset up to 10000000.
  • layer: optional l3; any other layer is rejected.
  • search: optional target or Castles alert ID fragment, up to 256 characters.

This route does not accept provider or severity filters. Either filter returns 400.

Alerts are sorted by startTime, newest first.

Terminal window
curl \
-H 'X-API-Key: <api_key>' \
-H 'Accept: application/json' \
'https://api.castles.pro/alerts/v2?days=1&layer=l3&limit=20&offset=0'
{
"status": "success",
"payload": {
"pagination": {"total": 1, "limit": 20, "offset": 0, "hasMore": false},
"alerts": [{
"alertId": "alt_0123456789abcdef0123456789abcdef",
"target": "192.0.2.44",
"layer": "L3",
"startTime": "2026-08-26T10:00:00Z",
"peaks": {"bps": 310000000, "pps": 420000}
}]
}
}

When another page is available, pagination.hasMore is true. Add the current limit to offset for the next request.

GET/alerts/v2/<alertId>
Terminal window
curl \
-H 'X-API-Key: <api_key>' \
-H 'Accept: application/json' \
'https://api.castles.pro/alerts/v2/alt_0123456789abcdef0123456789abcdef'

The detail response includes the alert object returned by the collection and its current traffic object.

{
"status": "success",
"payload": {
"alert": {
"alertId": "alt_0123456789abcdef0123456789abcdef",
"target": "192.0.2.44",
"layer": "L3",
"startTime": "2026-08-26T10:00:00Z",
"peaks": {"bps": 310000000, "pps": 420000}
},
"traffic": {
"alertId": "alt_0123456789abcdef0123456789abcdef",
"windowStart": "2026-08-26T09:59:00Z",
"windowEnd": "2026-08-26T10:09:00Z",
"bps": [
{"timestamp": "2026-08-26T10:00:00Z", "value": 155000000},
{"timestamp": "2026-08-26T10:01:00Z", "value": 310000000}
],
"pps": [
{"timestamp": "2026-08-26T10:00:00Z", "value": 210000},
{"timestamp": "2026-08-26T10:01:00Z", "value": 420000}
],
"breakdown": {
"topSourceIps": [{
"address": "198.51.100.24",
"bps": 95000000,
"pps": 120000
}],
"sourceCountries": [{"code": "ZZ", "name": "Example Country"}],
"protocols": [{
"number": 17,
"name": "UDP",
"bps": 290000000,
"pps": 390000
}],
"sourcePorts": [{
"port": 53,
"protocol": "UDP",
"bps": 80000000,
"pps": 110000
}],
"destinationPorts": [{
"port": 443,
"protocol": "TCP",
"bps": 70000000,
"pps": 90000
}]
}
}
}
}

These screenshots use synthetic values to show how the dashboard renders the response. The JSON schema above defines the API contract.

Synthetic Castles alert summary with public v2 fields

GET/alerts/v2/<alertId>/traffic

This endpoint returns only the traffic telemetry, for refreshing it without the full alert.

Terminal window
curl \
-H 'X-API-Key: <api_key>' \
-H 'Accept: application/json' \
'https://api.castles.pro/alerts/v2/alt_0123456789abcdef0123456789abcdef/traffic'

The response places the traffic object shown above directly in payload. The bps and pps arrays are the canonical total series. Each point contains a UTC timestamp and a numeric value.

Unavailable peaks and breakdown measurements are null. Missing series and breakdown categories are empty arrays. Castles does not replace unavailable data with zero. When protection sources report the same identity or timestamp, Castles keeps the maximum value instead of adding the observations together.

The breakdown object contains only topSourceIps, sourceCountries, protocols, sourcePorts, and destinationPorts. It does not return provider names, upstream IDs, lifecycle fields, severity, RPS, Top AS, packet sizes, percentages, or provider counters.

The dashboard displays bps as one total time series.

Synthetic total BPS traffic series

The map uses the countries listed in sourceCountries. The API response does not include a separate rate for each country.

Synthetic source countries map

  • 200: request completed.
  • 400: invalid list bounds or filter.
  • 401: API key missing or rejected.
  • 404: alert absent or outside the key’s CIDR scope.
  • 422: alert telemetry exceeds the bounded processing limit.
  • 500: internal service error.