Skip to Content
Canonical source of truth stays in the repository docs. This site is the polished presentation layer.
Write Flows And Payloads

Write Flows And Payloads

This page covers the part of the SDK that usually causes the most hesitation:

  • what the mutation-heavy payloads actually look like
  • which fields are required
  • which flows are safe and stable versus low-level or state-gated

Use this page together with Resource Reference and Stability And Coverage.

Safety First

Unlike the shipped examples/*.mjs, the examples on this page are intentionally docs-only.

They can create, modify, buy, accept, favorite, or cancel real marketplace state.

Before using them against a real account:

  1. verify account state and role assumptions
  2. start with the smallest possible price, quantity, or batch
  3. handle CsfloatSdkError and inspect kind, status, and apiMessage
  4. prefer preview builders where they exist, especially for buy-order expressions

Offers

account.createOffer()

Request type: CreateOfferRequest

FieldRequiredMeaning
contract_idyestarget listing contract id
priceyesoffered price

Minimal payload:

await sdk.account.createOffer({ contract_id: "945821907352158315", price: 1_250, });

account.counterOffer()

Request type: CounterOfferRequest

FieldRequiredMeaning
priceyescounter-offer price

Minimal payload:

await sdk.account.counterOffer("offer-id", { price: 1_400, });

Notes

  • acceptOffer() is intentionally low-level even though it is implemented.
  • offer acceptance and counter behavior can be actor- and state-sensitive.
  • use getOffer() and getOfferHistory() to inspect the thread before mutating it.

Trades And Steam Sync

Bulk Trade Requests

Request type: AcceptTradesRequest

FieldRequiredMeaning
trade_idsyesone or more trade ids

Examples:

await sdk.account.acceptTrades({ trade_ids: ["trade-1", "trade-2"], }); await sdk.account.cancelTrades({ trade_ids: ["trade-1", "trade-2"], }); await sdk.account.markTradesReceived({ trade_ids: ["trade-1"], });

Low-Level Steam Sync Helpers

syncSteamNewOffer() request shape:

FieldRequiredMeaning
offer_idyesSteam offer id as string
given_asset_idsnooptional asset ids the seller gave in that offer
received_asset_idsnooptional asset ids the seller received in that offer

syncSteamOffers() request shape:

FieldRequiredMeaning
sent_offersyescurrent set of sent offers, usually an array
trade_idnorelated CSFloat trade id when available

Examples:

await sdk.account.syncSteamNewOffer({ offer_id: "1234567890123456789", given_asset_ids: ["asset-1"], received_asset_ids: ["asset-2"], }); await sdk.account.syncSteamOffers({ trade_id: "trade-1", sent_offers: [], });

Notes

  • trade accept/cancel/received flows are real but state-gated
  • bulk accept can reject ids that look visible but are not actionable in the current account state
  • the Steam sync helpers are useful operator tools, but they are still lower-level than the average app flow
  • single-trade low-level helpers such as cannotDeliverTrade(), disputeTrade(), markTradeReceived(), rollbackTrade(), manualVerifyTrade(), and verifyTradeRollback() now exist for the browser-confirmed trade lifecycle edges; treat them as advanced/state-gated operations rather than generic happy-path methods

Buy Orders

There are two supported creation shapes.

Market-Hash Creation

Request type: CsfloatCreateMarketHashBuyOrderRequest

FieldRequiredMeaning
market_hash_nameyesitem market hash name
max_priceyesmax purchase price
quantitynoquantity, defaults to API behavior when omitted

Example:

await sdk.account.createBuyOrder({ market_hash_name: "AK-47 | Redline (Field-Tested)", max_price: 1_500, quantity: 1, });

Expression Creation

Request type: CsfloatCreateExpressionBuyOrderRequest

FieldRequiredMeaning
expressionyesvalidated buy-order expression AST
max_priceyesmax purchase price
quantitynoquantity

Example:

import { buildSingleSkinBuyOrderExpression } from "csfloat-node-sdk"; const expression = buildSingleSkinBuyOrderExpression(7, 72, { stattrak: false, souvenir: false, min_float: 0.01, max_float: 0.07, }); await sdk.account.createBuyOrder({ expression, max_price: 3, quantity: 1, });

Update And Similar-Order Requests

updateBuyOrder() request type: UpdateBuyOrderRequest

FieldRequiredMeaning
max_priceyesnew max price

getSimilarBuyOrders() request supports one of:

  • { market_hash_name }
  • { expression }

Examples:

await sdk.account.updateBuyOrder("order-id", { max_price: 1_700, }); await sdk.account.getSimilarBuyOrders({ market_hash_name: "AK-47 | Redline (Field-Tested)", }, 5);

Notes

  • use the builders in Helpers, Builders, And Constants instead of hand-writing large expression objects
  • for risky or complex expression work, build a preview request first and inspect similar orders before creating a live order

Listings And Bids

Buy-Now Listing Creation

Request type: CreateBuyNowListingRequest

FieldRequiredMeaning
asset_idyesinventory asset id
priceyeslisting price
privatenoprivate listing toggle
descriptionnolisting description, max 32 characters
max_offer_discountnolisting-level max offer discount
typenooptional, defaults to "buy_now"

Example:

await sdk.listings.createBuyNowListing({ asset_id: "1234567890", price: 2_500, private: true, description: "clean", max_offer_discount: 5, });

Auction Listing Creation

Request type: CreateAuctionListingRequest

FieldRequiredMeaning
typeyesmust be "auction"
asset_idyesinventory asset id
reserve_priceyesreserve price
duration_daysyesone of 1, 3, 5, 7, 14
privatenoprivate listing toggle
descriptionnodescription

Example:

await sdk.listings.createAuctionListing({ type: "auction", asset_id: "1234567890", reserve_price: 2_000, duration_days: 3, private: false, });

Listing Updates

Request type: UpdateListingRequest

FieldRequiredMeaning
pricenonew price
descriptionnonew description
max_offer_discountnonew max-offer discount
privatenotoggle privacy

Example:

await sdk.listings.updateListing("listing-id", { price: 2_700, description: "updated", max_offer_discount: 5, private: true, });

Bulk Listing Updates

Request type: UpdateBulkListingRequest

FieldRequiredMeaning
contract_idyeslisting contract id
priceyesreplacement price

Example:

await sdk.listings.updateBulkListings([ { contract_id: "contract-1", price: 1_500 }, { contract_id: "contract-2", price: 2_000 }, ]);

Buy-Now And Bids

buyNow() request type: BuyNowRequest

FieldRequiredMeaning
contract_idsyesone or more contract ids
total_priceyesexpected total purchase price

placeBid() request type: PlaceBidRequest

FieldRequiredMeaning
max_priceyesbid ceiling

Examples:

await sdk.listings.buyNow({ contract_ids: ["contract-1", "contract-2"], total_price: 4_500, }); await sdk.listings.placeBid("listing-id", { max_price: 1_800, });

Notes

  • listing creation can be account-gated
  • bulk listing flows are useful but can hit seller or eligibility gates
  • buyNow() is a real side-effecting purchase flow, so verify totals before calling it

Account Preference Updates

Low-level request type: CsfloatUpdateMeRequest

FieldMeaning
max_offer_discountaccount-level max offer discount
offers_enabledenable or disable offers
stall_publictoggle public stall visibility
awaytoggle away status
trade_urlaccount trade URL
background_urlprofile background image URL
usernamedisplay username

Example:

await sdk.account.updateMe({ offers_enabled: true, stall_public: true, max_offer_discount: 5, trade_url: "https://steamcommunity.com/tradeoffer/new/?partner=123&token=abc", });

Equivalent convenience helpers:

  • setOffersEnabled()
  • setStallPublic()
  • setAway()
  • setMaxOfferDiscount()
  • updateTradeUrl()
  • updateBackground()
  • updateUsername()

Email And Phone Verification

Low-level request types:

  • CsfloatVerifyEmailRequest
  • CsfloatVerifySmsRequest

Field shapes:

FieldMeaning
emailtarget email address for the verification flow
phone_numbertarget phone number for the verification flow
tokenoptional code/token used to confirm a previously requested verification

Examples:

await sdk.account.verifyEmail("user@example.com"); await sdk.account.verifyEmail("user@example.com", "123456"); await sdk.account.verifySms({ phone_number: "+12025550123", }); await sdk.account.verifySms({ phone_number: "+12025550123", token: "654321", });

Notes:

  • calling these helpers without token requests a verification message
  • calling them with token attempts to confirm the verification
  • the SDK intentionally keeps these as low-level account helpers because delivery/validation behavior is API-controlled

Loadout CRUD And Recommendations

Loadout Side Shape

CsfloatCreateLoadoutRequest and CsfloatUpdateLoadoutRequest both use this high-level structure:

FieldRequiredMeaning
nameyesloadout name
ctyesCT-side CsfloatLoadoutSide object
tyesT-side CsfloatLoadoutSide object

A CsfloatLoadoutSide can contain:

  • is_filled
  • agent
  • gloves
  • knife
  • zeus
  • midtier
  • pistols
  • rifles

Each item ref is a CsfloatLoadoutItemRef with fields such as:

  • def_index
  • paint_index
  • wear_index
  • isLocked
  • stat_trak
  • stickers

Create Or Update A Loadout

Example:

const recommender = await sdk.account.createRecommenderToken(); await sdk.loadout.createLoadout(recommender.token, { name: "My CT/T setup", ct: { is_filled: true, rifles: [{ def_index: 7, paint_index: 490 }], }, t: { is_filled: true, rifles: [{ def_index: 60, paint_index: 16 }], }, });

updateLoadout() uses the same request shape.

Recommendation Requests

recommend() request type: CsfloatLoadoutRecommendationRequest

FieldRequiredMeaning
itemsyesarray of { type: "skin", def_index, paint_index }
countyesdesired result count
def_whitelistnoallowed weapon ids
def_blacklistnoexcluded weapon ids

recommendStickers() request type: CsfloatStickerRecommendationRequest

FieldRequiredMeaning
itemsyesarray of skin items
countyesdesired result count
collection_whitelistnoallowed sticker collections

generateRecommendations() request type: CsfloatGenerateLoadoutRecommendationsRequest

FieldRequiredMeaning
def_indexesyestarget weapon ids
factionyesct or t
itemsyescurrent item refs for the generator context
max_pricenomax spend cap

Examples:

await sdk.loadout.recommend(recommender.token, { items: [{ type: "skin", def_index: 7, paint_index: 490 }], count: 5, def_whitelist: [7, 9, 13], }); await sdk.loadout.recommendStickers(recommender.token, { items: [{ type: "skin", def_index: 7, paint_index: 490 }], count: 10, collection_whitelist: ["2021 Train Collection"], });

Notes

  • loadout writes and recommendations require a recommender token, not the plain API key
  • cloneLoadout() is the safest convenience path when you want to start from an existing public loadout
  • recommendation and generate helpers are ideal places to use the builder helpers from Helpers, Builders, And Constants
Last updated on