Skip to content
Skip the menu

API reference

Inventory API

List what a player owns, give them items and consume them from your backend with the server API.

View as Markdown

On this page

The inventory is what a player owns: the quantity of each item of your catalog. An item is either consumable (used up, like a potion) or durable (kept, like a sword, often limited to one). This page lists an inventory, grants items for free and consumes them. To sell an item for coins, use Purchases. The examples on this page continue from the setup.

List the inventory

Returns the items a player owns. Use it to show an inventory screen, or to check that a player owns an item before you let them use it.

GET/players/{player}/inventory

Authentication: secret key. Idempotency: not needed.

Path parameters

ParameterTypeDescription
playerstringA GameCoin player id, or ext:<your id> URL-encoded once.
LangageLanguage
curl "https://gamecoin.apilow.com/api/v1/players/ext%3Auser-42/inventory" \
  -H "Authorization: Bearer $GAMECOIN_SECRET_KEY"

Response 200 OK: the owned items.

FieldTypeDescription
itemsarray of InventoryItemThe items with a quantity above 0. Empty when the player owns nothing.
JSON
{
  "items": [{ "sku": "potion", "quantity": 3, "updatedAt": "2026-10-05T22:14:37.251Z" }]
}

Errors

StatusCodeWhenWhat to do
400VALIDATION_FAILEDThe player reference is malformed (PLAYER_REF_INVALID)Encode the ext: reference exactly once.
404NOT_FOUNDThe player does not existAn ext: player exists after its first write; before that, treat the inventory as empty.

Notes

  • The list holds owned items only: an item the player has used up (quantity 0) is not listed. The SDKs return the array of items directly (inventory.list), without the items wrapper.
  • sku is the key of the item in your catalog: see Get the catalog for its name, type, price and limit.

Grant an item

Gives items to a player for free: a reward, a gift, a compensation. Nothing is debited. It is for your backend only: the client API can never give an item.

POST/players/{player}/inventory/grant

Authentication: secret key. Idempotency: required (Idempotency-Key header).

Path parameters

ParameterTypeDescription
playerstringA GameCoin player id, or ext:<your id> URL-encoded once. An unknown ext: player is created.

Body

FieldTypeRequiredRules
skustringyesThe sku of an active item of the catalog: 1 to 48 characters.
quantityintegernoA whole number from 1 to 1,000,000,000,000. Default 1.
LangageLanguage
curl -X POST "https://gamecoin.apilow.com/api/v1/players/ext%3Auser-42/inventory/grant" \
  -H "Authorization: Bearer $GAMECOIN_SECRET_KEY" \
  -H "Idempotency-Key: grant-potions-user-42" \
  -H "Content-Type: application/json" \
  -d '{"sku": "potion", "quantity": 3}'

Response 200 OK: the item with its new quantity.

FieldTypeDescription
itemInventoryItemThe item and the quantity the player owns after the grant.
JSON
{ "item": { "sku": "potion", "quantity": 3, "updatedAt": "2026-10-05T22:14:37.251Z" } }

Errors

StatusCodeWhenWhat to do
400IDEMPOTENCY_KEY_REQUIREDThe Idempotency-Key header is missing or emptySend one: see Idempotency.
400VALIDATION_FAILEDAn unknown field; sku empty or longer than 48 characters; quantity not an integer between 1 and 10¹²; a key that is not 1 to 100 printable ASCII charactersRead details.fieldErrors.
403PLAYER_BLOCKEDThe player is blockedNothing can be written for this player until the player is unblocked.
404NOT_FOUNDThe item is not in the catalog (or is archived), or a GameCoin id does not existCheck the sku against Get the catalog.
409LIMIT_REACHEDThe grant would take the player over the item's maxOwned: details.maxOwned and details.ownedNothing was granted. Grant less, or nothing: the player already has the item.
409IDEMPOTENCY_CONFLICTThe key was already used with a different requestUse a new key for a new grant.
JSON
{
  "error": {
    "code": "LIMIT_REACHED",
    "message": "Item ownership limit exceeded",
    "details": { "maxOwned": 1, "owned": 1 }
  }
}

Notes

  • Replay. The same key with the same request returns the original response again, with the header Idempotent-Replayed: true, and changes nothing.
  • A grant adds to what the player owns; it never replaces it. Granting 3 potions to a player who owns 2 leaves them with 5.
  • A limit is all or nothing: a grant that would pass maxOwned is refused entirely, not cut down to fit. For an item with maxOwned: 1, grant it once.
  • The SDKs return the inventory item with a replayed flag (Replayed in Go and C#) that is true when the answer is the replay of an earlier request with the same key.
  • The first write on an unknown ext: player creates it.

Consume an item

Removes units of a consumable item: the player drinks a potion, you take a ticket. Use it when your game confirms the use of an item, so that the inventory stays the source of truth.

POST/players/{player}/inventory/consume

Authentication: secret key. Idempotency: required (Idempotency-Key header).

Path parameters

ParameterTypeDescription
playerstringA GameCoin player id, or ext:<your id> URL-encoded once. An unknown ext: player is created, with an empty inventory.

Body

FieldTypeRequiredRules
skustringyesThe sku of an active item of the catalog: 1 to 48 characters.
quantityintegernoA whole number from 1 to 1,000,000,000,000. Default 1.
LangageLanguage
curl -X POST "https://gamecoin.apilow.com/api/v1/players/ext%3Auser-42/inventory/consume" \
  -H "Authorization: Bearer $GAMECOIN_SECRET_KEY" \
  -H "Idempotency-Key: use-potion-user-42-1" \
  -H "Content-Type: application/json" \
  -d '{"sku": "potion"}'

Response 200 OK: the item with its remaining quantity.

FieldTypeDescription
itemInventoryItemThe item and the quantity the player owns after the consumption. It is returned even when the quantity reaches 0.
JSON
{ "item": { "sku": "potion", "quantity": 2, "updatedAt": "2026-10-05T22:14:37.830Z" } }

Errors

StatusCodeWhenWhat to do
400IDEMPOTENCY_KEY_REQUIREDThe Idempotency-Key header is missing or emptySend one: see Idempotency.
400VALIDATION_FAILEDAn unknown field; sku empty or longer than 48 characters; quantity not an integer between 1 and 10¹²; a key that is not 1 to 100 printable ASCII charactersRead details.fieldErrors.
403PLAYER_BLOCKEDThe player is blockedNothing can be written for this player until the player is unblocked.
404NOT_FOUNDThe item is not in the catalog, or a GameCoin id does not existCheck the sku against Get the catalog.
409INSUFFICIENT_FUNDSThe player owns fewer units than quantity: details.required and details.availableNothing was consumed. Refuse the action in your game.
409CONFLICTThe item is durable: a durable item cannot be consumedOnly consume items of type consumable.
409IDEMPOTENCY_CONFLICTThe key was already used with a different requestUse a new key for a new consumption.
JSON
{
  "error": {
    "code": "INSUFFICIENT_FUNDS",
    "message": "Not enough items",
    "details": { "required": 100, "available": 3 }
  }
}

Notes

  • Replay. The same key with the same request returns the original response again, with the header Idempotent-Replayed: true, and changes nothing.
  • Not owning the item at all is the same as owning 0: it answers INSUFFICIENT_FUNDS with available: 0. The code is the one of the wallet, here applied to a quantity of items.
  • A consumption is all or nothing: asking for more than the player owns consumes nothing.
  • An item that reaches 0 stays out of List the inventory, but its last quantity is in the response so that your game can show it.
  • The browser can consume too, with the player's own token: Consume an item in the client API.