Skip to main content
All endpoints in this section require Connected + API (valid JWT from API key login). The cart stores items you intend to purchase. Each cart row can contain one or more asset IDs for the same item at the same price (grouped by price). Cart integrity can be verified and invalid items (unavailable, price changed) can be automatically replaced by equivalent plain items at the same price when possible.

Get cart

GET /cart/get
Permission: Connected + API Returns the authenticated user’s cart with full item details (name, image, price, effect, quality, etc.) for each row.

Response

{
  "err": false,
  "success": true,
  "content": {
    "cart": [
      {
        "cartId": 42,
        "assetId": "987654321,987654322",
        "count": 2,
        "item_id": 5678,
        "price": 15000,
        "name": "Unusual Burning Flames Team Captain",
        "image": "https://...",
        "effect": "Burning Flames",
        "rarity": "Unusual",
        "color": "#8650AC",
        "url": "unusual_team_captain",
        "quality": "Unusual",
        "type_steam": "Hat",
        "class": "hat",
        "craftable": 1,
        "slot": "Misc",
        "game": 440,
        "sheen": "",
        "killstreaker": "",
        "spell": "",
        "parts": "",
        "paint": "",
        "level": null,
        "festivized": 0,
        "inspect": ""
      }
    ]
  }
}

Cart item fields

FieldTypeDescription
cartIdintegerCart row ID (use for remove)
assetIdstringComma-separated asset IDs in this row
countintegerNumber of items in this row
item_idintegerItem type ID
priceintegerPrice in cents (stored at add time)
namestringItem name
imagestringItem image URL
effectstringUnusual/effect name
raritystringQuality/rarity
qualitystringQuality label
gameintegerGame ID (e.g. 440 = TF2, 730 = CS)
Additional fields from the items/backpack tables (e.g. url, type_steam, class, craftable, slot, sheen, killstreaker, spell, parts, paint, level, festivized, inspect, values) may be present.

Add item to cart

POST /cart/add
Permission: Connected + API Adds a single item to the cart by its asset ID. The item must be for sale (state = 1) and not owned by the current user. The price is stored at add time.

Body parameters

assetId
string
required
Steam asset ID of the item to add (from a listing)

Request example

{
  "assetId": "987654321"
}

Response

Success
{
  "err": false,
  "success": true,
  "content": {
    "cart": [
      {
        "cartId": 43,
        "assetId": "987654321",
        "count": 1,
        "item_id": 5678,
        "price": 15000,
        "name": "Unusual Burning Flames Team Captain"
      }
    ]
  }
}

Error responses

StatusMessageDescription
errorMissing required parameter: assetIdassetId was not sent
errorItem not available for purchaseItem not found, not for sale (state β‰  1), or owned by you
errorItem already in cartThis assetId is already in your cart

Bulk add to cart

POST /cart/bulk
Permission: Connected + API Adds multiple items of the same type to the cart in one call. The API selects the requested number of cheapest available listings for the given item (excluding items already in your cart). Items are grouped by price: one cart row per distinct price with comma-separated asset IDs.

Body parameters

itemId
integer
required
Item type ID (from the items table)
count
integer
required
Number of items to add (must be positive)
sellerUserId
string
Optional. If provided, only consider listings from this seller (Steam ID)

Request example

{
  "itemId": 5678,
  "count": 5
}

Response

Success
{
  "err": false,
  "success": true,
  "content": {
    "cart": [
      {
        "cartId": 44,
        "assetId": "111,222,333",
        "count": 3,
        "item_id": 5678,
        "price": 14000
      },
      {
        "cartId": 45,
        "assetId": "444,555",
        "count": 2,
        "item_id": 5678,
        "price": 15000
      }
    ]
  }
}

Error responses

StatusMessageDescription
errorMissing required parameters: itemId, countOne or both parameters missing
errorInvalid itemId parameteritemId empty or not numeric
errorInvalid count parameter. Must be a positive numbercount empty, not numeric, or ≀ 0
errorNo items availableNo listings found for this item (or none matching filters)
Items are ordered by price ascending, then by last update. Already-in-cart asset IDs are excluded from the selection.

Remove from cart

POST /cart/remove
Permission: Connected + API Removes one cart row (and all its asset IDs) from the cart.

Body parameters

cartId
integer
required
Cart row ID (from get cart response)

Request example

{
  "cartId": 42
}

Response

Success
{
  "err": false,
  "success": true,
  "content": {
    "cart": []
  }
}

Error responses

StatusMessageDescription
errorMissing required parameter: cartIdcartId was not sent
errorInvalid cartId parametercartId ≀ 0
errorCart item not foundNo cart row with this ID for the current user

Update cart (integrity + replace)

POST /cart/update
Permission: Connected + API Runs cart integrity checks and optionally fixes the cart:
  1. Verify integrity: For each item in the cart, checks that it still exists in the backpack, is still for sale (state = 1), and has the same price. Items that are not found, unavailable, have a different price, or are your own are marked invalid.
  2. Replace plain items: For each invalid item that is β€œplain” (no spell, sheen, wear, killstreaker, parts), the API tries to find another listing of the same item at the same price that is plain and available. If found, the cart row is updated to use the new asset ID. If not found, the invalid asset ID is removed from the cart row. Non-plain invalid items are only removed (no replacement attempt).
  3. Cleanup: Cart rows that end up with no asset IDs are deleted.
Use this before checkout to ensure all cart items are still valid and to auto-replace invalid plain items when possible.

Response

Success
{
  "err": false,
  "success": true,
  "content": {
    "integrity": {
      "valid": false,
      "invalidItems": [
        {
          "cartId": 42,
          "assetId": "987654321",
          "reason": "price_changed",
          "currentPrice": 16000,
          "expectedPrice": 15000
        },
        {
          "cartId": 43,
          "assetId": "987654322",
          "reason": "unavailable"
        }
      ]
    },
    "replaced": [
      {
        "cartId": 42,
        "oldAssetId": "987654321",
        "newAssetId": "987654999",
        "reason": "price_changed"
      }
    ],
    "removed": [
      {
        "cartId": 43,
        "assetId": "987654322",
        "reason": "unavailable"
      }
    ],
    "cart": [
      {
        "cartId": 42,
        "assetId": "987654999",
        "count": 1,
        "item_id": 5678,
        "price": 15000
      }
    ]
  }
}

Response fields

FieldTypeDescription
integrity.validbooleantrue if no invalid items were found
integrity.invalidItemsarrayList of invalid items with cartId, assetId, reason; price_changed entries include currentPrice and expectedPrice
replacedarrayItems that were replaced: cartId, oldAssetId, newAssetId, reason
removedarrayInvalid items that were removed without replacement: cartId, assetId, reason
cartarrayFull cart after updates (same structure as GET /cart/get)

Invalid item reasons

ReasonDescription
not_foundItem no longer exists in backpack
unavailableItem not for sale (state β‰  1)
price_changedItem price in backpack differs from cart
own_itemItem belongs to the current user
Replacement is only attempted for β€œplain” items (no spell, sheen, wear, killstreaker, parts). Non-plain invalid items are removed from the cart without replacement.

Error responses

StatusMessageDescription
errorCannot update cartAn exception occurred during update

Code examples

Get cart and update before checkout

// 1. Get current cart
const getRes = await fetch('https://api.example.com/cart/get', {
  method: 'GET',
  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
});
const { content: { cart } } = await getRes.json();

// 2. Run integrity check and auto-replace invalid plain items
const updateRes = await fetch('https://api.example.com/cart/update', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: '{}'
});
const update = await updateRes.json();
if (!update.content.integrity.valid) {
  console.log('Invalid items:', update.content.integrity.invalidItems);
  console.log('Replaced:', update.content.replaced);
  console.log('Removed:', update.content.removed);
}
// Use update.content.cart for checkout

Add single item and bulk add

// Add one item by assetId
await fetch('https://api.example.com/cart/add', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ assetId: '987654321' })
});

// Add 10 of the same item (cheapest available)
await fetch('https://api.example.com/cart/bulk', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ itemId: 5678, count: 10 })
});

Remove a cart row

await fetch('https://api.example.com/cart/remove', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ cartId: 42 })
});