> For the complete documentation index, see [llms.txt](https://docs.lighter.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lighter.xyz/api/guilds.md).

# Guilds

Browse guilds and leaderboards, manage your membership, and participate in guild duels.

Guild creation is currently restricted to whitelisted addresses approved by the Lighter team.

## Endpoints

| Section                                                                    | Endpoints | Description                                                                        |
| -------------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------- |
| [Guild discovery](broken://pages/7abc282a214fa5f63493cd8e7bd4a2e03da30289) | 4         | Browse guilds, view leaderboards, and look up a guild by referral code.            |
| [Membership](broken://pages/eb7389e4de3c69b848c13b053a662b5f819eb5c0)      | 3         | Check membership, request to join a guild, or leave your current guild.            |
| [Duels](broken://pages/f9de4878a2942dcdaef0d3110924875898fe2a32)           | 5         | Browse duel metrics and public duels, or view your guild’s duel details.           |
| [Duel actions](broken://pages/9de360b2f20fe8b019eb5c979bef42c317c59634)    | 4         | Challenge another guild, accept or decline a proposal, and report stake transfers. |

## Requests and authentication

Guilds and Guild Duels are not supported on Robinhood Chain.

Base URLs: mainnet `https://mainnet.zklighter.elliot.ai`, testnet `https://api.testnet.lighter.xyz`. Timestamps are Unix **milliseconds**; USDC amounts in `stake_amount`/`amount`/`pnl`/`capital`/`volume` of duels are integers scaled by 10⁶; leaderboard `pnl`/`volume` are floats in USDC. Every response carries `code` (200 on success) and `message` on error.

Common auth parameters for authenticated endpoints:

| Parameter       | In           | Type   | Required | Description                                               |
| --------------- | ------------ | ------ | -------- | --------------------------------------------------------- |
| `Authorization` | header       | string | one of   | Auth token                                                |
| `auth`          | query / form | string | one of   | Same token as a parameter                                 |
| `account_index` | query / form | int64  | yes      | Account the token belongs to; its L1 address is the actor |

Send GET parameters in the query string. Send POST parameters as form fields with `Content-Type: application/x-www-form-urlencoded`. For authenticated calls, provide `account_index` and a token in either the `Authorization` header or the `auth` parameter. The token must belong to that account; its L1 address is the actor. A master account or sub-account of the same owner can be used.

## Guild objects

### Guild

| Field                   | Type            | Description                                                   |
| ----------------------- | --------------- | ------------------------------------------------------------- |
| `guild_id`              | int64           |                                                               |
| `name`                  | string          | 3–32 chars, unique case-insensitively                         |
| `description`           | string          | ≤ 500 chars                                                   |
| `accepts_join_requests` | bool            | `false` = invite only                                         |
| `max_members`           | int64           | 1–500 (default 100)                                           |
| `leader_l1`             | string          | Leader's L1 address                                           |
| `member_count`          | int64           |                                                               |
| `created_at`            | int64           | ms                                                            |
| `duel_record`           | GuildDuelRecord | `wins`, `losses`, `ties`, `last5` (newest first, `W`/`L`/`T`) |

### GuildMember

`l1_address`, `role` (`leader|admin|member`), `joined_at`, `duel_opt_in` (bool).

### GuildPnlStats

`time_window`, `pnl`, `volume` (floats, USDC), `rank` (position on the ladder, 0 = unranked), `ranked_member_count`, `updated_at`.

### GuildPosition

(aggregated across members): `market_id`, `symbol`, `sign` (1 long / -1 short net), `position`, `long_size`, `short_size`, `position_value`, `unrealized_pnl`, `avg_entry_price` (strings), `roi` (float), `member_count`, `account_count`.

### GuildListItem

`guild_id`, `name`, `accepts_join_requests`, `max_members`, `member_count`, `duel_record`.

### GuildLeaderboardEntry

`rank`, `guild_id`, `name`, `accepts_join_requests`, `member_count`, `ranked_member_count`, `pnl`, `volume`.

### GuildJoinRequest

`request_id`, `guild_id`, `guild_name`, `l1_address`, `status` (`pending|approved|rejected|expired|voided`), `source` (`organic|referral_prompt`), `created_at`, `expires_at` (created + 7d).

## Guild duels

Browse duels, challenge another guild, accept or decline a proposal, and report stake transfers. Public endpoints expose funded, live, finished and settled duels. Use the authenticated endpoints to access your guild’s proposals and full duel details.

## Duel objects

### GuildDuelTerms

`metric`, `stake_amount` (USDC × 10⁶, per guild), `start_time`, `duration_secs`, `min_members`, `end_time`.

### GuildDuelOffer

`offer_id`, `seq`, `from_guild_id`, `created_by_l1`, terms fields, `message`, `status` (`pending|accepted|declined|superseded|expired`), `created_at`, `expires_at`, `resolved_at`.

### GuildDuelSide

`guild_id`, `name`, `leader_l1`, `roster_size`, `roster_locked_at`, `stake_status` (`""` or `confirmed`), `stake_tx_hash`.

### GuildDuelRosterMember

`l1_address`, `guild_id`, `selected_by_l1` (leader's address, or `auto` when filled on accept).

### GuildDuelStakeInfo

`escrow_account_index`, `amount`, `memo` (hex, 32 bytes = sha256(`guildduel:<duel_id>`)), `funding_deadline`.

### GuildDuelPayout

`guild_id`, `to_account_index`, `amount`, `kind` (`payout|refund`), `status` (`pending|confirmed`), `tx_hash`, `created_at`, `confirmed_at`.

### GuildDuelScore

`challenger_score`, `challenged_score` (in the metric's unit: ROI metrics as a fraction, pnl/volume ×10⁶, roi\_sqrt\_volume dimensionless), `scored_at`.

### GuildDuelMemberScore

`guild_id`, `l1_address`, `pnl`, `capital`, `roi`, `volume`.

### GuildDuel

`duel_id`, `status` (`proposed|accepted|funded|live|finished|settled|declined|cancelled|expired|voided`), `challenger`, `challenged` (GuildDuelSide), `terms` (agreed terms, once accepted), `pending_offer`, `offer_expires_at`, `funding_deadline`, `winner_guild_id` (0 on tie), `score`, `created_at`, `accepted_at`, `live_at`, `finished_at`, `settled_at`.

### RespGetGuildDuel

`duel`, `offers[]`, `roster[]`, `stake_info` (while awaiting stakes, own side only), `payouts[]`, `scores[]`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lighter.xyz/api/guilds.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
