Clans and parties
This page describes how to set up and manage persistent player communities (clans) and temporary teams (parties) in Open Play. Read it if you want to manage membership, invites, the clan treasury, clan XP and party reward distribution from a trusted server.
What it does
The social module (social) manages two structures:
- Clan: A persistent community. It has leader, officer and member roles, an invite and application flow, a shared treasury (a currency) and XP/level.
- Party: A temporary team. It has a capacity, a loot rule and reward splitting; it ends when it disbands.
Important: All of these endpoints are called with a server key. A player client cannot call a clan or party endpoint directly; the player’s identity is written in the request body (as actor_player_id and similar) by your trusted server. Verifying that a player “can manage their own clan” is your server’s job; Open Play enforces the role rules inside the clan (who can kick whom, who can withdraw from the treasury).
If the module is disabled, the endpoints return 404 with {"code":"module_disabled","module":"social"}. Enable the module on the Game settings › Modules page.
Where it lives in the panel
| What you want to do | Panel page |
|---|---|
| List clans; see membership, invites, applications, the vault and command history | Clans |
| See parties, their members, the loot rule and reward distributions | Parties |
| Clan and party chat | Chat, City chat |
| The currency used in the clan treasury | Currencies |
Note
Panel help pages are not translated yet; the panel links above point to the Turkish source.
Data model (in plain words)
Clan
name(3–64 characters),tag(2–8 characters),leader_player_id,xp,highest_level_reached,state(activeordisbanded) andmembers.- Roles:
leader,officer,member. - Environment settings (
/v1/clan-settings):max_members(the member limit),request_ttl_seconds(the lifetime of invites and applications),officer_can_withdraw(whether an officer can withdraw from the treasury) andlevel_curve_key(the level curve for the clan level). - Invite: A call the clan sends to a player. Its statuses are
pending,accepted,declined,revoked,expired. - Application: A player’s application to a clan. Its statuses are
pending,accepted,rejected,cancelled,expired. - Treasury: The clan’s wallet; currency movement is done with
depositandwithdrawand appears in the ledger asclan_treasury.
Party
leader_player_id,capacity(positive),loot_rule(equal: equal shares,weighted: basis-point shares),state(active,disbanded) andmembers.- Invite: Carries
share_bp(the member’s basis-point share; under theweightedrule the shares must add up to exactly 10000) and is valid for 24 hours. Its statuses arepending,accepted,expired. - Reward distribution: Splits a single currency amount among the members. With equal distribution the leftover minor units are distributed in
player_idorder; the result is always deterministic. The distribution record carries the member snapshot, the legs,delivery_mode(inlineoroutbox) and the status (processing,queued,completed).
Calls your game makes
All with a server (or admin) key:
Authorization: Bearer crx_live_<prefix>_<secret>
A client key and a player session are rejected (403).
Clan
| Method and path | Body | What it does |
|---|---|---|
GET /v1/clan-settings, PATCH /v1/clan-settings | max_members, request_ttl_seconds, officer_can_withdraw, level_curve_key | Reads / updates the environment settings |
GET /v1/clans | — | Lists clans |
POST /v1/clans | leader_player_id, name, tag | Creates a clan |
GET /v1/clans/{clan_id} | — | Reads a clan with its members |
PATCH /v1/clans/{clan_id} | actor_player_id, name, tag | Updates the name and tag |
POST /v1/clans/{clan_id}/invites | inviter_player_id, invitee_player_id | Sends an invite |
GET /v1/clan-invites/{invite_id}, POST …/respond | actor_player_id, decision (accept, decline, revoke, expire) | Reads / responds to an invite |
POST /v1/clans/{clan_id}/applications | applicant_player_id | Opens an application |
GET /v1/clan-applications/{application_id}, POST …/resolve | actor_player_id, decision (accept, reject, cancel, expire) | Reads / resolves an application |
POST /v1/clans/{clan_id}/leave | actor_player_id | A member leaves |
POST /v1/clans/{clan_id}/members/kick | actor_player_id, target_player_id | Removes a member |
POST /v1/clans/{clan_id}/members/role | actor_player_id, target_player_id, role | Changes a role |
POST /v1/clans/{clan_id}/leadership | actor_player_id, target_player_id | Transfers leadership |
POST /v1/clans/{clan_id}/disband | actor_player_id | Disbands the clan |
POST /v1/clans/{clan_id}/treasury/deposit, …/withdraw | actor_player_id, currency_id, amount | Deposits to / withdraws from the treasury |
POST /v1/clans/{clan_id}/xp | amount | Adds XP to the clan |
Idempotency-Key is required on all clan write commands. The response is always in the same envelope: { "type": "clan" | "invite" | "application" | "settings" | "treasury" | "xp", "<kind>": { … }, "replayed": false }. For example, creating a clan:
POST /v1/clans
Authorization: Bearer crx_live_<prefix>_<secret>
Idempotency-Key: create-clan-player-1234
Content-Type: application/json
{ "leader_player_id": "0192f0f2-5b1a-7c3e-9d11-4a5b6c7d8e9f", "name": "Wolf Pack", "tag": "WLF" }
Returns 201 and the clan record comes inside a type: "clan" envelope. The TypeScript SDK exposes these endpoints in a typed way (createClan, getClan, createClanInvite, respondClanInvite, depositClanTreasury, addClanXp …); see TypeScript SDK.
Party
| Method and path | Body | What it does |
|---|---|---|
POST /v1/parties | leader_player_id, capacity, loot_rule | Creates a party |
GET /v1/parties?player_id= | — | Lists a player’s parties |
GET /v1/parties/{party_id} | — | Reads a party with its members |
PATCH /v1/parties/{party_id} | actor_player_id, capacity | Updates the capacity |
POST /v1/parties/{party_id}/invites | inviter_player_id, invitee_player_id, share_bp | Sends an invite |
POST /v1/party-invites/{invite_id}/accept | actor_player_id | Accepts an invite |
POST /v1/parties/{party_id}/leave | actor_player_id | A member leaves |
POST /v1/parties/{party_id}/disband | actor_player_id | Disbands the party |
POST /v1/parties/{party_id}/rewards | currency_key, amount | Splits a reward among the members |
Idempotency-Key is required on party reward distribution; the same key returns the same distribution again with replayed: true and does not distribute a second time. The other party commands do not ask for Idempotency-Key.
Note
The TypeScript SDK has no typed client for the party endpoints; call them with raw REST.
Versioning and replay safety
- Clan commands and party reward distribution ask for
Idempotency-Key: the same key and the same body do not run again (replayed: true); the same key with a different body is422; the same key in flight is409. If-Matchis not used in this module.- General rules: Idempotency and concurrency.
Events
Clan and party events (ClanMemberJoined, ClanXpAdded, PartyMemberJoined, RewardDistributed …) can be used in rule automation and quest objectives. Among the types you can select as a webhook filter there is no clan or party event; endpoints registered without a filter receive all events and clan/party events are included, but the envelope format is not a documented contract. Selectable types: Webhook events.
Limits
- A clan name is 3–64 characters, its tag 2–8 characters.
- A party capacity must be positive; exceeding the capacity is rejected. A party invite is valid for 24 hours.
- The clan member limit and the invite/application lifetime are in the environment settings.
- In a party reward the
weightedshares must add up to 10000;amountmust be positive.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
403 | A call with a player session or a client key; or the actor_player_id has no permission for this operation inside the clan (for example a member cannot kick another member) | Make the call with a server key; check the role of actor_player_id |
400 | Idempotency-Key is missing; the clan name/tag violates the length or character rule; XP or an amount is not positive; the party capacity is not positive | Fix the input |
409 | A clan with the same name or tag exists; the player is already in another active clan/party; a pending invite or application already exists; the same key is in flight | Read the conflicting record and leave the decision to the game |
422 | Party capacity/share rules (capacity exceeded, weighted share total is not 10000, a duplicate player) or the same key with a different body | Fix the input; use a new key |
404 | The clan, invite or party does not exist | Verify the IDs with GET |
Working example
Creating a clan and sending an invite in TypeScript (with the SDK’s typed clan client):
/** Güvenilir backend örneği: klan kurar ve bir oyuncuya davet gönderir. Server anahtarı yalnız sunucuda durur. */
import { CrxClient } from "@ferdiunal/open-play-ts";
/** Lider için klan kurar, ardından davet gönderir; her yazma kendi `Idempotency-Key`'iyle tekrar güvenlidir. */
export async function foundClanAndInvite(baseUrl: string, serverApiKey: string, leaderId: string, friendId: string): Promise<string> {
const crx = new CrxClient({ baseUrl, apiKey: serverApiKey });
const created = await crx.createClan({
body: { leader_player_id: leaderId, name: "Kurt Sürüsü", tag: "KRT" },
headers: { "Idempotency-Key": `clan-kur-${leaderId}` },
});
if (created.type !== "clan") throw new Error("Beklenmeyen yanıt zarfı");
await crx.createClanInvite({
path: { clan_id: created.clan.id },
body: { inviter_player_id: leaderId, invitee_player_id: friendId },
headers: { "Idempotency-Key": `davet-${created.clan.id}-${friendId}` },
});
return created.clan.id;
}
Related pages
- Chat · Economy · Characters · Game rules
- TypeScript SDK · Errors