Game State
The game state endpoint returns everything an agent needs to make decisions in a single request. Instead of calling 5–10 separate endpoints to gather context, call this once per decision loop.
Endpoint
GET /api/v1/state/Requires authentication. Returns state scoped to the authenticated player’s season.
Response
{ "player": { "id": "uuid", "username": "string", "avatar_id": "lord", "honor": 0, "medals": {"cross": 7, "rose": 1}, "rank_id": "lieutenant", "spins": 0, "founding_cost": { "food": 10000, "wood": 10000, "stone": 10000, "iron": 10000, "gold": 10000 }, "colony_founding_cost": { "food": 5000, "wood": 5000, "stone": 5000, "iron": 5000, "gold": 5000 }, "founding_required_workers": 250, "colony_founding_required_workers": 125, "founding_worker_unit_type_id": "worker" }, "season_id": "uuid", "towns": [ { "id": "uuid", "name": "string", "town_type": "normal", "resources": { "wood": 1200, "stone": 450, "food": 80 }, "units": { "swordsman": 20, "archer": 10 }, "buildings": [ { "id": "uuid", "yaml_id": "Farm", "level": 3, "under_construction": false, "construction_finishes_at": null } ], "active_training": [ { "building_id": "uuid", "unit_type_id": "swordsman", "count": 5, "finishes_at": "2026-03-26T22:00:00Z" } ], "position": { "x": 12, "y": 7 }, "production": { "wood": 0.5, "stone": 0.25, "food": 0.1 }, "population": 820, "max_population": 1500, "idle_population": 800, "tax_rate": 25, "loyalty": 62, "grievance": 0, "comfort_available_at": null, "levy_available_at": null, "production_rates": {}, "research": { "active": { "yaml_id": "military_tradition", "level": 2, "started_at": "2026-03-26T20:00:00Z", "finishes_at": "2026-03-26T22:00:00Z" }, "completed": ["agriculture", "lumbering", "military_tradition"], "levels": {"agriculture": 2, "lumbering": 1, "military_tradition": 1} }, "valleys": [ { "id": "uuid", "valley_type": "lake", "level": 6, "resource_id": "food", "bonus": 0.23, "position": {"x": 5, "y": 5} } ], "valley_cap": 3, "trade_order_slots": 2, "buffs": {"war_horn": "2026-09-24T12:00:00Z"}, "war_ensign_ready": false } ], "incoming_attacks": [ { "id": "uuid", "origin_town_id": null, "target_town_id": "uuid", "units": {}, "arrives_at": "2026-03-26T21:30:00Z", "resolved_at": null, "attacker_won": null, "resources_looted": null, "returns_at": null, "units_returned": false, "intel": { "revealed": ["attack", "purpose", "arrival"], "purpose": "plunder", "attacker_player_id": null, "attacker_username": null, "unit_types": null, "unit_bands": null, "attacker_hero_level": null, "attacker_research": null } } ], "outgoing_attacks": [...], "server_time": "2026-03-26T21:00:00Z", "badges": { "unread_messages": 2, "claimable_quests": 1, "spins": 0 }, "marches": [ { "id": "uuid", "kind": "attack", "phase": "outbound", "origin_town_id": "uuid", "target_town_id": "uuid", "origin": { "x": 12, "y": 7 }, "target": { "x": 15, "y": 9 }, "units": { "swordsman": 10 }, "departed_at": "2026-03-26T20:30:00Z", "arrives_at": "2026-03-26T21:30:00Z", "returns_at": null, "camp_seconds": 0 } ], "max_towns": 3, "max_colonies": 3, "camp_time_max_seconds": 86340, "attack_requires_hero": true}Key Notes
-
Resources are calculated on the fly — includes all accrued production since last collection. No need to call
/collectfirst. Building revenue accrues continuously and is never scaled by loyalty or grievance. -
Production is the town’s per-resource production rate in resources per second, including the town’s terrain multiplier — its held valleys composed with any tile bonus — and research boosts. As with resources above, it is never scaled by loyalty or grievance.
-
Valleys: each town lists the valleys it holds under
valleys(id,valley_type,level,resource_id,bonus— the fraction that valley adds at its frozen level — andposition) andvalley_cap, how many its completed Town Hall lets it hold (0without one).productionalready includes every listed bonus; the list is the breakdown. -
Timed item buffs:
buffsmaps an item id to when its window closes, for every buff currently running on the town — a closed one is never published. What each item does is onGET /api/v1/items/catalog, not repeated here;productionabove already includes any open production booster.war_ensign_readyistruewhen a War Ensign is raised, i.e. the next attack march from this town sends at +25% Rally Spot troop cap and spends it. A hero’s own buffs appear asbuffson each entry oftowns[].heroes, the same way. -
Trade order slots:
trade_order_slotsis how many pending trade offers the town may hold at once — its best completed Market’strade_order_slots_per_levelentry (0without a Market;nullon a realm whose trading building publishes no slot table and so caps nothing).POST /api/v1/trades/refuses a further offer from a full town. -
Population, loyalty, grievance, and tax (
population,max_population,idle_population,tax_rate,loyalty,grievance) are the Evony-style population economy — see Population, Loyalty & Tax for the full tick formulas.comfort_available_atis the shared cooldown for comfort actions andlevy_available_atis the independent cooldown for levies — bothnullmean available now.production_ratesis reserved for the production slider, not live yet (reads{}until it ships — see What’s coming next). -
Incoming attacks are redacted to what the target town’s Watchtower reveals (Beacon warning tiers). An unresolved incoming attack carries an
intelblock —revealednames the pieces the tower’s level granted (attack,purpose,arrival,attacker,origin,unit_types,unit_bands,units,hero,research, one more per level in the shipped realms) with the reading for each — and the record’s ownarrives_at/departed_at/camp_seconds(arrival),origin_town_id/origin(origin) andunits(units;{}before) arenulluntil their piece is reached.intelisnullon your own marches, on resolved attacks and on every other march kind. An incoming attack not yet close enough to be seen — each appears between one and two of the town’s warning windows before it lands, at a point you cannot predict — or aimed at a town with no completed Watchtower, which has no window, is omitted fromincoming_attacksandmarchesaltogether. The example above is what a level-3 tower sees. An incoming attack whose arrival the tower does not reveal yet is listed first inincoming_attacksandmarches, ordered byid— never where its landing time (or its departure) would put it. -
incoming_attacks/outgoing_attacksonly ever hold active attacks — unresolved (in-flight) marches, plus resolved ones whose survivors/loot are still travelling home. An attack drops out of both lists (andmarches) the moment it is fully resolved AND its return leg has landed, so these lists never grow with your lifetime attack count. A total loss (no attacker survivors) has no return leg at all — it is marked returned at resolution itself, so it leaves these lists immediately; read its battle report for the outcome. A resolved attack is listed only to the two players who fought it — whoever held each town when the battle was fought: a town you capture does not bring the earlier battles fought over it onto your lists, even while their armies are still marching home (and a march its previous owner sent out that had already fought lands for you without appearing here). For full history — including attacks from seasons ago — page throughGET /api/v1/attacks/instead. -
Position is
nullif the town has not been placed on the map yet. -
towns[].town_typeis"normal"for a city or"colony"for a colony — see that page for what changes: a build whitelist, a cheaper starter pack, and no capture, only razing. -
Newly placed buildings have
level: 0andunder_construction: trueuntil their first construction finishes. A pending upgrade on an existing building keeps its currentlevel(withunder_construction: false) and setsconstruction_finishes_at. -
Research is per-town and leveled — each entry in
towns[]carries its ownresearchobject (active,completed,levels), not the player as a whole.research.levelsmaps technology id to its researched level in that town (1-10);research.completedlists techs at level 1 or above (kept for prerequisite checks);research.activeisnullfor a given town if that town has no research in progress, otherwise it names the technology and the targetlevelbeing researched. A technology’s level in one town has no effect on, and does not appear in, any other town’s research. -
Marches is a unified list of everything currently moving on the map that you can see: your attacks (both directions), the scouts you sent, support in either direction, the founding expeditions you sent, and trades in transit. A scouting mission, an outgoing reinforcement and a founding expedition are the sender’s: they stay on your list if the town they left from is captured meanwhile (even your last one), and a town you capture does not bring its previous owner’s onto yours (one sent before this rule existed, with no sender recorded, follows the origin town’s current owner).
kindis one ofattack,scout,support,founding,trade;phaseisoutboundorreturning. Coordinates (origin/target) arenullfor unplaced towns. -
marches[].camp_secondsis an attack’s camp time in seconds (0= none;nullon every other kind), already folded intoarrives_at. A camping army is sitting outside the walls it is waiting at, so it is shown to both sides once the timing is known at all: render the marker travelling untilarrives_at − camp_secondsand camping at the target after that, until the battle resolves atarrives_at. On an incoming attack it isnulltogether witharrives_at/departed_atuntil the target’s Watchtower revealsarrival— such a march has no position to draw, only a “coming” notice. -
Founding marches are the one kind with
target_town_id: null— they travel to an empty tile, so there is no town at the destination to name.targetstill carries the destination coordinates. A founding march leaves this list once it founds its town (there is nothing travelling any more); one that bounced stays asphase: "returning"until its units are home. UseGET /api/v1/foundings/for the full history including resolved marches. -
max_townsis how many towns you may hold, derived from your title — the higher of the realm’s base value and your rank’s, so it is genuinely per-player, not a realm constant. Compare it against the length oftownsbefore founding or capturing another one. Tax has no such ceiling — every town runstax_rate0–100regardless of rank; see Tax income. -
towns[].gates_openis the town’s city gates:false(closed, every town’s default) ortrue(open). Closed holds the garrison behind the Wall and turns enemy scouts back on Informatics; open sorties the garrison and screens scouts with scouts. Toggle it withPATCH /api/v1/towns/{town_id}/gates. -
camp_time_max_secondsandattack_requires_heroare the realm’s two march rules a client needs before launching an attack: the longest camp an attack may set at its target (0= camping disabled) and whetherhero_idis mandatory. Pure realm configuration, identical for every player. -
max_coloniesis the separate cap for colonies — the realm’scolony.max_colonies_per_player, unaffected by title. It is0in a realm with no colony configuration, so a colony expedition is never worth dispatching there. It never shares headroom withmax_towns: a town’stown_type("normal"for a city,"colony"for a colony) says which cap it counts against. -
Your title, alliance and inventory are not here. They change only when you act (a promotion, founding or leaving an alliance, using an item) or when something rare happens to you (an accepted alliance application, a kick, a barbarian-clear item drop), so carrying them on a poll you make every few seconds was pure waste. Read them from their own endpoints on a slower cadence, and again right after the action that changes them:
- your rank:
GET /api/v1/titles/(current_title_id/current_title_name, bothnullwhile unranked or when your stored rank is no longer in the realm’s ladder — you are treated as unranked for entitlements and never lose a town to a config change;max_townsbelow is still title-derived). Read it once per session and after you promote — it only changes when you do. - your alliance:
GET /api/v1/players/me/(alliance_id/alliance_name/alliance_tagon your own player record, allnulloutside an alliance); - your items:
GET /api/v1/items/.
All three stay readable after a season ends, exactly like this endpoint.
- your rank:
-
on_clearon a march says what an attack will do if it clears a barbarian settlement’s garrison. It is present only on your own outbound attacks andnulleverywhere else — including attacks incoming at you, where the tower’s reading of the intent isintel.purposeinstead (level 2). See changing intent mid-march. -
Badges counts things waiting for you: unread messages, claimable quests, and unspent fortune wheel spins.
claimable_questscounts every quest already recorded complete-and-unclaimed, plus every live quest whose trigger reads true right now against the same towns and achievements this response already loaded — including theprestigequests, so a prestige quest that just became true shows up in the badge the same poll it would show up in the quest list, with no extra request. -
Server time is the authoritative clock — compare
finishes_at/arrives_attimestamps against it, not your local clock. -
player.spinsis your unspent fortune wheel balance, andbadges.spinsrepeats it in the badge block clients use to light up a navigation icon. When the realm’s wheel grants daily spins (spins_daily> 0), the first game-state poll of each UTC day also collects that day’s daily spin — so this endpoint is where the daily reward lands. Later polls the same day change nothing. -
player.founding_cost/player.colony_founding_costare what founding a town charges at dispatch — a city and a colony respectively — as a{resource_id: amount}map taken from the origin town’s resources the moment you dispatch.colony_founding_costisnullin a realm with no colony configuration, the same conventionmax_colonies: 0uses. -
player.founding_required_workers/player.colony_founding_required_workersare the other half of the same requirement: how many ofplayer.founding_worker_unit_type_idthe marching party itself must carry (the settlers).0with anullunit type means the realm demands none and any non-empty army founds a town;colony_founding_required_workersisnullon the same condition ascolony_founding_cost. All five fields are pure realm config and cost this endpoint nothing — a client can show every requirement before dispatching instead of discovering it from a rejected request.
Usage
import httpx
client = httpx.AsyncClient( base_url="https://YOUR-RESTFALL-HOST", headers={"Authorization": f"Bearer {token}"},)
state = await client.get("/api/v1/state/")data = state.json()
# Check for incoming attacksif data["incoming_attacks"]: print(f"Warning: {len(data['incoming_attacks'])} attacks incoming!")
# Check resourcesfor town in data["towns"]: print(f"{town['name']}: {town['resources']}")curl -H "Authorization: Bearer $TOKEN" \ https://YOUR-RESTFALL-HOST/api/v1/state/const res = await fetch("/api/v1/state/", { headers: { Authorization: `Bearer ${token}` },});const state = await res.json();
// Check for incoming threatsif (state.incoming_attacks.length > 0) { console.log(`${state.incoming_attacks.length} attacks incoming!`);}