0xDocs 0x.limo

Docs / REST API

Inventory

ISteamInventory on 0x — item definitions, per-player items, purchases from the 0x balance, promos, exchanges, playtime drops, trades and Ed25519-signed results your server can check offline.

The inventory API is the 0x implementation of Steam's ISteamInventory. Unmodified Steam games use it through sg-steamclient, and you can call it directly. Every route is per app: /v1/apps/{appid}/inventory....

In-game purchases vs. inventory

This is the Steam-style item inventory: item definitions, drops, exchanges and trades. For selling items in a web game with a player-confirmed purchase and a signed receipt, see in-game purchases, which are switched off on 0x.limo for now.

#Item definitions

Definitions live in the app record (inventory.item_defs) in Steam's itemdef style:

FieldMeaning
itemdefidthe definition ID
typeitem, bundle, generator or playtimegenerator
name, pricedisplay name; price in cents (purchasable items)
promomanual or owns:<appid> (granted to owners of another app)
exchangerecipes, separated by ;, with ingredients separated by ,, e.g. 101x3,102;103x10
bundlecontents, e.g. 100;101x5; for generators the counts are weights
drop_interval, drop_window, drop_max_per_windowplaytime drop rules (minutes)
bash
curl -s https://api.0x.limo/v1/apps/480/inventory/defs -H "Authorization: Bearer $TOKEN"
# {"defs": [...], "currency": "USD"}

GET /v1/apps/{appid}/inventory/prices returns prices and the caller's balance.

#Items

RouteBodyDoes
GET /v1/apps/{appid}/inventoryall the caller's items (signed result)
POST .../inventory/by_id{ids: [item ids]}some items (signed result)
POST .../inventory/purchase{items: [[def, qty], ...]}buy items with the 0x balance
POST .../inventory/promo{defs: [def, ...]}claim promo items the caller is eligible for
POST .../inventory/consume{id, qty?}use up units of an item
POST .../inventory/exchange{generate: [[def, qty]], destroy: [[item, qty]]}craft by a recipe
POST .../inventory/transfer{src, qty, dest?}split or stack items
POST .../inventory/drop{def}a playtime drop, if one is due
POST .../inventory/propertiesset dynamic properties on items
POST .../inventory/generate{items: [{def, qty}]}publishers only: grant items (others get result 15)
GET .../inventory/inspectone player's item as a signed result (result 9 when there is none)

Lists hold at most 128 lines. Quantities are positive 64-bit integers.

#Purchases debit the 0x balance

purchase debits the player's 0x balance (the same balance top-ups fill) in the same transaction that grants the items, so a purchase is all or nothing. Send an Idempotency-Key: a retried purchase then returns the first result instead of charging twice.

bash
curl -s https://api.0x.limo/v1/apps/480/inventory/purchase \
  -H "Authorization: Bearer $TOKEN" -H "Idempotency-Key: $(uuidgen)" \
  -H 'Content-Type: application/json' -d '{"items": [[1001, 1]]}'

#Signed results

Every item result looks like:

json
{"result": 1, "items": [{"id": 1, "def": 1001, "qty": 1}], "ts": 1792250000, "signed": "5347494e56310000..."}

result is a Steam EResult (1 = OK). signed is a hex blob your game server can check offline:

text
"SGINV1\0\0" (8 bytes) | payload length (u32, little-endian) | JSON payload | Ed25519 signature (64 bytes)

The signature covers everything before it. Verify it with the current key from GET /v1/keys, then trust the JSON payload. A failed operation answers {"result": <code>, "error": "...", "items": []}.

#Trades

POST /v1/apps/{appid}/inventory/trade {partner, give: [{id, qty}], get: [{id, qty}]} (at most 50 lines each) stores an offer for 5 minutes. It answers {status: "pending", offer, result: 22}. When the partner posts the mirror-image offer, the swap happens atomically and both sides get {status: "done", ...}. Only tradable definitions can be traded. Poll GET .../inventory/trade/{offer}, or listen for inventory_trade on the push stream.

See the generated apps reference.