Version: 1.1.0
Category: Query
Status: Stable
Last Updated: January 1, 2026
The Web Application API Protocol defines how AI agents should interact with the structs-webapp service. This API provides enhanced game state information, player statistics, guild data, and authentication services.
Implementation: The webapp API is implemented in a PHP Symfony application (structs-webapp). This is the main user-facing API for the game.
{
"baseUrl": "http://localhost:8080",
"basePath": "/api",
"timeout": 5000,
"retryPolicy": {
"maxRetries": 3,
"retryDelay": 1000,
"retryOn": ["timeout", "5xx", "network"]
}
}
The webapp uses session-based authentication via cookies.
Login Flow:
{
"request": {
"method": "POST",
"url": "/api/auth/login",
"headers": {
"Content-Type": "application/json"
},
"body": {
"username": "player_username",
"password": "player_password"
}
},
"response": {
"status": 200,
"headers": {
"Set-Cookie": "PHPSESSID=..."
},
"body": {
"success": true,
"message": "Login successful"
}
}
}
Using Authenticated Requests:
{
"request": {
"method": "GET",
"url": "/api/guild/this",
"headers": {
"Cookie": "PHPSESSID=..."
}
}
}
Use Case: Get enhanced player information from webapp
Format: GET /api/player/{player_id}
Example:
{
"request": {
"method": "GET",
"url": "/api/player/1",
"headers": {
"Accept": "application/json"
}
},
"response": {
"status": 200,
"body": {
"player": {...},
"stats": {...},
"planets": [...]
}
}
}
Related Endpoints:
GET /api/player/{player_id}/ore/stats - Ore statisticsGET /api/player/{player_id}/planet/completed - Completed planetsGET /api/player/{player_id}/raid/launched - Launched raidsGET /api/player/{player_id}/action/last/block/height - Last action block heightUse Case: Get enhanced planet information
Format: GET /api/planet/{planet_id}
Example:
{
"request": {
"method": "GET",
"url": "/api/planet/1-1"
},
"response": {
"status": 200,
"body": {
"planet": {...},
"shield": {
"health": 100,
"maxHealth": 100
},
"structs": [...]
}
}
}
Related Endpoints:
GET /api/planet/{planet_id}/shield/health - Shield healthGET /api/planet/{planet_id}/shield - Shield informationGET /api/planet/{planet_id}/raid/active - Active raidGET /api/planet/raid/active/fleet/{fleet_id} - Active raid for fleetUse Case: Get guild information and statistics
Format: GET /api/guild/{guild_id}
Example:
{
"request": {
"method": "GET",
"url": "/api/guild/1"
},
"response": {
"status": 200,
"body": {
"guild": {...},
"members": [...],
"stats": {...}
}
}
}
Related Endpoints:
GET /api/guild/this - Current user’s guild (requires auth)GET /api/guild/{guild_id}/roster - Guild rosterGET /api/guild/{guild_id}/power/stats - Power statisticsGET /api/guild/{guild_id}/members/count - Member countGET /api/guild/{guild_id}/planet/complete/count - Completed planet countGET /api/guild/directory - Guild directoryGET /api/guild/count - Total guild countUse Case: Get struct information
Format: GET /api/struct/{struct_id}
Example:
{
"request": {
"method": "GET",
"url": "/api/struct/1"
},
"response": {
"status": 200,
"body": {
"struct": {...}
}
}
}
Related Endpoints:
GET /api/struct/planet/{planet_id} - Structs on planetGET /api/struct/type - Struct typesUse Case: Get transaction ledger for player
Format: GET /api/ledger/player/{player_id}/page/{page}
Example:
{
"request": {
"method": "GET",
"url": "/api/ledger/player/1/page/1"
},
"response": {
"status": 200,
"body": {
"transactions": [...],
"page": 1,
"totalPages": 10
}
}
}
Related Endpoints:
GET /api/ledger/player/{player_id}/count - Transaction countGET /api/ledger/{tx_id} - Transaction by IDUse Case: Search for raids, transfers, etc.
Format: GET /api/player/raid/search or GET /api/player/transfer/search
Example:
{
"request": {
"method": "GET",
"url": "/api/player/raid/search",
"queryParams": {
"player_id": "1",
"status": "active"
}
},
"response": {
"status": 200,
"body": {
"raids": [...]
}
}
}
{
"error": {
"code": "NOT_FOUND",
"message": "Player with ID '1' not found",
"details": {
"entity": "Player",
"id": "1"
}
}
}
{
"onError": {
"404": {
"action": "log",
"retry": false,
"fallback": "return null"
},
"401": {
"action": "authenticate",
"retry": true,
"fallback": "request login"
},
"403": {
"action": "log",
"retry": false,
"fallback": "return null"
},
"500": {
"action": "retry",
"maxRetries": 3,
"backoff": "exponential"
},
"timeout": {
"action": "retry",
"maxRetries": 3,
"backoff": "exponential"
}
}
}
Use Webapp API for:
Use Consensus API for:
{
"strategy": "hybrid",
"consensusAPI": {
"useFor": [
"authoritative state",
"transactions",
"block height"
]
},
"webappAPI": {
"useFor": [
"enhanced statistics",
"guild information",
"ledger history",
"search functionality"
]
}
}
{
"strategy": "parallel",
"queries": [
"GET /api/player/1",
"GET /api/player/1/ore/stats",
"GET /api/player/1/planet/completed"
],
"maxConcurrency": 10
}
{
"cachePolicy": {
"structTypes": {
"ttl": 3600,
"endpoint": "/api/struct/type"
},
"guildDirectory": {
"ttl": 300,
"endpoint": "/api/guild/directory"
},
"guildCount": {
"ttl": 60,
"endpoint": "/api/guild/count"
}
}
}
Last Updated: January 1, 2026