> ## 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.

# GET /v1/listings/availability — 批量可用性查询

> 在单次请求中检查最多 100 个 CSBoard 商品是否仍可购买，返回每个 id 的可用数量以及不可用 id 列表。

在下批量订单之前，请确认您打算购买的商品仍然可用。通过逗号分隔的 `ids` 参数最多传入 100 个商品 id；响应将告诉您每个 id 当前可用的数量，以及哪些 id 已不再可用。

**需要身份验证。** 请将密钥作为 `Authorization: Bearer csb_pub_...` 发送。

## 查询参数

<ParamField query="ids" type="string" required>
  以逗号分隔的商品 id，例如 `itm_8841201,itm_8841340`。**必填。** 每次请求最多 100 个 id。
</ParamField>

## 响应字段

<ResponseField name="data" type="object" required>
  <Expandable title="data object">
    <ResponseField name="available" type="object" required>
      商品 id → 当前可用数量（整数）的映射。至少有一件可用的 id 会出现在这里。
    </ResponseField>

    <ResponseField name="unavailable_ids" type="string[]" required>
      已不再可用的商品 id。
    </ResponseField>
  </Expandable>
</ResponseField>

## 示例请求

```bash theme={null}
curl "https://csboard.com/v1/listings/availability?ids=itm_8841201,itm_8841340,itm_8841999" \
  -H "Authorization: Bearer csb_pub_..."
```

## 示例响应

```json theme={null}
{
  "data": {
    "available": {
      "itm_8841201": 1,
      "itm_8841340": 3
    },
    "unavailable_ids": ["itm_8841999"]
  }
}
```

## 错误代码

| HTTP 状态码 | 代码                                    | 含义                                |
| -------- | ------------------------------------- | --------------------------------- |
| 401      | `missing_api_key` / `invalid_api_key` | API 密钥缺失或无效。                      |
| 422      | `invalid_request`                     | 未提供 `ids`，或提供了超过 100 个 id。        |
| 429      | `rate_limit_exceeded`                 | 请求过多。请按照 `Retry-After` 响应头中的秒数退避。 |

<Tip>
  可用性是一个时间点快照。报告为可用的 id 仍可能在您的购买执行前售罄——请始终发送 `max_price_usd`，并在购买调用中处理 `item_unavailable`。
</Tip>


## OpenAPI

````yaml GET /listings/availability
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: Account
    description: Your balance, settled funds, and trading status.
paths:
  /listings/availability:
    get:
      tags:
        - Market data
      summary: Bulk availability check
      description: >-
        Check whether specific listings are still buyable, in one request. Pass
        up to 100 listing ids as a comma-separated `ids` query parameter.
        Returns how many of each id are available, plus the ids that are no
        longer available.
      operationId: getListingsAvailability
      parameters:
        - name: ids
          in: query
          required: true
          description: Comma-separated listing ids. Required. Maximum 100 ids per request.
          schema:
            type: string
      responses:
        '200':
          description: Availability map for the requested ids.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      available:
                        type: object
                        additionalProperties:
                          type: integer
                        description: Map of listing id → count currently available.
                      unavailable_ids:
                        type: array
                        items:
                          type: string
                        description: Ids that are no longer available.
                    required:
                      - available
                      - unavailable_ids
                required:
                  - data
              example:
                data:
                  available:
                    itm_8841201: 1
                    itm_8841340: 3
                  unavailable_ids:
                    - itm_8841999
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Invalid request — `ids` missing or more than 100 ids supplied.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: invalid_request
                detail: Provide between 1 and 100 ids in the ids parameter.
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: unauthorized
            message: Missing or invalid API key.
    RateLimited:
      description: Rate limit exceeded. Includes a Retry-After header.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: rate_limit_exceeded
            message: Too many requests.
  schemas:
    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).
      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
  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.

````