Skip to main content

Types Reference

All TypeScript types used in API responses. These are the shapes you’ll work with when parsing responses and processing callbacks.

Trade

The main trade object returned by deposit/withdraw endpoints, trade history, and callbacks.
interface Trade {
  id: string;                    // Unique trade ID (UUID)
  type: TradeType;               // "deposit" or "withdraw"
  source: TradeSource;           // "client" or "self" (origin flow)
  status: TradeStatus;           // Current trade status
  game: string;                  // Game app ID ("730" or "252490")

  // Participants
  merchantId: string;            // Your merchant ID
  clientUserId: string;          // Internal client user ID
  clientSteamID: string;         // User's Steam ID 64
  clientTradeUrl: string;        // User's Steam trade URL

  // Items and pricing
  items: Item[];                 // Items in this trade
  totalPrice: number;            // Total value in USD

  // Instant deposit fields (deposits only)
  preCredit?: number;            // Amount credited instantly (USD)
  pendingCredit?: number;        // Amount held until "completed" (USD)
  isInstant?: boolean;           // Whether instant credit was requested
  collateral?: {
    merchant: number;            // Merchant collateral portion
    provider: number;            // Provider collateral portion
  };

  // Tracking
  externalId?: string;           // Your tracking ID (from externalId param)
  externalClientUserId?: string; // Your user ID (from clientId param)
  offerID?: string;              // Steam trade offer ID (present from "active" onward)

  // Timing
  holdEndDate?: Date;            // When the Steam hold expires (present from "hold" onward)
  readyAt?: Date;                // When the trade became ready
  createdAt: Date;
  updatedAt: Date;

  // Status-specific
  revertedBy?: RevertedBy;       // Who reversed the trade (status === "reverted")
  error?: string;                // Failure reason. Withdrawals: a TradeFailureCode, set only when the
                                 //   whole trade failed with one shared cause. Deposits: a Steam error key.

  // Bot details
  botInfo?: {
    name: string;
    avatar?: string;
    steamId?: string;
    joined?: Date;
  };
}

Item

Represents a skin item in inventory, market, or trade responses. Some fields are only present in certain contexts.
interface Item {
  // Identity
  id: string;                    // Encoded item ID
  appid: number;                 // Game app ID (730 or 252490)

  // Description — omitted on bare withdraw items where AssetPay has no Steam-side
  // metadata yet (you supplied only itemId + price). Always present for inventory,
  // market, and post-completion trade items.
  name?: string;                 // Display name (e.g. "AK-47 | Redline")
  marketHashName?: string;       // Full market name (e.g. "AK-47 | Redline (Field-Tested)")
  type?: string;                 // Item type (e.g. "Rifle", "Knife")
  iconUrl?: string;              // Steam image hash (use with Steam CDN base URL)

  // Trade state
  tradable: boolean;             // Whether the item can be traded
  amount?: number;               // Stack count for Rust items

  // Pricing
  marketPrice?: number;          // Market reference price (USD)
  offer?: ItemOffer;             // See ItemOffer below

  // Cosmetic attributes
  exterior?: string;             // "Factory New", "Minimal Wear", etc.
  rarity?: string;               // "Consumer Grade", "Covert", etc.
  color?: string;                // Rarity color hex (e.g. "#EB4B4B")
  wear?: string;                 // Float value as string
  paintSeed?: number;            // Paint seed number
  previewToken?: string;         // Steam inspect/preview token (CS2). Present on inventory and
                                 //   autoseller-pool (self-owned) items; absent on third-party
                                 //   marketplace listings.
  doppler?: Doppler;             // Doppler phase details
  fade?: Fade;                   // Fade percentage details
  hardened?: Hardened;           // Case Hardened pattern details

  // Applied items
  stickers?: Sticker[];          // Applied stickers
  charm?: Charm;                 // Applied charm (CS2 only)

  // Market-specific
  botInfo?: {                    // Holding bot identity — present on autoseller-pool market items
    name: string;
    avatar?: string;
    steamId?: string;
    joined?: Date;
  };

  // Withdrawal-specific (only set on items belonging to a withdraw trade)
  status?: TradeStatus;          // Per-item purchase status, mirrors Trade.status
  error?: TradeFailureCode;      // Failure code — present only on failed withdraw items
}

ItemOffer

The marketplace offer carried on an Item.offer:
interface ItemOffer {
  price: number;                 // Offer price in USD
  reference?: string;            // Parent product reference (e.g. "0010f8d48278ccb8")
                                 //   — the id you query /market/item with. The
                                 //   listing-specific id is the surrounding Item.id.
                                 //   Present on market/inventory items. Omitted on
                                 //   freshly-initiated withdraw items; backfilled
                                 //   from callbacks as the trade progresses.
  delivery?: DeliveryMode;       // "standard" or "instant" (market items only)
  maxAmount?: number;            // Max quantity for stackable items (inventory only)
  accepted?: boolean;            // Whether the item is accepted for deposit (deposit-side inventory only)
}

Sticker

interface Sticker {
  name: string;                  // Sticker display name
  marketHashName?: string;       // Sticker's own market hash name, for deep-linking
  slot: number;                  // Position on the weapon (0-4)
  wear?: number;                 // Sticker wear (0 = perfect, 1 = scraped off)
  iconUrl: string;               // Sticker image URL
}

Charm

interface Charm {
  name: string;                  // Charm display name
  marketHashName?: string;       // Charm's own market hash name, for deep-linking
  iconUrl: string;               // Charm image URL
}

Doppler

Present on doppler-pattern CS2 skins (Glock-18 Gamma Doppler, AWP Asiimov, etc.).
interface Doppler {
  status?: number;               // Marketplace-issued status code (market listings only)
  name: string;                  // Phase name (e.g. "Phase 1", "Ruby", "Sapphire")
  paintIndex?: number;           // Steam paint index, if known
}

Fade

Present on fade skins (Karambit Fade, AWP Fade).
interface Fade {
  percentage: number;            // Fade percentage (0-100)
}

Hardened

Present on Case Hardened skins.
interface Hardened {
  status: number;                // Case Hardened tier code
  name: string;                  // Pattern name (e.g. "Blue Gem")
}

Enums

TradeStatus

All trade and item statuses are lowercase in API requests, responses, and webhook payloads.
type TradeStatus =
  | 'initiated'   // Trade created. Withdrawals: approval gate (merchant wallet not yet debited)
  | 'pending'     // (Withdrawals only) Supplier is sourcing the item / creating the purchase
  | 'active'      // Steam trade offer sent to the user, awaiting acceptance
  | 'hold'        // User accepted; Steam hold window running (carries offerID + holdEndDate)
  | 'completed'   // Trade finished successfully
  | 'failed'      // Trade failed at some point
  | 'canceled'    // Trade was canceled before completion (no penalty)
  | 'declined'    // End user declined / let the Steam offer expire. Withdrawals: refund minus a 2% penalty
  | 'reverted';   // Previously completed trade was reversed (see revertedBy)
Both deposits and withdrawals emit active. pending is withdrawal-only (the supplier sourcing step). holdEndDate carries the exact hold expiry, which can be later for accounts without Steam mobile auth set up.

TradeType

type TradeType =
  | 'deposit'    // User selling items to merchant
  | 'withdraw';  // User buying items from market

TradeSource

Indicates whether the trade originated from an end-user client flow or a merchant self-trade flow. Present on every trade in responses and callbacks.
type TradeSource =
  | 'client'    // Initiated by an end-user via /client/trading/*
  | 'self';     // Merchant self-trade via /secure/sell or /secure/buy

DeliveryMode

Marketplace delivery type carried on Item.offer.delivery for listings.
type DeliveryMode =
  | 'standard'  // Trade-offer delivery (bot sources from a supplier and sends a Steam trade offer)
  | 'instant';  // Instant delivery (item already pre-positioned with the bot)

RevertedBy

type RevertedBy =
  | 'supplier'   // Marketplace supplier reversed (withdrawals only)
  | 'user';      // End user reversed

TradeFailureCode

Set on Item.error for failed withdraw items, and on the trade-level error only when an entire withdraw failed for one shared reason (mixed/partial failures leave Trade.error null — read the per-item codes). A small, stable set; canceled and declined items carry no code, since the status itself is the reason.
type TradeFailureCode =
  | 'LISTING_UNAVAILABLE'      // Listing sold / delisted / out of stock — retry another listing
  | 'PRICE_CHANGED'            // Price moved above your ceiling — re-quote
  | 'TRADE_URL_INVALID'        // Recipient's Steam trade URL is invalid or escrow-blocked
  | 'STEAM_ACCOUNT_RESTRICTED' // Recipient's Steam account can't receive (VAC / ban / hold / private)
  | 'MARKET_UNAVAILABLE'       // Temporary upstream or our-side issue — retry later
  | 'PURCHASE_FAILED';         // Unclassified failure (catch-all)

GameId

enum GameId {
  CS2  = 730,
  RUST = 252490,
}
The game query parameter accepts the numeric value as a string (e.g. "730").

Callback Payload

State-change callbacks deliver the trade object directly as the body:
interface CallbackBody {
  trade: Trade;
}
The signature lives in the X-AssetPay-Signature header (format t=<iso>,id=<delivery-id>,s=<hex>), HMAC-SHA256 over ${deliveryId}.${timestamp}.${rawBody}. See Callbacks for verification code and the withdrawal approval envelope.