--- title: REST API endpoints specification description: "The REST API specification: base URLs, consensus network queries, transaction endpoints, and the web application API." --- # REST API endpoints specification **Last Updated**: May 13, 2026 --- ## Base URLs | API | Local | Public testnet (SSL) | |-----|-------|----------------------| | Consensus Network REST (`/structs/...`) | `http://localhost:1317` | `https://public.testnet.structs.network` | | Tendermint RPC (`/`) | `http://localhost:26657` | `https://public.testnet.structs.network:26657` | | Tendermint WebSocket | `ws://localhost:26657/websocket` | `wss://public.testnet.structs.network:26657/websocket` | | Web Application (`/api`) | `http://localhost:8080` | `http://crew.oh.energy` (Orbital Hydro) | | GRASS NATS WebSocket | `ws://localhost:1443` | `ws://crew.oh.energy:1443` (Orbital Hydro) | `public.testnet.structs.network` runs only `structsd` (chain). The Web Application and GRASS NATS services are hosted by individual guilds. For the full per-entity catalog read surface (paginated lists for every entity, time-series stats, live tunables, banned-word list, guild membership applications, etc.) see [`webapp/`](webapp/). --- ## Query Endpoints (Consensus Network) All query endpoints use the Consensus Network REST API (`http://localhost:1317` locally or `https://public.testnet.structs.network` on the public testnet). Paginated lists: `pagination.limit` defaults to 100 and is clamped to 1000; `pagination.count_total` is ignored (`total` is `0`); `pagination.offset` above 1000 is refused — walk with `pagination.key` / `next_key`. ### Player Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/player/{id}` | Get player by ID | No | | GET | `/structs/player` | List all players | Yes | **`GET /structs/player/{id}`** (`player-by-id`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | id | string | Yes | `^1-[0-9]+$` | Player identifier in format `type-index` (e.g., `1-11`). Type 1 = Player. | Response schema: [Player](../schemas/entities/player.md) ```json // Example request: GET /structs/player/1-11 // Example response: { "Player": {...}, "gridAttributes": { "capacity": "...", "load": "...", "structsLoad": "...", "connectionCapacity": "...", "lastAction": "..." }, "playerInventory": {...} } ``` No `halted` field — online is capacity vs load (see [integration-notes.md](integration-notes.md)). **`GET /structs/player`** (`player-list`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | pagination.key | string | No | Pagination key | | pagination.limit | integer | No | Page size | Response schema: [Player](../schemas/entities/player.md) (array) ### Planet Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/planet/{id}` | Get planet by ID | No | | GET | `/structs/planet` | List all planets | Yes | | GET | `/structs/planet_by_player/{playerId}` | Get planets owned by player | No | **`GET /structs/planet/{id}`** (`planet-by-id`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | id | string | Yes | `^2-[0-9]+$` | Planet identifier in format `type-index` (e.g., `2-1`). Type 2 = Planet. | Response schema: [Planet](../schemas/entities/planet.md) **`GET /structs/planet_by_player/{playerId}`** (`planet-by-player`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | playerId | string | Yes | `^1-[0-9]+$` | Player identifier in format `type-index` (e.g., `1-11`). Type 1 = Player. | Response schema: [Planet](../schemas/entities/planet.md) (array) ### Struct Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/struct/{id}` | Get struct by ID | No | | GET | `/structs/struct` | List all structs | Yes | **`GET /structs/struct/{id}`** (`struct-by-id`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | id | string | Yes | `^5-[0-9]+$` | Struct identifier in format `type-index` (e.g., `5-42`). Type 5 = Struct. | Response schema: [Struct](../schemas/entities/struct.md) ### Fleet Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/fleet/{id}` | Get fleet by ID | No | | GET | `/structs/fleet` | List all fleets | Yes | | GET | `/structs/fleet_by_index/{index}` | Get fleet by index | No | **`GET /structs/fleet/{id}`** (`fleet-by-id`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | id | string | Yes | `^9-[0-9]+$` | Fleet identifier in format `type-index` (e.g., `9-11`). Type 9 = Fleet. | Response schema: [Fleet](../schemas/entities/fleet.md) **`GET /structs/fleet_by_index/{index}`** (`fleet-by-index`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | index | integer | Yes | Fleet index | Response schema: [Fleet](../schemas/entities/fleet.md) ### Guild Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/guild/{id}` | Get guild by ID | No | | GET | `/structs/guild` | List all guilds | Yes | **`GET /structs/guild/{id}`** (`guild-by-id`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | id | string | Yes | `^0-[0-9]+$` | Guild identifier in format `type-index` (e.g., `0-1`). Type 0 = Guild. | Response schema: [Guild](../schemas/entities/guild.md) ### Reactor Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/reactor/{id}` | Get reactor by ID | No | | GET | `/structs/reactor` | List all reactors | Yes | | GET | `/structs/reactor/{reactorId}/stake-share` | Stake cap headroom, slash revisions ([detail](queries/reactor.md#reactor-stake-share)) | No | | GET | `/structs/owner/{ownerId}/reactor-diversity` | Owner diversity bonus accounting ([detail](queries/reactor.md#owner-reactor-diversity)) | No | **`GET /structs/reactor/{id}`** (`reactor-by-id`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | id | string | Yes | `^3-[0-9]+$` | Reactor identifier in format `type-index` (e.g., `3-1`). Type 3 = Reactor. | Response schema: [Reactor](../schemas/entities/reactor.md) ### Substation Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/substation/{id}` | Get substation by ID | No | | GET | `/structs/substation` | List all substations | Yes | **`GET /structs/substation/{id}`** (`substation-by-id`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | id | string | Yes | `^4-[0-9]+$` | Substation identifier in format `type-index` (e.g., `4-3`). Type 4 = Substation. | Response schema: [Substation](../schemas/entities/substation.md) ### Provider Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/provider/{id}` | Get provider by ID | No | | GET | `/structs/provider` | List all providers | Yes | **`GET /structs/provider/{id}`** (`provider-by-id`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | id | string | Yes | Provider identifier | Response schema: [Provider](../schemas/entities/provider.md) ### Agreement Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/agreement/{id}` | Get agreement by ID | No | | GET | `/structs/agreement` | List all agreements | Yes | | GET | `/structs/agreement_by_provider/{providerId}` | Get agreements by provider | No | **`GET /structs/agreement/{id}`** (`agreement-by-id`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | id | string | Yes | Agreement identifier | Response schema: [Agreement](../schemas/entities/agreement.md) **`GET /structs/agreement_by_provider/{providerId}`** (`agreement-by-provider`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | providerId | string | Yes | Provider identifier | Response schema: [Agreement](../schemas/entities/agreement.md) (array) ### Allocation Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/allocation/{id}` | Get allocation by ID | No | | GET | `/structs/allocation` | List all allocations | Yes | | GET | `/structs/allocation_by_source/{sourceId}` | Get allocations by source | No | | GET | `/structs/allocation_by_destination/{destinationId}` | Get allocations by destination | No | **`GET /structs/allocation/{id}`** (`allocation-by-id`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | id | string | Yes | Allocation identifier | Response schema: [Allocation](../schemas/entities/allocation.md) **`GET /structs/allocation_by_source/{sourceId}`** (`allocation-by-source`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | sourceId | string | Yes | Source identifier | Response schema: [Allocation](../schemas/entities/allocation.md) (array) **`GET /structs/allocation_by_destination/{destinationId}`** (`allocation-by-destination`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | destinationId | string | Yes | Destination identifier | Response schema: [Allocation](../schemas/entities/allocation.md) (array) ### Address Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/address/{address}` | Get address by blockchain address | No | | GET | `/structs/address` | List all addresses | Yes | | GET | `/structs/address_by_player/{playerId}` | Get addresses by player | No | **`GET /structs/address/{address}`** (`address-by-address`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | address | string | Yes | blockchain-address | Blockchain address | Response schema: [Address](../schemas/entities/address.md) **`GET /structs/address_by_player/{playerId}`** (`address-by-player`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | playerId | string | Yes | `^1-[0-9]+$` | Player identifier in format `type-index` (e.g., `1-11`). Type 1 = Player. | Response schema: [Address](../schemas/entities/address.md) (array) ### Permission Queries | Method | Path | Description | Pagination | |--------|------|-------------|------------| | GET | `/structs/permission/{permissionId}` | Get permission by ID | No | | GET | `/structs/permission` | List all permissions | Yes | | GET | `/structs/permission/object/{objectId}` | Get permissions by object | No | | GET | `/structs/permission/player/{playerId}` | Get permissions by player | No | | GET | `/structs/guild_rank_permission/object/{object_id}` | Get guild rank permissions by object | Yes | | GET | `/structs/guild_rank_permission/object/{object_id}/guild/{guild_id}` | Get guild rank permissions by object and guild | No | **`GET /structs/permission/{permissionId}`** (`permission-by-id`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | permissionId | string | Yes | Permission identifier | Response schema: [Permission](../schemas/entities/permission.md) **`GET /structs/permission/object/{objectId}`** (`permission-by-object`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | objectId | string | Yes | Object identifier | Response schema: [Permission](../schemas/entities/permission.md) (array) **`GET /structs/permission/player/{playerId}`** (`permission-by-player`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | playerId | string | Yes | `^1-[0-9]+$` | Player identifier in format `type-index` (e.g., `1-11`). Type 1 = Player. | Response schema: [Permission](../schemas/entities/permission.md) (array) **`GET /structs/guild_rank_permission/object/{object_id}`** (`guild-rank-permission-by-object`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | objectId | string | Yes | Object identifier | | pagination.key | string | No | Pagination key | | pagination.limit | integer | No | Page size | Response schema: guild rank permission records ([permissions](../knowledge/mechanics/permissions.md#guild-rank-permission-system)) **`GET /structs/guild_rank_permission/object/{object_id}/guild/{guild_id}`** (`guild-rank-permission-by-object-and-guild`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | objectId | string | Yes | Object identifier | | guildId | string | Yes | Guild identifier | Response schema: guild rank permission records ([permissions](../knowledge/mechanics/permissions.md#guild-rank-permission-system); at most 24 records) ### Block Height and Parameters | Method | Path | Description | |--------|------|-------------| | GET | `/blockheight` | Get current block height | | GET | `/structs/structs/params` | Get module parameters | **`GET /blockheight`** (`block-height`) Response schema: block height (`height`) ```json // Example request: GET /blockheight // Example response: { "height": 12345 } ``` **`GET /structs/structs/params`** (`params`) Response schema: module [params](../knowledge/mechanics/transactions.md) **`GET /structs/vault/{ownerId}`** (`vault`) Response: `ownerId`, `address`, `provisioned` — the deterministic vault account of a player (`1-N`) or guild (`0-N`). Balances are read from `/cosmos/bank/v1beta1/balances/{address}`. See [queries/system.md](queries/system.md#vault). Per-entity query files also cover LCD families not expanded above: [grid](queries/grid.md), [infusion](queries/infusion.md), [struct-type](queries/struct-type.md), [struct-attribute](queries/struct-attribute.md), [planet-attribute](queries/planet-attribute.md), [guild-membership-application](queries/guild-membership-application.md), plus collateral/validate on [guild](queries/guild.md), [provider](queries/provider.md), and [system](queries/system.md). The webapp catalog is [webapp/](webapp/), not the short list later on this page. --- ## Transaction Endpoints | Method | Path | Description | Auth | |--------|------|-------------|------| | POST | `/cosmos/tx/v1beta1/txs` | Submit a transaction | Required | **`POST /cosmos/tx/v1beta1/txs`** (`submit-transaction`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | body | object | Yes | Transaction body with messages (see [message catalog](transactions/messages.md)) | Request schema: [messages.md](transactions/messages.md) (live Msg list). Field notes for a subset: [schemas/actions.md](../schemas/actions.md). Response schema: [TransactionResponse](../schemas/responses.md) ```json // Example request: // POST /cosmos/tx/v1beta1/txs { "body": { "messages": [ { "@type": "/structs.structs.MsgStructBuildInitiate", "creator": "structs1...", "playerId": "1-11", "structTypeId": "1", "operatingAmbit": "land", "slot": "0" } ] } } ``` ```json // Example response: { "tx_response": { "code": 0, "txhash": "...", "height": 12345 } } ``` --- ## Web Application API Endpoints All webapp endpoints use the Web Application API (`http://localhost:8080` locally or `http://crew.oh.energy` for the public Orbital Hydro guild webapp). Authoritative reference: per-entity files in [`webapp/`](webapp/). ### Catalog Read Surface In addition to the bespoke endpoints below, the webapp exposes a uniform catalog read surface — paginated `GET /api/{entity}[/{filter}]/page/{page}` for: `address-tag`, `agreement`, `allocation`, `banned-word`, `defusion`, `fleet/list`, `grid`, `guild/list`, `guild-membership-application`, `infusion/list`, `ledger/list`, `permission`, `permission-guild-rank`, `planet/list`, `planet-activity`, `planet-attribute`, `player/list`, `provider`, `reactor`, `struct/list`, `struct-attribute`, `struct-defender`, `substation`. Plus `GET /api/setting` (live tunables) and time-series stats. **Charting / admin reads** (leaderboards, inventory, guild banks, denom/resolve, aggregates, markets, census) live in [`webapp/analytics.md`](webapp/analytics.md). See [`webapp/`](webapp/) for per-entity detail and [`../protocols/webapp-api-protocol.md`](../protocols/webapp-api-protocol.md) for the catalog conventions. ### Player Endpoints > All webapp `/api/` routes below require an authenticated `PHPSESSID` session (the only public routes are `/api/auth/*`, `/api/guild/this`, `/api/timestamp`, `/api/setting`). All responses use the `{ "success", "errors", "data" }` envelope — unwrap `data`. | Method | Path | Description | Auth | |--------|------|-------------|------| | GET | `/api/player/{player_id}` | Get player information | Yes | | GET | `/api/player/{player_id}/action/last/block/height` | Get last action block height | Yes | | GET | `/api/player/raid/search` | Search player raids | Yes | | GET | `/api/player/transfer/search` | Search player transfers | Yes | | GET | `/api/player/{player_id}/ore/stats` | Get player ore statistics | Yes | | GET | `/api/player/{player_id}/planet/completed` | Get completed planets for player | Yes | | GET | `/api/player/{player_id}/raid/launched` | Count of raids this player initiated | Yes | > Username and PFP updates use on-chain `MsgPlayerUpdateName` / `MsgPlayerUpdatePfp`; the webapp queues them through the signing client manager. See `knowledge/mechanics/ugc-moderation.md`. **`GET /api/player/{player_id}`** (`webapp-player-by-id`) | Parameter | Type | Required | Format | Description | |-----------|------|----------|--------|-------------| | player_id | string | Yes | `^1-[0-9]+$` | Player identifier in format `type-index` (e.g., `1-11`). Type 1 = Player. | Response schema: `schemas/responses.md#WebappPlayerResponse` ```json // Example request: GET http://localhost:8080/api/player/1-11 // Example response (envelope; data fields are SQL columns, snake_case): { "success": true, "errors": {}, "data": { "player": { "id": "1-11", "username": "PlayerName", "address": "structs1..." }, "guild": { "id": "0-1", "name": "GuildName" }, "stats": { "total_ore": 1000, "planets_completed": 5 } } } ``` **`GET /api/player/{player_id}/action/last/block/height`** (`webapp-player-action-last-block`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | player_id | string | Yes | Player identifier | Response schema: `schemas/responses.md#BlockHeightResponse` ```json // Example response (envelope; data is a single row, val is an LCD numeric string): { "success": true, "errors": {}, "data": { "last_action_block_height": "12345" } } ``` **`GET /api/player/{player_id}/ore/stats`** (`webapp-player-ore-stats`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | player_id | string | Yes | Player identifier | Response schema: `schemas/responses.md#OreStatsResponse` ```json // Example response (envelope): { "success": true, "errors": {}, "data": { "player_id": "1-11", "total_ore": 1000, "ore_by_type": { "iron": 500, "copper": 300, "silver": 200 } } } ``` ### Planet Endpoints | Method | Path | Description | |--------|------|-------------| | GET | `/api/planet/{planet_id}` | Get planet information | | GET | `/api/planet/{planet_id}/shield/health` | Get planet shield health | | GET | `/api/planet/{planet_id}/shield` | Get planet shield information | | GET | `/api/planet/{planet_id}/raid/active` | Get active raid for planet | | GET | `/api/planet/raid/active/fleet/{fleet_id}` | Get active raid for fleet | **`GET /api/planet/{planet_id}`** (`webapp-planet-by-id`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | planet_id | string | Yes | Planet identifier | Response schema: [Planet](../schemas/entities/planet.md) ```json // Example response (envelope): { "success": true, "errors": {}, "data": { "id": "2-1", "owner_id": "1-11", "max_ore": 5, "space_slots": 4 } } ``` **`GET /api/planet/{planet_id}/shield/health`** (`webapp-planet-shield-health`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | planet_id | string | Yes | Planet identifier | Response schema: `schemas/responses.md#ShieldHealthResponse` ```json // Example response (envelope): { "success": true, "errors": {}, "data": { "planet_id": "2-1", "health": 1000, "max_health": 1000 } } ``` ### Guild Endpoints | Method | Path | Description | Auth | |--------|------|-------------|------| | GET | `/api/guild/this` | Host/infrastructure guild for this deployment (`guild_meta.this_infrastructure = TRUE`) — not the logged-in player's guild | No (public) | | GET | `/api/guild/name` | Get guild name | Yes | | GET | `/api/guild/{guild_id}/name` | Get guild name by ID | Yes | | GET | `/api/guild/{guild_id}/members/count` | Get guild member count | Yes | | GET | `/api/guild/count` | Get total guild count | Yes | | GET | `/api/guild/directory` | Get guild directory | Yes | | GET | `/api/guild/{guild_id}` | Get guild by ID | Yes | | GET | `/api/guild/{guild_id}/power/stats` | Get guild power statistics | Yes | | GET | `/api/guild/{guild_id}/roster` | Get guild roster | Yes | | GET | `/api/guild/{guild_id}/planet/complete/count` | Get completed planet count for guild | Yes | **`GET /api/guild/{guild_id}`** (`webapp-guild-by-id`) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | guild_id | string | Yes | Guild identifier | Response schema: [Guild](../schemas/entities/guild.md) ```json // Example response (envelope; guild IDs are type 0): { "success": true, "errors": {}, "data": { "id": "0-1", "name": "GuildName", "member_count": 10 } } ``` **`GET /api/guild/count`** (`webapp-guild-count`) Response schema: `schemas/responses.md#CountResponse` ```json // Example response (envelope): { "success": true, "errors": {}, "data": { "count": 42 } } ``` ### Auth Endpoints | Method | Path | Description | Auth | |--------|------|-------------|------| | POST | `/api/auth/signup` | Register a new player (Cosmos signature) | None (public) | | POST | `/api/auth/login` | Authenticate via Cosmos signature → `PHPSESSID` cookie | None (public) | | POST | `/api/auth/logout` | Clear the current session | None (public prefix) | Login body: `{address, signature, pubkey, guild_id, unix_timestamp}`; signed message `LOGIN_GUILD{guildId}ADDRESS{address}DATETIME{unix_timestamp}`. See `api/webapp/auth.md`. ### Struct Endpoints | Method | Path | Description | |--------|------|-------------| | GET | `/api/struct/player/{player_id}` | Get a player's structs | | GET | `/api/struct/list/location/{location_id}/page/{page}` | Get structs at a location (planet or fleet) | | GET | `/api/struct/list/owner/{owner}/page/{page}` | Get structs by owner | | GET | `/api/struct/type` | Get struct types | | GET | `/api/struct/{struct_id}` | Get struct by ID | ### Ledger Endpoints | Method | Path | Description | |--------|------|-------------| | GET | `/api/ledger/player/{player_id}/page/{page}` | Get ledger page for player | | GET | `/api/ledger/player/{player_id}/count` | Get ledger count for player | | GET | `/api/ledger/{tx_id}` | Get ledger entry by transaction ID | ### Infusion Endpoints | Method | Path | Description | |--------|------|-------------| | GET | `/api/infusion/player/{player_id}` | Get infusions for player | ### Timestamp Endpoint | Method | Path | Description | |--------|------|-------------| | GET | `/api/timestamp` | Get current Unix timestamp | Response schema: `schemas/responses.md#TimestampResponse` ```json // Example response (envelope; data key is unix_timestamp). Public route. { "success": true, "errors": {}, "data": { "unix_timestamp": 1704067200 } } ``` --- ## RPC Endpoints All RPC endpoints use `http://localhost:26657`. | Method | Path | Description | Parameters | |--------|------|-------------|------------| | GET | `/status` | Get node status | None | | GET | `/block` | Get block by height | `height` (integer, optional) | | GET | `/block_results` | Get block results | `height` (integer, optional) | | GET | `/commit` | Get commit for block | `height` (integer, optional) | | GET | `/validators` | Get validators | `height` (integer, optional) | Response schema: `schemas/responses.md#RPCStatusResponse` --- ## Streaming Endpoints (GRASS via NATS) ### NATS Protocol (`grass-nats-protocol`) - **Method**: NATS - **URL**: `nats://localhost:4222` - **Authentication**: Optional GRASS uses NATS messaging system: 1. PostgreSQL NOTIFY events trigger GRASS 2. GRASS publishes to NATS subjects 3. Clients connect to NATS and subscribe to subjects **Documentation**: `protocols/streaming.md`, `api/streaming/event-schemas.md`, `api/streaming/event-types.md`, `api/streaming/subscription-patterns.md` #### Subject Patterns | Pattern | Description | Example | Schema | |---------|-------------|---------|--------| | `structs.player.*` | Player-specific updates | `structs.player.0-1.1-11` | `api/streaming/event-schemas.md#PlayerConsensusEvent` | | `structs.planet.{planet_id}.{owner_player_id}` | Planet activity: raid_status, fleet arrivals and departures, struct status and health, shield changes. Subscribe with `structs.planet.2-1.*` (or `.>`); a bare `structs.planet.2-1` matches nothing | `structs.planet.2-1.1-11` | `api/streaming/event-schemas.md#PlanetRaidStatusEvent` | | `structs.guild.*` | Guild-specific updates | `structs.guild.0-1` | `api/streaming/event-schemas.md#GuildConsensusEvent` | | `consensus` | New block (block height and time) | `consensus` | `api/streaming/event-schemas.md#BlockEvent` | There are no `structs.struct.*`, `structs.fleet.*` or `structs.global` subjects: struct and fleet events arrive on the planet subject. Subject prefixes in use: agreement, grid, guild, influence, inventory, planet, player, provider (structs-pg `deploy/`, sync-state `internal/db/notify.go`). ```json // Subscribe example: { "subject": "structs.player.0-1.1-11", "subject": "structs.planet.2-1.*" } // Message example: { "subject": "structs.player.0-1.1-11", "category": "player_consensus", "id": "1-11", "updated_at": "2025-01-01T00:00:00Z", "data": {...} } ``` ### NATS WebSocket (`grass-nats-websocket`) - **Method**: WebSocket - **URL**: `ws://localhost:1443` - **Authentication**: Optional NATS WebSocket wrapper for browser compatibility. Requires NATS server WebSocket support. Supports the same subject patterns as the NATS protocol endpoint. ```json // Subscribe example: { "action": "subscribe", "subjects": ["structs.player.0-1.1-11", "structs.planet.2-1.*"] } // Message example: { "subject": "structs.player.0-1.1-11", "category": "player_consensus", "id": "1-11", "updated_at": "2025-01-01T00:00:00Z", "data": {...} } ``` --- ## Related Documentation - `schemas/entities.md` - Entity definitions - `schemas/actions.md` - Action definitions - `schemas/responses.md` - Response definitions - `reference/api-quick-reference.md` - API quick reference - `api/streaming/event-types.md` - Event type definitions - `api/streaming/subscription-patterns.md` - Subscription patterns - `api/error-codes.md` - Error code catalog - `api/rate-limits.md` - Rate limit configuration