szstate.ru API Reference

A read-only HTTP API providing aggregated player-population data for a StalCraft game server instance. All responses are returned as JSON, encoded in UTF-8.

Base URL

https://api.szstate.ru/{endpoint}?key=

All requests are made over HTTPS using the GET method.

Authentication

Requests must include a key query parameter. In the current API version this parameter is accepted with an empty value. Key issuance and validation will be enforced in a subsequent version without altering the request format described in this document.

Rate limiting

Each client IP address is limited to 10 requests per 60-second window. The window is fixed and resets on expiry. Every response, except /rateLimit, includes the following headers:

HeaderDescription
X-RateLimit-LimitMaximum requests permitted per window (10)
X-RateLimit-RemainingRequests remaining in the current window
X-RateLimit-ResetUnix timestamp marking the end of the current window

Requests exceeding the limit receive HTTP 429 with a Retry-After header specifying seconds until reset.

GET/onlineNow

Returns the current player count at the time of the request.

FieldTypeDescription
currentintegerNumber of players currently online
server_timestringTimestamp of response generation, YYYY-MM-DD HH:MM:SS
{"current": 11815, "server_time": "2026-08-22 12:00:00"}

GET/StatAvg

Returns average player-count values over several rolling time periods.

FieldTypeDescription
today_avgintegerAverage over the current day
week_avgintegerAverage over the current week
month_avgintegerAverage over the current month
year_avgintegerAverage over the current year
server_timestringTimestamp of response generation
{"today_avg": 12873, "week_avg": 13504, "month_avg": 13564, "year_avg": 14278, "server_time": "2026-08-22 12:00:00"}

GET/onlineStat

Returns a time series of aggregated player-count data points for a specified reporting period.

ParameterTypeRequiredDescription
timeenumNo — defaults to dayReporting period. One of: day, week, month, year
countintegerNoNumber of most recent data points to return, counted backward from the newest available point. Maximum permitted value is 10; higher values are clamped. When omitted, all available points for the selected period are returned.
offsetintegerNo — defaults to 0Number of points to skip, counted backward from the newest available point.
The shape of each object in points differs by reporting period, as detailed below. Consumers should branch on the time value used in the request when parsing point objects.

time=day

FieldTypeDescription
tintegerUnix timestamp in milliseconds marking the data point
vintegerPlayer count at that point
labelstringHuman-readable timestamp, YYYY-MM-DD HH:MM:SS
maintenancebooleanWhether this point overlapped with a scheduled maintenance window
{"t": 1787348581713, "v": 11139, "label": "2026-08-22 00:43:01", "maintenance": false}

time=week

FieldTypeDescription
week_startstringTimestamp marking the start of the aggregation interval
avg, min, maxintegerPlayer count statistics within the interval
maintenancebooleanWhether the interval overlapped with a scheduled maintenance window
{"week_start": "2026-08-21 23:30:00", "avg": 14119, "min": 13194, "max": 14962, "maintenance": false}

time=month

FieldTypeDescription
datestringCalendar date, YYYY-MM-DD
avg, min, maxintegerPlayer count statistics within the day
maintenancebooleanWhether the day included a scheduled maintenance window
{"date": "2026-07-23", "avg": 17013, "min": 4648, "max": 37021, "maintenance": false}

time=year

FieldTypeDescription
week_startstringTimestamp marking the start of the aggregation interval
avg, min, maxintegerPlayer count statistics within the interval
maintenancebooleanWhether the interval overlapped with a scheduled maintenance window
{"week_start": "2025-08-22 01:00:00", "avg": 5970, "min": 5970, "max": 5970, "maintenance": false}

Response envelope

{
  "time": "week", "count": 2, "offset": 0, "total": 336,
  "points": [ /* objects as documented above for the selected period */ ],
  "server_time": "2026-08-22 12:00:00"
}

GET/rateLimit

Returns the current rate-limit window status for the requesting IP address. This endpoint does not itself count against the rate limit.

FieldTypeDescription
limitintegerMaximum requests permitted per window
usedintegerRequests already counted within the current window
remainingintegerRequests remaining in the current window
reset_inintegerSeconds remaining until the window resets
{"limit": 10, "used": 3, "remaining": 7, "reset_in": 42, "server_time": "2026-08-22 12:00:00"}

Error responses

Errors are returned with an appropriate HTTP status code and a JSON body containing an error field.

HTTP StatuserrorDescription
400invalid_time_use_day_week_month_yearThe time parameter was not one of the accepted values
404not_foundThe requested data resource could not be located
429rate_limit_exceededThe rate limit has been exceeded; see the Retry-After header
500invalid_dataThe underlying data resource is missing or malformed
szstate.ru API · version 1.0