Authenticated Guild Query

Version: 1.0.0 Workflow: authenticated-guild-query Category: Authentication


Description

Authenticate by Cosmos signature, then query guild information.

Prerequisites

Steps

1. Authenticate with Webapp

Sign the message LOGIN_GUILD{guild_id}ADDRESS{address}DATETIME{unix_timestamp} (timestamp within 600s of server time) and submit the signature.

Request Body:

{
  "address": "",
  "signature": "",
  "pubkey": "",
  "guild_id": "",
  "unix_timestamp": ""
}

Request Headers:

Header Value
Content-Type application/json

Data Extraction:

Expected Response:

Error Handling:

Status Action
401 errors.signature_validation_failed (re-sign with fresh timestamp) or errors.player_address_does_not_exists (address not an approved member)
500 Server error - retry with exponential backoff

2. Get the Host/Infrastructure Guild

/api/guild/this returns the deployment’s host guild (guild_meta.this_infrastructure = TRUE), not the logged-in player’s guild. It is public. For the operator’s own guild, read session.guild_id (set at login) or the player record.

Request Headers:

Header Value
Accept application/json

Data Extraction:

Expected Response:

Error Handling:

Status Action
500 Server error - retry with exponential backoff

3. Get Guild Member Count

Request Headers (session required):

Header Value
Cookie ``
Accept application/json

Data Extraction:

Expected Response:

Result

{
  "guild": {
    "id": "",
    "name": "",
    "member_count": ""
  },
  "session": {
    "cookie": ""
  }
}

Error Handling Summary

Step Status Action
1 401 Signature/timestamp invalid or address not an approved member - cannot proceed
1 500 Server error - retry with exponential backoff
3 401 Session expired - re-authenticate and retry

Notes

This workflow demonstrates authentication followed by authenticated API calls. The session cookie from step 1 is used in subsequent requests.