> ## Documentation Index
> Fetch the complete documentation index at: https://api.csboard.com/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /v1/market/buy — покупка и доставка на Steam trade URL

> Покупайте до 100 предметов и доставляйте их прямо на любой указанный вами Steam trade URL, оплачивая из подтверждённого баланса. Создано для оптовых покупок и автоматической доставки.

Этот эндпоинт позволяет покупать и доставлять предметы напрямую на **любой** указанный вами Steam trade URL — не только на trade URL, привязанный к вашему аккаунту. Trade URL формируется из полей `partner` и `token`. Покупки финансируются **только** из вашего **подтверждённого** (защищённого от реверса) баланса, что делает эндпоинт пригодным для оптовых объёмов и потоков автоматической доставки.

Сохраните один `custom_id` для каждой выдачи. Успешный ответ хранится в кэше до 24 часов и при повторе содержит заголовок `Idempotent-Replayed: true`. Если ответ потерян, [проверьте заказ](https://api.csboard.com/ru/api-reference/get-orders-info.md) по сохранённому идентификатору. Пустой результат возможен до появления заказа. Оставьте выдачу в ожидании до сверки.

> [!WARNING]
>
> Этот эндпоинт работает за kill-switch и требует аккаунта, для которого включена торговля и нет истории реверсов. Когда kill-switch выключен, возвращается `403 external_buy_disabled`.

**Требуется аутентификация.** Отправьте ключ как `Authorization: Bearer csb_pub_...`.

**Требуется возможность торговли.** Для ключа должны быть включены покупки, а аккаунт должен быть чистым от реверсов.

## Тело запроса

**item\_ids** `string[]` *required*

От 1 до 100 уникальных id листингов для покупки.

**partner** `string` *required*

Значение `partner` из Steam trade URL (1–32 символа). Вместе с `token` образует конечный trade URL, на который доставляются предметы.

**token** `string` *required*

Значение `token` из Steam trade URL (1–32 символа). Вместе с `partner` образует конечный trade URL.

**max\_price\_usd** `number`

Верхняя граница итоговой цены в USD. Если живой итог превышает её, заказ отклоняется с ошибкой `price_moved` и ничего не списывается. Настоятельно рекомендуется.

**custom\_id** `string`

Идентификатор выдачи (1–128 символов). После истечения срока кэша запрос с тем же идентификатором может запустить новую покупку.

**skip\_unavailable** `boolean` (default: false)

Если `true`, пропускать предметы, которые больше недоступны, вместо того чтобы отклонить весь запрос.

**appId** `integer` (default: 730)

Игра, к которой относятся `item_ids`: `730` CS2 (по умолчанию), `570` Dota 2, `252490` Rust. Передавайте тот же `appId`, с которым читали id из [`GET /v1/listings`](https://api.csboard.com/ru/api-reference/get-listings). В заказе Dota 2 и Rust до 10 id; такие заказы ставятся в очередь, поэтому каждый скин сначала отвечает `pending`.

## Поля ответа

**data** `object` *required*

**data object**

**purchase\_id** `string` *required*

**steam\_id** `string` *required*

Steam ID, определённый по переданным `partner` + `token`.

**created\_at** `datetime` *required*

**custom\_id** `string | null`

**skins** `object[]` *required*

Результат по каждому предмету.

**skin object**

**name** `string | null`

**price** `number | null`

**status** `string`

**return\_reason** `string | null`

**steam\_trade\_offer\_id** `string | null`

## Пример запроса

```bash theme={null}
curl -X POST https://csboard.com/v1/market/buy \
  -H "Authorization: Bearer csb_pub_..." \
  -H "Content-Type: application/json" \
  -d '{
    "item_ids": ["itm_8841201", "itm_8841340"],
    "partner": "447383001",
    "token": "Ab3xZ9Qp",
    "max_price_usd": 30.00,
    "custom_id": "batch-2026-06-29-01",
    "skip_unavailable": false
  }'
```

## Пример ответа

```json theme={null}
{
  "data": {
    "purchase_id": "pur_01J9Z3K8Q2",
    "steam_id": "76561198000000000",
    "created_at": "2026-06-29T17:12:04Z",
    "custom_id": "batch-2026-06-29-01",
    "skins": [
      {
        "name": "AK-47 | Redline (Minimal Wear)",
        "price": 14.37,
        "status": "delivering",
        "return_reason": null,
        "steam_trade_offer_id": "5512345678"
      }
    ]
  }
}
```

## Коды ошибок

| HTTP-статус | Код | Значение |
| - | - | - |
| 400 | `invalid_request` | Некорректное тело (например, `item_ids` пуст или содержит более 100 элементов). |
| 400 | `unsupported_item` | Один или несколько предметов нельзя доставить через этот эндпоинт (например, id `ss_live_*`). |
| 400 | `invalid_trade_url` | `partner` + `token` не образуют валидный Steam trade URL. |
| 400 | `unsupported_game` | `appId` недоступен вашему ключу. Содержит `supported_app_ids`. |
| 400 | `too_many_items` | Больше 10 id Dota 2 или Rust в одном заказе. Содержит `max_items`. |
| 401 | `invalid_api_key` | Отсутствует или некорректный API-ключ. |
| 402 | `insufficient_settled_balance` | Подтверждённый баланс ниже суммы заказа. Включает `required_usd` и `settled_usd`. |
| 402 | `insufficient_balance` | Баланс ниже суммы заказа. |
| 403 | `external_buy_disabled` | Kill-switch выключен; эндпоинт сейчас недоступен. |
| 403 | `trading_not_enabled` | Покупки не включены для этого ключа. |
| 403 | `account_restricted` | Эндпоинт требует аккаунт без истории реверсов. |
| 409 | `item_unavailable` | Один или несколько предметов больше недоступны. Включает `unavailable_ids[]`, а для CS2 может включать и `unknown_ids[]`. См. [«Недоступные предметы»](#unavailable-items) ниже. |
| 409 | `price_moved` | Живой итог превысил верхнюю границу. Включает `quoted_max_usd`, `current_total_usd` и `items[]`. |
| 409 | `idempotency_in_progress` | Запрос с этим `custom_id` ещё обрабатывается. |
| 409 | `price_updating` | Цены обновляются; повторите через короткое время. |
| 429 | `rate_limit_exceeded` | Более 250 заказов на покупку в минуту (`bucket: "buy_orders"`) или превышен торговый лимит ключа (`bucket: "trading"`). Подождите время, указанное в заголовке `Retry-After`. |
| 500 | `order_failed` | Проверьте, появился ли исходный заказ, прежде чем снова отправлять покупку. |
| 504 | `upstream_timeout` | Площадка не ответила вовремя. Оставьте выдачу в ожидании и проверьте заказ по сохранённому идентификатору. [Пример запроса на Node.js, на английском](https://csboard.com/cs2-skins-api/for/case-opening/#reconciliation). |

> [!NOTE]
>
> Средства берутся исключительно из вашего **подтверждённого** баланса. Перед большой партией проверяйте `settled_balance_usd` через [`GET /v1/balance`](https://api.csboard.com/api-reference/get-balance) и всегда передавайте `max_price_usd` в качестве защиты от переплаты.

## Недоступные предметы

Листинг может уйти из каталога между вашим чтением и покупкой. В теле `409 item_unavailable` все пропавшие id перечислены в `unavailable_ids`. При покупке CS2 (без `appId` или с `730`) там может быть и `unknown_ids` — те из пропавших id, о которых у нас нет никакой записи. Либо это не id листинга CSBoard, либо листинг ушёл из каталога больше часа назад. Чаще всего вместо id листинга присылают asset id из Steam. У листингов CSBoard id никогда не состоит из одних цифр, поэтому отправляйте `id` строки из `/v1/listings` или стрима.

```json theme={null}
{
  "code": "item_unavailable",
  "detail": "One or more items are no longer available. 1 of the ids are not known here (`unknown_ids`): not a listing id, or a listing gone for over an hour. Steam asset ids are not listing ids: send the `id` of a row from /v1/listings or the stream.",
  "unavailable_ids": ["31846262931"],
  "unknown_ids": ["31846262931"]
}
```

Чтобы убирать проданные листинги до попытки покупки, подпишитесь на события `gone` в [`GET /v1/listings/stream`](https://api.csboard.com/ru/api-reference/get-listings-stream).


## OpenAPI

````yaml POST /market/buy
openapi: 3.1.0
info:
  title: CSBoard API
  version: 1.0.0
  description: >-
    Market data over the CSBoard marketplace — live listings, floats, stickers,
    minAsk prices, FX rates — plus opt-in buying straight from your balance.
    Free to read, key-gated, built for automation.
  contact:
    name: CSBoard
    url: https://csboard.com/docs
servers:
  - url: https://csboard.com/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Status
    description: Liveness and freshness probes.
  - name: Market data
    description: Read the live catalog, prices, and FX rates.
  - name: Trading
    description: Buy listings from your CSBoard balance. Opt-in, key-gated.
  - name: Instant Sell
    description: >-
      Sell CS2, Dota 2 and Rust items from any Steam inventory to the CSBoard
      network and get paid to your balance. Invite-only.
  - name: P2P
    description: >-
      List your own CS2 skins on the CSBoard P2P market. Free — any valid key,
      no balance requirement.
  - name: Account
    description: Your balance, settled funds, and trading status.
  - name: Webhooks
    description: Register an endpoint and receive signed order updates instead of polling.
paths:
  /market/buy:
    post:
      tags:
        - Trading
      summary: Buy and deliver to a Steam trade URL
      description: >-
        Buy up to 100 items and deliver them straight to any Steam trade URL you
        supply (built from `partner` + `token`), paid from your **settled**
        (reversal-safe) balance. Built for wholesale and automated delivery.
        Idempotent via the `custom_id` body field — while the successful
        response is cached (up to 24 hours), the same `custom_id` returns that
        response and the response carries the `Idempotent-Replayed: true`
        header. This endpoint ships behind a kill-switch and requires a
        trading-enabled, reversal-clean account. Pass `appId` (`570` Dota 2,
        `252490` Rust) to buy those games; leave it out for CS2. Dota 2 and Rust
        orders are queued, so every skin answers `pending` first.
      operationId: marketBuy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExternalBuyRequest'
            example:
              item_ids:
                - itm_8841201
                - itm_8841340
              partner: '447383001'
              token: Ab3xZ9Qp
              max_price_usd: 30
              custom_id: batch-2026-06-29-01
              skip_unavailable: false
      responses:
        '201':
          description: Purchase accepted and debited from settled balance.
          headers:
            Idempotent-Replayed:
              description: >-
                Present and `true` when this response replays an earlier
                purchase made with the same `custom_id`.
              schema:
                type: boolean
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalBuyResult'
              example:
                data:
                  purchase_id: pur_01J9Z3K8Q2
                  steam_id: '76561198000000000'
                  created_at: '2026-06-29T17:12:04Z'
                  custom_id: batch-2026-06-29-01
                  skins:
                    - name: AK-47 | Redline (Minimal Wear)
                      price: 14.37
                      status: delivering
                      return_reason: null
                      steam_trade_offer_id: '5512345678'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                invalid_request:
                  summary: Malformed body
                  value:
                    code: invalid_request
                    detail: item_ids must contain 1–100 unique ids.
                unsupported_item:
                  summary: Item cannot be delivered this way
                  value:
                    code: unsupported_item
                    detail: One or more items cannot be delivered via this endpoint.
                invalid_trade_url:
                  summary: Bad partner/token
                  value:
                    code: invalid_trade_url
                    detail: partner and token do not form a valid Steam trade URL.
                unsupported_game:
                  summary: Game not available to this key
                  value:
                    code: unsupported_game
                    detail: >-
                      appId 570 is not available to this key. Supported: CS2
                      (730).
                    supported_app_ids:
                      - 730
                too_many_items:
                  summary: Over 10 Dota 2 / Rust ids
                  value:
                    code: too_many_items
                    detail: Up to 10 Rust items per order.
                    max_items: 10
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: invalid_api_key
                detail: Missing or invalid API key.
        '402':
          description: Not enough funds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                insufficient_settled_balance:
                  summary: Funds are inside the reversal window
                  value:
                    code: insufficient_settled_balance
                    detail: >-
                      External delivery is payable only from settled
                      (reversal-safe) balance. Wait for in-window credit to
                      settle or top up.
                    required_usd: 26.47
                    balance_usd: 30
                    settled_usd: 10
                insufficient_balance:
                  summary: Balance too low — top up
                  value:
                    code: insufficient_balance
                    detail: Balance is lower than the order total. Top up and retry.
                    required_usd: 26.47
                    balance_usd: 4.75
                    settled_usd: 4.75
        '403':
          description: Not permitted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                external_buy_disabled:
                  summary: Kill-switch off
                  value:
                    code: external_buy_disabled
                    detail: This endpoint is currently disabled.
                trading_not_enabled:
                  summary: Buying off for key
                  value:
                    code: trading_not_enabled
                    detail: Enable buying for this key in your profile.
                account_restricted:
                  summary: Account not eligible
                  value:
                    code: account_restricted
                    detail: This endpoint requires a reversal-clean account.
        '409':
          description: >-
            Conflict — an item is gone, the live price moved past your ceiling,
            a request with the same `custom_id` is still running, or prices are
            mid-refresh. An in-progress conflict leaves the original request
            unresolved. `item_unavailable` lists every missing id in
            `unavailable_ids`; on a CS2 buy, `unknown_ids` names the ones we
            have no record of at all — not a CSBoard listing id (a Steam asset
            id is the usual mix-up; listing ids are never all digits) or a
            listing that left the catalogue more than an hour ago. Follow the
            stream's `gone` events to drop listings before you buy them.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                item_unavailable:
                  summary: Item sold out
                  value:
                    code: item_unavailable
                    detail: One or more items are no longer available.
                    unavailable_ids:
                      - itm_8841999
                item_unknown:
                  summary: Id not known here (e.g. a Steam asset id)
                  value:
                    code: item_unavailable
                    detail: >-
                      One or more items are no longer available. 1 of the ids
                      are not known here (`unknown_ids`): not a listing id, or a
                      listing gone for over an hour. Steam asset ids are not
                      listing ids: send the `id` of a row from /v1/listings or
                      the stream.
                    unavailable_ids:
                      - '31846262931'
                    unknown_ids:
                      - '31846262931'
                price_moved:
                  summary: Live price exceeded ceiling
                  value:
                    code: price_moved
                    detail: Live total exceeds max_price_usd.
                    quoted_max_usd: 30
                    current_total_usd: 31.2
                    items:
                      - id: itm_8841201
                        market_hash_name: AK-47 | Redline (Minimal Wear)
                        price_usd: 15.1
                idempotency_in_progress:
                  summary: Earlier request still running
                  value:
                    code: idempotency_in_progress
                    detail: A request with this custom_id is still being processed.
                price_updating:
                  summary: Prices refreshing
                  value:
                    code: price_updating
                    detail: Prices are updating; retry shortly.
                concurrent_update:
                  summary: Lost a concurrent-update race
                  value:
                    code: concurrent_update
                    detail: >-
                      Another order touched the same items at the same moment
                      and this one was rolled back. Nothing was charged — retry.
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The purchase could not be completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: order_failed
                detail: The purchase could not be completed.
        '504':
          description: >-
            The purchase outcome is unknown. Keep the original order pending and
            reconcile through GET /v1/orders/info using the saved identifier. An
            empty lookup can precede order creation. Do not automatically repeat
            an unresolved purchase, even with the same identifier.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: upstream_timeout
                detail: >-
                  The marketplace did not answer in time, so the outcome of this
                  purchase is UNKNOWN — it may still have gone through. Do not
                  re-send blindly: poll the order list (or re-send the identical
                  custom_id, which replays rather than buys) before treating it
                  as failed.
components:
  schemas:
    ExternalBuyRequest:
      type: object
      properties:
        item_ids:
          type: array
          items:
            type: string
          minItems: 1
          maxItems: 100
          uniqueItems: true
          description: 1–100 unique listing ids to buy.
        partner:
          type: string
          minLength: 1
          maxLength: 32
          description: >-
            Steam trade URL `partner` value. With `token`, forms the destination
            trade URL.
        token:
          type: string
          minLength: 1
          maxLength: 32
          description: >-
            Steam trade URL `token` value. With `partner`, forms the destination
            trade URL.
        max_price_usd:
          type: number
          description: >-
            Total ceiling in USD. Order is rejected with `price_moved` if the
            live total exceeds it.
        custom_id:
          type: string
          minLength: 1
          maxLength: 128
          description: >-
            Save one key per withdrawal. A cached success can be replayed for up
            to 24 hours. After expiry the same value may start a new purchase.
        skip_unavailable:
          type: boolean
          default: false
          description: >-
            If true, skip items that are no longer available instead of failing
            the whole request.
        autoclaim:
          type: boolean
          description: >-
            Sticky per-account setting (not per-order). Send `true` once to
            switch your key into auto-claim mode: every held order is then
            auto-released the moment its hold clears (your bot must auto-accept
            the Steam trade offer within ~15 minutes). Send `false` to switch
            back to manual claiming via `POST /orders/{id}/claim`. Omit to leave
            the setting unchanged.
        appId:
          type: integer
          enum:
            - 730
            - 570
            - 252490
          default: 730
          description: >-
            Game the `item_ids` belong to: `730` = CS2 (the default), `570` =
            Dota 2, `252490` = Rust. Send the same `appId` you read the ids with
            from `GET /listings`. Dota 2 and Rust take up to 10 ids per order. A
            game this key may not buy in answers `400 unsupported_game` —
            `tradable` in `GET /games` tells you in advance.
      required:
        - item_ids
        - partner
        - token
    ExternalBuyResult:
      type: object
      properties:
        data:
          type: object
          properties:
            purchase_id:
              type: string
            steam_id:
              type: string
            created_at:
              type: string
              format: date-time
            custom_id:
              type:
                - string
                - 'null'
            skins:
              type: array
              items:
                type: object
                properties:
                  name:
                    type:
                      - string
                      - 'null'
                  price:
                    type:
                      - number
                      - 'null'
                  status:
                    type: string
                  return_reason:
                    type:
                      - string
                      - 'null'
                  steam_trade_offer_id:
                    type:
                      - string
                      - 'null'
          required:
            - purchase_id
            - steam_id
            - created_at
            - skins
      required:
        - data
    Error:
      type: object
      description: >-
        All errors return { code, detail }. Some carry extra fields (e.g.
        price_moved adds current_total_usd, insufficient_balance adds
        required_usd/current_usd, item_unavailable adds unavailable_ids and, on
        CS2 buys, unknown_ids).
      properties:
        code:
          type: string
          description: >-
            Machine-readable error code, e.g. rate_limit_exceeded,
            trading_not_enabled, price_moved.
        detail:
          type: string
          description: Human-readable explanation.
      required:
        - code
    RateLimitError:
      type: object
      description: >-
        The `429` body of a per-key bucket. Endpoint-specific limits send only
        `code` and `detail`.
      properties:
        code:
          type: string
          description: >-
            `rate_limit_exceeded` for the key's buckets. Endpoint-specific
            limits use their own code (`snapshot_rate_limited`, `rate_limited`).
        detail:
          type: string
          description: Human-readable explanation.
        bucket:
          type: string
          enum:
            - read
            - trading
            - buy_orders
          description: Which bucket is spent.
        limit_per_min:
          type: integer
          description: That bucket's ceiling per minute.
        retry_after_sec:
          type: integer
          minimum: 1
          maximum: 60
          description: >-
            Seconds until the window restarts — the same number as
            `Retry-After`.
      required:
        - code
  responses:
    RateLimited:
      description: >-
        A per-key limit is spent. The key's own buckets answer
        `rate_limit_exceeded` with `bucket` (`read`, `trading` or `buy_orders`),
        `limit_per_min` and `retry_after_sec`. `Retry-After` is the seconds left
        until the one-minute window restarts (1–60), not a flat 60.
        Endpoint-specific limits (`snapshot_rate_limited` on the price snapshot,
        `rate_limited` on Instant Sell) send only `code` and `detail`.
      headers:
        Retry-After:
          description: >-
            Seconds until the one-minute window restarts (1–60). Waiting that
            long is always enough.
          schema:
            type: integer
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-RateLimit-Bucket:
          $ref: '#/components/headers/X-RateLimit-Bucket'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitError'
          example:
            code: rate_limit_exceeded
            detail: >-
              Read rate limit of 100 requests/min exceeded. The counter restarts
              in 23 s. For new listings use GET /v1/listings/stream instead of
              polling.
            bucket: read
            limit_per_min: 100
            retry_after_sec: 23
  headers:
    X-RateLimit-Limit:
      description: >-
        The ceiling per minute of the bucket this call spent (named in
        `X-RateLimit-Bucket`).
      schema:
        type: integer
      example: 3000
    X-RateLimit-Remaining:
      description: Calls left on that bucket in the current one-minute window.
      schema:
        type: integer
        minimum: 0
      example: 2987
    X-RateLimit-Reset:
      description: >-
        Seconds until the one-minute window restarts and the counter starts
        again.
      schema:
        type: integer
        minimum: 1
        maximum: 60
      example: 41
    X-RateLimit-Bucket:
      description: >-
        The bucket this call spent: `read` (reads and every other keyed call) or
        `trading` (buys, order reads, claims, cancels, balance). A `429` from
        the buy-order limit says `buy_orders`.
      schema:
        type: string
        enum:
          - read
          - trading
          - buy_orders
      example: trading
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send your key as a Bearer token on every request: `Authorization: Bearer
        csb_pub_...`. Generate keys in your CSBoard profile. Calls made with a
        key are metered only by that key's own limits — there is no per-IP limit
        on top — and every answer carries `X-RateLimit-Limit`,
        `X-RateLimit-Remaining`, `X-RateLimit-Reset` and `X-RateLimit-Bucket`
        for the bucket the call spent. See [Rate limits](/rate-limits).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.