# Migrating from the v1 API

The legacy API (`/ICart/…`, `/ISales/…`, `/IBalance/…`) is replaced by this one.
This page maps what you call today onto what you should call now.

Nothing here is a like-for-like rename: the new API is REST-shaped, integer-only
and stateless where the old one was RPC-shaped, float-based and cart-stateful.
Read the three breaking changes first. They affect every request you make.

## Three things that change everywhere [#three-things-that-change-everywhere]

### 1. Authentication [#1-authentication]

v1 used HTTP Basic with the key as the username and an empty password:

```
Authorization: Basic base64(API_KEY:)
```

Now it is a bearer token:

```
Authorization: Bearer csd_your_key_here
```

Your v1 key does not carry over. Generate a new one from **Settings → API**.

### 2. Money is integer cents, everywhere [#2-money-is-integer-cents-everywhere]

v1 sent money as floats and made you declare a currency per field:
`data_currency_iso`, `payment_currency_iso`, `total_currency_iso`.

This API has one representation: **integers in cents**. `42.50` becomes `4250`.
There is no currency parameter to pass, anywhere. If you keep one float in your
port, you will eventually place an order off by a factor of 100. Strip them at
the boundary.

### 3. Buying no longer uses a cart [#3-buying-no-longer-uses-a-cart]

v1's cart flow (`CreateCart` → `AddItems` → `PurchaseWithWallet`) is gone.
v1 also allowed passing `items` straight to `PurchaseWithWallet`, and that is
the shape we kept:

```json
POST /public/v1/purchase
{ "items": [{ "listing_id": 12345, "amount": 1, "max_price": 4250 }] }
```

`max_price` behaves like v1's per-item `price`: a ceiling, not an exact match,
settable high to disable the check. The order is atomic: every line fills or
none do.

The website's cart endpoints still exist but are not part of this API. They
share state with the account's browser session. Don't automate against them.

## Endpoint mapping [#endpoint-mapping]

### Buying [#buying]

| v1                                           | Now                                                                                                       |
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| `POST /ICart/CreateCart/v1`                  | *(gone, no cart to create)*                                                                               |
| `POST /ICart/AddItems/v1`                    | *(gone, pass items to purchase)*                                                                          |
| `POST /ICart/GetCart/v1`                     | *(gone)*                                                                                                  |
| `POST /ICart/ClearCart/v1`                   | *(gone)*                                                                                                  |
| `POST /IAdyenOrder/PurchaseWithWallet/v1`    | [`POST /public/v1/purchase`](/docs/reference/trading/purchase)                                            |
| `POST /IAdyenOrder/PurchaseWithCryptoUSD/v1` | [`POST /public/v1/purchase`](/docs/reference/trading/purchase) (one balance now, no per-currency wallets) |

### Market data [#market-data]

| v1                                  | Now                                                                                                                                                 |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `POST /IPricing/GetLowestPrices/v1` | [`GET /public/v1/prices/all`](/docs/reference/market-data/prices-all) (the `lowest_listing_price` field; one cached blob, as before)                |
| `POST /IPricing/GetSalesHistory/v1` | [`GET /public/v1/sales`](/docs/reference/market-data/sales) (recent sales, filterable by item)                                                      |
| `POST /IPricing/GetSalesHistory/v1` | [`GET /public/v1/sales/averages`](/docs/reference/market-data/sales-averages) (30-day average price per item, if you were averaging sales yourself) |
| *(none)*                            | [`GET /public/v1/listings`](/docs/reference/market-data/listings) (individual live listings)                                                        |
| *(none)*                            | [`GET /public/v1/book`](/docs/reference/market-data/book) (full book snapshot with sequence number)                                                 |
| *(none)*                            | WebSocket feed (push instead of polling), see [Overview](/docs/reference/market-data/overview)                                                      |

### Inventory and withdrawing [#inventory-and-withdrawing]

| v1                                      | Now                                                                                                                              |
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `GET /IInventory/GetOnSiteInventory/v1` | [`GET /public/v1/backpack`](/docs/reference/trading/backpack)                                                                    |
| `POST /IInventory/WithdrawSteam/v1`     | [`POST /public/v1/withdraw`](/docs/reference/trading/withdraw) (same `{ id, amount }` item shape)                                |
| `POST /IInventory/DepositSteam/v1`      | [`POST /public/v1/sell`](/docs/reference/selling/sell) covers deposit-and-list; depositing without listing is still website-only |
| `GET /ITrades/GetActiveTrades/v1`       | [`GET /public/v1/trades`](/docs/reference/trading/trades) (filter by `status`)                                                   |
| `GET /ITrades/GetTradeHistory/v1`       | [`GET /public/v1/trades`](/docs/reference/trading/trades) (omit the `status` filter)                                             |
| `POST /ITrades/AcceptCancelTrade/v1`    | *(no equivalent, accept offers in Steam)*                                                                                        |
| `POST /IUser/SetSteamTradeToken/v1`     | *(website only, Settings)*                                                                                                       |

### Account [#account]

| v1                                    | Now                                                                                                            |
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `GET /IBalance/GetBalance/v1`, `/v2`  | [`GET /public/v1/user`](/docs/reference/account/user) (one balance, in cents)                                  |
| `POST /IBalance/GetTransactions/v1`   | [`GET /public/v1/transactions`](/docs/reference/account/transactions) (signed cents, with the running balance) |
| `POST /ISales/GetSoldItems/v1`, `/v2` | [`GET /public/v1/orders`](/docs/reference/account/orders) (rows with `side: "sold"`)                           |

### Selling [#selling]

| v1                                                 | Now                                                                                                                                                                       |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `POST /ISales/ListItems/v1`, `/v2` (Steam items)   | [`POST /public/v1/sell`](/docs/reference/selling/sell) (tokens from [`GET /public/v1/steam-inventory`](/docs/reference/selling/steam-inventory); we send the trade offer) |
| `POST /ISales/ListItems/v1`, `/v2` (on-site items) | [`POST /public/v1/list`](/docs/reference/selling/list) (backpack item ids, price in cents)                                                                                |
| `POST /ISales/EditItems/v2`, `/v3`                 | [`PATCH /public/v1/list`](/docs/reference/selling/edit-listing) (one listing per call)                                                                                    |
| `POST /ISales/GetActiveListings/v2`, `/v3`         | [`GET /public/v1/my-listings`](/docs/reference/selling/my-listings) (filter by `status`)                                                                                  |
| `POST /ISales/ReturnItems/v1`                      | [`POST /public/v1/delist`](/docs/reference/selling/delist)                                                                                                                |
| `GET /ISales/GetActiveListingsValue/v1`            | [`GET /public/v1/my-listings/value`](/docs/reference/selling/my-listings-value)                                                                                           |

### Cashout, exports, screenshots [#cashout-exports-screenshots]

| v1                                            | Now                                                                                                             |
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `POST /ICashout/RequestBitcoin/v1`, `/v2`     | *(website only)*                                                                                                |
| `GET /ICashout/GetBitcoinCashoutAddresses/v1` | *(website only)*                                                                                                |
| `POST /IExport/CreateExport/v1`               | [`GET /public/v1/orders/export`](/docs/reference/account/orders-export) (CSV or JSON, streamed, no job to poll) |
| `POST /IScreenshots/QueueScreenshots/v1`      | *(no equivalent yet)*                                                                                           |
| `POST /IPricing/GetSalesHistory/v1`           | [`GET /public/v1/sales`](/docs/reference/market-data/sales)                                                     |

## Gaps, stated plainly [#gaps-stated-plainly]

Cashouts and screenshots have no equivalent here yet, and depositing items
without listing them is still website-only.
v1 is switched off, so there is nothing to fall back to: until these land, do
them from the website. Everything else your bot does, selling included, can
move now.

One difference worth knowing when you port your selling code: a listing is
created with backpack item ids from `GET /public/v1/backpack` rather than
Steam asset ids. Prices are in cents, flat as `price` or auto-decaying as
`price_decay`.

Tell us which gap blocks you; that's what drives the order we close them in.

## Suggested migration order [#suggested-migration-order]

1. **Swap authentication** and re-point your base URL. Everything else fails
   loudly until this is right.
2. **Strip currency handling**: delete the `*_currency_iso` parameters and
   convert your money handling to integer cents at the API boundary.
3. **Replace the cart flow** with a single `POST /public/v1/purchase`. Your
   per-item price ceiling carries over unchanged.
4. **Re-point inventory, selling and withdrawal** calls. Item ids are ours, not
   Steam's, and come from `GET /public/v1/backpack`.
5. **Replace price polling** with the WebSocket feed once the rest is stable.
