# How to get WeChat Search results by keyword

One endpoint does it: WeChat Search articles and videos. The worked example below is 2 calls and costs $0.0400 in all; a failed call is not charged.

You get what WeChat Search (搜一搜) shows for a keyword, page after page: Official Account articles and Channels videos mixed, each with its title or description, the account's name and the time it was posted; an article with its link, a video with its likes and saves.

## Step by step

### Step 1: WeChat Search articles and videos

Search by `query`. `type` says whether an item is an article or a video. `sort` orders by relevance, newest or hottest, and `published_within` keeps only recent ones. For the next page, send `page.next_cursor` as `cursor`, until `page.has_more` is false. ([WeChat Search articles and videos](https://dataxapi.com/apis/wechat/posts/search/), $0.0200 / a call)

cURL

```bash
curl -G "https://api.dataxapi.com/v1/wechat/posts/search" \
  --data-urlencode "query=咖啡店开业" \
  -H "Authorization: Bearer $DATAXAPI_API_KEY"
```

Python

```python
# pip install dataxapi
from dataxapi import DataXAPI

dx = DataXAPI()  # reads DATAXAPI_API_KEY
result = dx.wechat.posts.search(query="咖啡店开业")
print(result["data"]["items"])
```

TypeScript

```typescript
// npm i @dataxapi/sdk
import { DataXAPI } from "@dataxapi/sdk";

const dx = new DataXAPI(); // reads DATAXAPI_API_KEY
const result = await dx.wechat.posts.search({ query: "咖啡店开业" });
console.log(result.data.items);
```

CLI

```bash
dataxapi call wechat.posts.search 'query=咖啡店开业'
```

Recorded response: From a response recorded 2026-10-17 10:16 UTC. Names, text and IDs are examples, and so are the links: none is the recorded one (the page shows no one's personal data); the figures are as recorded. Long lists are cut. The request ID, cursor and balance are made up.

```jsonc
{
  "code": "ok",
  "request_id": "f99e115c-779f-40c2-8f31-aa264bce80dd",
  "data": {
    "items": [
      {
        "id": "1565947629032858",
        "url": null,
        "type": "video",
        "title": null,
        "text": "咖啡店开业｜第一次尝试就爱上了，清单放评论区",
        "published_at": "2026-10-15T06:55:50.000Z",
        "author": {
          "name": "橘子汽水不加冰",
          "avatar_url": "https://wx.qlogo.cn/mmhead/G9OFE9nvQizvdtoFhYPbPgJwNlPo1GOTzMZ7Yb1e/132"
        },
        "metrics": { "likes": 1, "favorites": 3 }
      },
      // … 19 more
    ]
  },
  "page": {
    "next_cursor": "c1.qgwIcUU3N03dRsj5WCHQWiriygBg_3bRP0gIll8U",
    "cursor_expires_at": "2026-10-17T11:16:20.000Z",
    "has_more": true,
    "returned": 20
  },
  "warnings": [],
  "meta": {
    "capability": "wechat.posts.search",
    "result_status": "complete",
    "fetched_at": "2026-10-17T10:16:20.000Z",
    "cached": false,
    "replayed": false,
    "unavailable": {
      "lang": "capability",
      "author.id": "capability",
      "author.username": "capability",
      "author.verified": "capability",
      "author.followers": "capability",
      "metrics.comments": "capability",
      "metrics.shares": "capability",
      "metrics.views": "capability",
      "metrics.reposts": "capability",
      "images": "capability",
      "hashtags": "capability",
      "mentions": "capability",
      "is_pinned": "capability",
      "post_id": "platform",
      "parent_id": "platform",
      "root_id": "platform"
    },
    "billing": {
      "amount": "0.02",
      "currency": "USD",
      "balance_after": "9.98"
    }
  }
}
```

## What the example costs

two pages of results for one keyword

| Endpoint | Calls | Price | Subtotal |
| --- | --- | --- | --- |
| [WeChat Search articles and videos](https://dataxapi.com/apis/wechat/posts/search/) | 2 | $0.0200 | $0.0400 |
| Total | 2 |  | $0.0400 |

Prices are the prices in force when this page was built. A failed call costs nothing.

## In your AI (MCP)

Connect DataXAPI to your AI client once. Then say what you want; the agent finds these endpoints, checks the price and calls them on your balance.

Say: Use DataXAPI to search WeChat for 咖啡店开业 (café opening), two pages, and list each result's type, account, title and date.

What the agent sends to the call tool: 

```json
{
  "capability": "wechat.posts.search",
  "query": "咖啡店开业",
  "idempotency_key": "<a new UUID>"
}
```

[About the MCP server](https://dataxapi.com/mcp/)

## Good to know

- WeChat Search gives no account ID, only the account's name. To read an account's other articles, open one article's link with the article endpoint: its `author.id` is the account's original ID.
- A search that finds nothing returns an empty result, and an empty result is charged.

## The whole script

The task above as one script that runs as it is: Python, the SDK, your key from DATAXAPI_API_KEY. It writes a CSV file and ends by printing what it called, fetched and was charged.

```python
# pip install dataxapi
# export DATAXAPI_API_KEY=dx_...   (your key)
import csv
from decimal import Decimal
from dataxapi import DataXAPI

dx = DataXAPI()
calls, fetched, charged = 0, 0, Decimal("0")

def run(capability, params):
    """One call; counts it and what it was charged."""
    global calls, charged
    result = dx.call(capability, params)
    calls += 1
    charged += Decimal(str(result["meta"]["billing"]["amount"]))
    return result

QUERY = "咖啡店开业"
PAGES = 2

# WeChat Search results, articles and Channels videos mixed: type says which.
rows, cursor = [], None
for _ in range(PAGES):
    page = run("wechat.posts.search", {"query": QUERY, **({"cursor": cursor} if cursor else {})})
    for item in page["data"]["items"]:
        rows.append([item.get("type"), item.get("published_at"), item["author"].get("name"), item.get("title"), item.get("url")])
    cursor = page["page"]["next_cursor"]
    if not page["page"]["has_more"]:
        break

fetched = len(rows)
with open("wechat-search.csv", "w", newline="", encoding="utf-8") as file:
    csv.writer(file).writerows([["type", "published_at", "account", "title", "url"], *rows])

print(f"calls: {calls}, items: {fetched}, charged: ${charged}")
```

Run for real on 2026-10-29: 2 calls, 40 rows written, $0.0400 charged. A failed call is not charged.

## Endpoints

- [WeChat Search articles and videos](https://dataxapi.com/apis/wechat/posts/search/)

## More about WeChat Search

- [WeChat Search API](https://dataxapi.com/apis/wechat/)
- [How to list a WeChat Official Account's past articles](https://dataxapi.com/guides/wechat-official-account-articles/)
- [How to get WeChat Official Account article reads and likes](https://dataxapi.com/guides/wechat-article-reads-and-likes/)
- [How to get WeChat Channels video comments](https://dataxapi.com/guides/wechat-channels-video-comments/)
- [How to list a WeChat Channels account's videos](https://dataxapi.com/guides/wechat-channels-user-videos/)
- [Is there an API for WeChat Official Account articles?](https://dataxapi.com/answers/is-there-an-api-for-wechat-official-account-articles/)
- [How do I get WeChat Channels data?](https://dataxapi.com/answers/how-to-get-wechat-channels-data/)
- [What is __biz in a WeChat article link?](https://dataxapi.com/answers/wechat-official-account-biz/)
- [What do mid, idx and sn mean in a WeChat article link?](https://dataxapi.com/answers/wechat-article-link-mid-idx-sn/)
- [What is a WeChat Official Account's original ID (gh_)?](https://dataxapi.com/answers/wechat-official-account-original-id/)
- [What is a WeChat Channels account ID (…@finder), and what is an export ID?](https://dataxapi.com/answers/wechat-channels-finder-id/)

---

Catalog revision 5c3194deef3264cc. [HTML version](https://dataxapi.com/guides/wechat-search-posts/)
