CEEJAYDocs

Claim an item

Claim a purchase awaiting the player: the item is delivered, a role is assigned or a giveaway is entered.

POST /v1/player/claim · for player session

Use it when the player claims a purchase from Read the locker whose status is claimable. The item is delivered or passed to the community's team for fulfilment, the role is assigned, or the giveaway is entered. A purchase that was already claimed returns alreadyClaimed: true with its current status, which is also what a retry after a lost response returns, so the request is safe to repeat and takes no key. The request needs the game loop. For the three conditions (game loop enabled for the game, member consent, server membership) and the error each returns, see What has to be true first.

Body parameters

Prop

Type

Returns

Prop

Type

delivery contains:

Prop

Type

status and waitingFor have the values of Buy a shop item.

Example

Request
curl -X POST https://ceejay.communitystudios.xyz/api/v1/player/claim \
  -H "Authorization: Bearer $CEEJAY_PLAYER_SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "purchaseId": 4242,
    "input": {
      "title": "Harbour RFC"
    }
  }'

The TypeScript example uses connect.hub.claim from the Connect client in the TypeScript SDK. The player must be connected first: the client manages and refreshes the player session. It returns the data of the response below.

200 OK
{
  "success": true,
  "data": {
    "purchaseId": 4242,
    "claimed": true,
    "alreadyClaimed": false,
    "itemName": "Gold skin",
    "status": "pending",
    "waitingFor": "delivery",
    "delivery": {
      "state": "pending",
      "message": null
    }
  }
}
200 OK, it was claimed before
{
  "success": true,
  "data": {
    "purchaseId": 4242,
    "claimed": true,
    "alreadyClaimed": true,
    "itemName": "Gold skin",
    "status": "pending",
    "waitingFor": "delivery",
    "delivery": {
      "state": "pending",
      "message": null
    }
  }
}

What a claim needs

A claim redeems what a purchase bought, so it has the same requirements as buying: a device that connected with proof when the game requires proof (403 with the code verified_proof_required), and a connection and a device whose spending hold has ended (409 with the code spend_on_hold). It spends no coins and does not count toward the daily limit. The game loop explains the rules.

Only the member's own purchases, made through this game or of an item on the game's allow list, can be claimed here. Any other purchase, a purchase of another member or of another community, and an earned reward all return 404 with the code purchase_not_found. A purchase that is not claimable and not already claimed returns 409 with the code not_claimable and its status. When the item requires input and input is missing or invalid, the response is 400 with field: "input", and fields lists the inputs required.

Limits

20 writes a minute for one player session, and 60 buys and claims together an hour for one member in one game. The 20 writes are shared by Start, Verify and Answer a quest task, Buy a shop item, Claim an item and Check in. The three X-RateLimit headers report that count. Every request made with a player session also counts toward 140 a minute. See Rate limits. Over a limit the response is 429 with the code rate_limited, retryAfter and a Retry-After header.

Errors

StatuscodeerrorWhen
400bad_requestThe request body must be a JSON objectThe body is JSON but not an object: null, text, a number or a list. A body that is not JSON at all returns bad_request with the message The request body must be JSON
400bad_requestpurchaseId must be a whole number from 1 to 2147483647purchaseId is missing, is not a whole number, or is outside 1 to 2,147,483,647
400bad_requestThis item needs further details before it can be claimedinput is missing or invalid for an item that requires input. The body includes fields, the inputs required
401connection_endedThis connection has endedThe connection or this device was ended since the player session was made. Discard the stored tokens and show the player as disconnected. See Renew a player session for the reasons
403verified_proof_requiredThis requires a verified player. This device connected without verificationThis device connected without verification, and the game only lets verified players spend
404purchase_not_foundPurchase not foundThe purchase is not this member's or this game's, is an earned reward, or does not exist
409hub_not_enabledThis game does not show the community's quests, shop and rankThe game loop is disabled for the game. Do not show the community's quests, shop or rank in the game
409sharing_neededThe member has not consented to sharing their data with this gameThe member has not consented to share their quests, rewards, shop and rank with the game, or must consent again. The body includes manageUrl: send the player there
409membership_requiredThe member has to be in the server to use thisThe Discord account is not in the server. The body includes membership (pending, left or not_member) and, for left and not_member, joinUrl, the URL to send the player to
409spend_on_holdThis device cannot spend yet. New connections and devices cannot buy until the hold endsA new connection or device is still on hold. The body includes holdUntil and retryAfter
409not_claimableThis item cannot be claimed right nowThe purchase is in a state that cannot be claimed. The body includes status
413body_too_largeThe request body is larger than 16 KBThe body is larger than 16 KB. Nothing was changed
503bot_unavailableThis could not be done right now and nothing was changed. Try again in a few secondsCEEJAY's bot could not be reached or was too busy, and nothing was changed. The body includes retryAfter, in seconds: retry after that many seconds
504bot_timeoutThe answer did not arrive in time, and the request may or may not have been done. Send the same request again: it is safe to repeatThe request timed out, so it is not known whether it was processed. Retry the same request: it is safe to repeat

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, and the errors specific to the game loop are under Codes of the game loop.

On this page

Community StudiosPrivacyTerms