CEEJAYDocs

Disconnect a player

End a player's connection from your server, for example when a player closes their account in your game.

POST /v1/games/{game}/players/{playerId}/disconnect · requires players:connect

Call it when a player's account in your game ends, or when your server determines that the connection is no longer valid. The member's connected role is removed, the player's devices are signed out, the values CEEJAY stores for the player are cleared from the member, and the event player.disconnected is sent. The member can connect again. To remove the player's data as well, use Delete a player.

Path parameters

Prop

Type

The request takes no body. A body that is sent must be a JSON object.

Returns

Prop

Type

Example

Request
curl -X POST https://ceejay.communitystudios.xyz/api/v1/games/rugby_manager/players/p_19/disconnect \
  -H "Authorization: Bearer $CEEJAY_API_KEY"

The TypeScript tab calls ceejay.players.disconnect from the TypeScript SDK. It returns the data of the response below.

200 OK
{
  "success": true,
  "data": {
    "disconnected": true
  }
}

What happens

The connection is ended with the reason studio, in one step: its refresh tokens are revoked, rewards that were queued for it are cancelled, and the game's current values are cleared from the member. A reward already granted is not revoked. CEEJAY's bot then removes the connected role and sends player.disconnected shortly afterwards, so the response does not wait for either.

A connection that has ended is not found: a second call returns 404 with the code player_not_found, and changes nothing. The request takes no idempotencyKey for that reason.

Players of a paused game, and of a game made for children, can still be disconnected.

The scope

players:connect lets a server act for a player. Here it ends a connection, and elsewhere it creates a pass with which a player who is already connected is signed in. Keep it on your own server. It is never part of *: a Full Access key returns 403 here. Tick Act for a player when you make the key.

Limits

This request is counted against the key's own requests per minute: 60 unless a higher limit was set on it, and never more than 600. Rate limits has the numbers and the headers.

Errors

StatuscodeerrorWhen
400bad_requestThe request body must be a JSON objectThe body is null, text, a number or a list
400bad_player_idplayerId must be 1 to 128 characters: letters, digits and . _ : @ | + = -, starting with a letter or a digitThe player ID in the URL path is longer than 128 characters, or contains a character that is not allowed (letters, digits and . _ : @ | + = -, starting with a letter or a digit)
403community_not_activeThis community is no longer active on CEEJAYThe community removed CEEJAY from its server
403game_not_allowedThis API key is limited to other gamesThe key is limited to other games of the community
404not_availableThis is not available on this instance yet.Connect is not enabled for this instance. It is enabled per instance. The body adds feature, which is players. Retrying will not change the response
404game_not_foundGame not foundThe community has no game with this slug, or the game was removed. A slug that is not 2 to 32 lower-case letters, digits and underscores, starting with a letter, gets this response too
404player_not_foundNo connected player has this playerIdNo active connection exists for this player ID. A connection that has ended is not found

Every error body also carries requestId, and a 400 with the code bad_request names the invalid field in field. Match on code, not on the message text, which can change.

The errors every request shares (401, 403 for a missing scope, 405, 429, 500) are on the Errors page.

On this page

Community StudiosPrivacyTerms