CEEJAYDocs

Disconnect

End a player's connection from inside the game, with the refresh token stored on the device.

POST /v1/player/disconnect · for public key

Call it when the player presses Disconnect in your game. Then discard the refresh token and the player session.

Body parameters

Prop

Type

Returns

Prop

Type

Example

Request
curl -X POST https://ceejay.communitystudios.xyz/api/v1/player/disconnect \
  -H "Authorization: Bearer $CEEJAY_PUBLIC_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "refreshToken": "ceejay_rt_5512.1.4f8a2c1e9b7d3e41f8a6b0c1d25f0c2a9b7d3e41f8a6b0c1d24f8a2c1e9b7d3e"
  }'

The TypeScript example uses connect.disconnect from the Connect client in the TypeScript SDK. It sends the stored refresh token, discards the tokens and returns nothing.

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

What it does

The connection is ended and every device of it is signed out: a player session of any of them returns 401 with the code connection_ended from then on.

It works whether or not the person is in the server. Someone who never joined, or who left, has a refresh token and no player session, and can still disconnect.

A member who disconnects this way has chosen to: a studio's server cannot link them to the game again with Link an account, which returns 409 with the code member_disconnected. The restriction clears when the member connects again.

A member can also disconnect without using the game, at the manageUrl, signing in with only their Discord account.

Retrying safely

The request is safe to repeat. A token whose connection has already ended returns 200.

A device that was signed out while the connection goes on cannot end it: its token returns 401 with the code invalid_refresh_token.

Errors

StatuscodeerrorWhen
400bad_requestThe request body must be a JSON objectThe body is null, text, a number or a list. A request with no Content-Type header is read as text, so it gets this error too
401invalid_refresh_tokenInvalid refresh tokenrefreshToken is missing, is not a refresh token issued by this instance, belongs to another game, or is the token of a device that was signed out while the connection goes on

Every error body also includes requestId, and a 400 with the code bad_request identifies the invalid field in field. Match on code; message text can change.

The errors every request of a game shares (the key, the state of the game, the origin, 405, 429, 500) are on the Errors page.

On this page

Community StudiosPrivacyTerms