Python SDK — Matchmaking

Matchmaking — client.matchmaking / client.matchmaking_requests

list
client.matchmaking.list(search: str | None = None, limit: int | None = None, rules_cls: type | None = None) -> MatchmakingListResponse

Lists all available matchmaking lobbies with optional search and typed rules.

create (direct join)
client.matchmaking.create(
    player_token: str,
    matchmaking_name: str,
    max_players: int = 4,
    strict_full: bool = False,
    host_switch: bool = False,
    can_leave_room: bool = False,
    realtime_room: bool = False,
    password: str | None = None,
    player_data: Any = None,
    rules: Any = None,
) -> MatchmakingCreateResponse

Creates a lobby that players can join directly. For approval-based joins use client.matchmaking_requests.create(..., join_by_requests=True).

request_to_join
client.matchmaking_requests.request_to_join(player_token: str, matchmaking_id: str, player_data: Any = None) -> MatchmakingJoinRequestResponse

Requests to join a lobby that requires host approval.

respond
client.matchmaking_requests.respond(player_token: str, request_id: str, action: MatchmakingRequestAction) -> MatchmakingPermissionResponse

Host responds to a join request (MatchmakingRequestAction.APPROVE or REJECT).

check_status
client.matchmaking_requests.check_status(player_token: str, request_id: str) -> MatchmakingRequestStatusResponse

Checks the status of a join request.

get_current
client.matchmaking.get_current(player_token: str, rules_cls: type | None = None) -> MatchmakingCurrentResponse

Gets the current lobby status including pending join requests.

join
client.matchmaking.join(player_token: str, matchmaking_id: str, player_data: Any = None) -> MatchmakingDirectJoinResponse

Joins a matchmaking lobby directly (only if it doesn't require approval).

leave
client.matchmaking.leave(player_token: str) -> MatchmakingLeaveResponse

Leaves the current matchmaking lobby.

get_players
client.matchmaking.get_players(player_token: str, data_cls: type | None = None) -> MatchmakingPlayersResponse

Gets all players in the current lobby with typed player data.

heartbeat
client.matchmaking.heartbeat(player_token: str) -> MatchmakingHeartbeatResponse

Sends a heartbeat to maintain presence in the lobby.

remove
client.matchmaking.remove(player_token: str) -> MatchmakingRemoveResponse

Removes the matchmaking lobby (host only).

start
client.matchmaking.start(player_token: str) -> MatchmakingStartResponse

Starts the game: creates a game room and transfers all lobby players (host only).

stop
client.matchmaking.stop(player_token: str) -> MatchmakingStopResponse

Stops the matchmaking lobby (host only, before the game has started).

kick
client.matchmaking.kick(player_token: str, player_id: int) -> MatchmakingKickResponse

Kicks a player from the lobby (host only, before the game has started).

update_password
client.matchmaking.update_password(player_token: str, password: str | None = None) -> MatchmakingPasswordResponse

Updates the lobby password (host only, before the game has started). Pass None to remove it.

Lobbies, joins and host controls

Matchmaking is the discovery layer above rooms. List browses public lobbies — no player token needed, so players can window-shop before signing in. Create opens a lobby with your options mapped one-to-one onto wire fields; join attaches a player and creates the linked room; the host's start locks the lobby and spawns the live room everyone plays in.

Private lobbies use a join-request flow instead of open joins: guests request a seat and the host approves. Heartbeat keeps membership alive for the whole lobby lifetime, while leave and current cover exit and state reads. Host controls — stop, remove, kick, password — mirror the room-level controls.

  • Lobby entries are snapshots — refresh the list on a cadence rather than treating it as a live view.
  • Start locks the lobby and spawns the room: build your "all players ready" flow around that transition.
  • Matchmaking finds the game, the room runs it — gameplay traffic (updates, actions, realtime) uses the room APIs.
  • Calls are synchronous functions — wrap them in asyncio.to_thread or your engine's job system when the game loop cannot block, and reuse one client across coroutines.