# 闲鱼 Xianyu 卖家在售商品 API (xianyu.seller_items)

- Canonical page: [https://everyinfra.com/xianyu-api/seller_items](https://everyinfra.com/xianyu-api/seller_items?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "xianyu", "action": "seller_items", "params": {...}}
- Price: $0.001986 per call ($1.99 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 10, max 10 per call
- Pagination: pass next_page_token back as page_token for the next page, other params unchanged; one call per page, tokens last 24 hours; up to 1000 rows; beyond 200 rows use mode=async
- Mode: sync; add "mode": "async" for slow tasks

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=xianyu&action=seller_items

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| seller_id | not declared | yes | not declared | 闲鱼卖家：填卖家的纯数字 ID（item_detail 返回的 seller_id，search 的部分结果也带），或卖家主页链接 https://www.goofish.com/personal?userId=<数字>。返回这个卖家在售的商品，已卖出、已下架的不返回。别的写法（昵称、商品链接、App 分享短链）会被拒（422，不扣费）。 |
| page_token | not declared | no | not declared | 翻页令牌。第 1 页不用传；响应里有 next_page_token 时，把它原样作为 page_token 传回就拿下一页，seller_id 保持不变。令牌 24 小时内有效，只能用于同一个卖家、同一个账户；换了卖家会被拒（422，不扣费）。每页 10 条，每页算一次调用。最多翻到第 1,000 条（第 100 页）。前 20 页（前 200 条）用同步请求就能翻；第 21 页起要用异步：在同一个请求里加上 "mode": "async"，再轮询 GET /api/v1/jobs/{job_id}。同步请求翻到第 21 页会返回 422 async_required，不扣费。响应里没有 next_page_token（pagination.has_more 为 false）就不能再往下翻：pagination.stop_reason 为 end_of_list 表示卖家的在售商品到底了，为 depth_limit 表示这次只能翻到这里，后面可能还有商品。第 1 页每次都现取；第 2–20 页从第一次要第 2 页时保存下来的一份列表里按顺序切，第 21 页起从第一次要第 21 页时保存下来的另一份列表里切，同一份列表里各页不重复、不漏。卖家在这期间上新或下架时：第 1 页给过的商品，后面的页（不管切自哪一份列表）都不会再给一遍；第 20、21 页交界处是两份列表的接缝，第 2–20 页给过的商品可能在第 21 页起再出现少量，也可能漏掉少量，合并时按 item_id 去重。 |
| limit | integer (1–10) | no | 10 | 这次调用最多返回的条数，整数，1–10；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| item_id | 闲鱼商品数字 ID（字符串）；可直接放进 item_detail 的 urls。 |
| url | 该记录在原平台上的可访问链接。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| price | 价格数值，不含货币符号；币种见 currency。 |
| currency | 价格币种代码（如 CNY、USD）。price 存在但 currency 为 null 时不要假定币种。 |
| image_url | 图片链接。多图能力可能返回 image_urls 数组。 |
| images | 商品全部图片链接，页面有几张给几张，第一张通常是主图。 |
| want_count | 想要人数，即点过「我想要」的用户数。搜索结果取自商品卡片上的「N人想要」，卡片没显示时为 null；null 不等于 0。 |
| tags | 商品卡片上的全部标签，按页面原文返回，如「全新」「包邮」、品牌、降价提示，以及卖家信用、实名认证、多久前来过、来闲鱼几年这类卖家标签；想要人数单独放在 want_count。无标签时为空数组。 |
| category_id | 闲鱼类目 ID（字符串）。 |
| free_shipping | 是否包邮。 |
| is_auction | 是否为拍卖商品；拍卖商品的 price 是当前出价。 |
| has_video | 商品是否带视频。 |
| seller_id | 卖家数字 ID（字符串）。关键词搜索的多数结果不返回这一项。 |
| seller_url | 卖家在闲鱼的主页链接。 |
| seller_item_count | 卖家主页显示的在售商品数。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "xianyu",
  "action": "seller_items",
  "params": {
    "seller_id": "<SELLER_ID>"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "xianyu",
        "action": "seller_items",
        "params": {
            "seller_id": "<SELLER_ID>",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "xianyu",
  "action": "seller_items",
  "results": [
    {
      "item_id": …,
      "url": …,
      "title": …,
      "price": …,
      "currency": …,
      "image_url": …,
      "images": …,
      "want_count": …,
      "tags": …,
      "category_id": …,
      "free_shipping": …,
      "is_auction": …,
      "has_video": …,
      "seller_id": …,
      "seller_url": …,
      "seller_item_count": …,
      "platform": …
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=xianyu
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
