Zhihu API in Python: questions and answers (2026)

Yes: Zhihu's data platform has search and question answers, but search gives up to 10 results and answers come as summaries; for whole answers, comments and paged search, use a third-party data API. Below it is done with DataXAPI's Python SDK; the free trial covers up to 333 calls. 2 endpoints do it: Zhihu content search → Zhihu question answers. The worked example below is 6 calls and costs $0.0120 in all; a failed call is not charged.

Updated 2026-11-06Open in ChatGPTOpen in Claude

Search answers on a keyword, then the first 20 answers in full under the questions of the 5 most upvoted, into one CSV: question, author, upvotes, text.

Step 1: Zhihu content search

A page of answers and articles for the search terms; type keeps answers only and sort puts the most upvoted first. An answer's parent_id is its question's ID.

curl -G "https://api.dataxapi.com/v1/zhihu/posts/search" \
  --data-urlencode "query=咖啡机推荐" \
  -H "Authorization: Bearer $DATAXAPI_API_KEY"
# pip install dataxapi
from dataxapi import DataXAPI

dx = DataXAPI()  # reads DATAXAPI_API_KEY
result = dx.zhihu.posts.search(query="咖啡机推荐")
print(result["data"]["items"])
// npm i @dataxapi/sdk
import { DataXAPI } from "@dataxapi/sdk";

const dx = new DataXAPI(); // reads DATAXAPI_API_KEY
const result = await dx.zhihu.posts.search({ query: "咖啡机推荐" });
console.log(result.data.items);
dataxapi call zhihu.posts.search 'query=咖啡机推荐'
Recorded response
{
  "code": "ok",
  "request_id": "87ee6f95-7dde-47c6-8b04-4ec1594169d0",
  "data": {
    "items": [
      {
        "id": "3250756632",
        "url": "https://www.zhihu.com/answer/3250756632",
        "type": "article",
        "title": "咖啡机推荐入门指南:一篇讲清楚",
        "text": "咖啡机推荐这件事,越简单越好",
        "published_at": "2026-03-03T08:11:12.000Z",
        "author": {
          "id": "cbf102a15e966bc955fc8f2b452b62fa",
          "username": "laozhou_gear",
          "name": "老周说装备",
          "avatar_url": "https://picx.zhimg.com/v2-671ebb705befb9d2492d_l.jpg",
          "followers": 10699
        },
        "metrics": { "likes": 224, "comments": 3, "favorites": 0 },
        "post_id": null,
        "parent_id": null
      },
      // … 16 more
    ]
  },
  "page": {
    "next_cursor": "c1.Km3J8vP9d1xw85c8i-GQVxvJL7XKz0me6b3X34wR",
    "cursor_expires_at": "2026-10-12T20:18:45.000Z",
    "has_more": true,
    "returned": 17
  },
  "warnings": [],
  "meta": {
    "capability": "zhihu.posts.search",
    "result_status": "complete",
    "fetched_at": "2026-10-12T19:18:45.000Z",
    "cached": false,
    "replayed": false,
    "unavailable": {
      "lang": "capability",
      "author.verified": "capability",
      "metrics.shares": "platform",
      "metrics.views": "capability",
      "metrics.reposts": "platform",
      "images": "capability",
      "hashtags": "platform",
      "mentions": "capability",
      "is_pinned": "capability",
      "root_id": "platform"
    },
    "billing": {
      "amount": "0.002",
      "currency": "USD",
      "balance_after": "9.998"
    }
  }
}

From a response recorded 2026-10-12 19:18 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.

Zhihu content search · $0.0020 / a call · Parameters, fields and errors on the endpoint's page →

Step 2: Zhihu question answers

Put the question ID into id for its first 20 answers, with text, author, upvotes, comments and saves; one page only.

curl -G "https://api.dataxapi.com/v1/zhihu/questions/answers/list" \
  --data-urlencode "id=55043447" \
  -H "Authorization: Bearer $DATAXAPI_API_KEY"
# pip install dataxapi
from dataxapi import DataXAPI

dx = DataXAPI()  # reads DATAXAPI_API_KEY
result = dx.zhihu.questions.answers.list(id="55043447")
print(result["data"]["items"])
// npm i @dataxapi/sdk
import { DataXAPI } from "@dataxapi/sdk";

const dx = new DataXAPI(); // reads DATAXAPI_API_KEY
const result = await dx.zhihu.questions.answers.list({ id: "55043447" });
console.log(result.data.items);
dataxapi call zhihu.questions.answers.list id=55043447
Recorded response
{
  "code": "ok",
  "request_id": "c2cb7ef3-9556-40a0-972e-f9fbc9adc683",
  "data": {
    "items": [
      {
        "id": "3612004169",
        "url": "https://www.zhihu.com/answer/3612004169",
        "type": "text",
        "title": "周末露营入门指南:一篇讲清楚",
        "text": "周末露营|第一次尝试就爱上了,清单放评论区",
        "published_at": "2017-01-23T02:28:14.000Z",
        "author": {
          "id": "f0065006fdb4498cad8c271c2752c668",
          "username": "aya_living",
          "name": "认真生活的阿雅",
          "avatar_url": "https://picx.zhimg.com/v2-514ec9961cf32ad9a5ba_l.jpg",
          "followers": 3641
        },
        "metrics": { "likes": 228, "comments": 34, "favorites": 698 },
        "post_id": "3675879886",
        "parent_id": "3901580217"
      },
      // … 18 more
    ]
  },
  "page": {
    "next_cursor": null,
    "cursor_expires_at": null,
    "has_more": false,
    "returned": 19
  },
  "warnings": [
    { "code": "items_dropped", "count": 1 }
  ],
  "meta": {
    "capability": "zhihu.questions.answers.list",
    "result_status": "complete",
    "fetched_at": "2026-10-12T19:18:39.000Z",
    "cached": false,
    "replayed": false,
    "unavailable": {
      "lang": "capability",
      "author.verified": "capability",
      "metrics.shares": "platform",
      "metrics.views": "capability",
      "metrics.reposts": "platform",
      "images": "capability",
      "hashtags": "platform",
      "mentions": "capability",
      "is_pinned": "capability",
      "root_id": "platform"
    },
    "billing": {
      "amount": "0.002",
      "currency": "USD",
      "balance_after": "9.998"
    }
  }
}

From a response recorded 2026-10-12 19:18 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.

Zhihu question answers · $0.0020 / a call · Parameters, fields and errors on the endpoint's page →

What the example costs

One page of search results, then the answers to 5 questions

EndpointCallsPriceSubtotal
Zhihu content search1$0.0020$0.0020
Zhihu question answers5$0.0020$0.0100
Total6$0.0120

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: Search Zhihu for 咖啡机推荐 (coffee machine picks), find the questions of the 5 most upvoted answers, get the first 20 answers to each, and sum up which models people recommend.
What the agent sends to the call tool
{
  "capability": "zhihu.posts.search",
  "query": "咖啡机推荐",
  "idempotency_key": "<a new UUID>"
}

Sign in to copy the setup prompt with your keyAbout the MCP server →

Why DataXAPI

  • Steady: endpoints were available 100% of the last 30 days, on a public status page you can check.
  • Fast: a paid call took 1.7 seconds at the median over the last 7 days (counted 2026-11-06).
  • Fewer tokens: across 16 endpoints on Zhihu, one recorded real response each, the platform's own JSON comes to 712k tokens and what an AI reads through DataXAPI's MCP server to 63k, 91% fewer; the JSON of a direct API call is 73% fewer too (counted 2026-11-06). Every platform answers in one shape: the author in author, counts in metrics, the next page in page.next_cursor, so another platform needs no new parser.
  • See before you pay: every endpoint's page shows a recorded real response, field by field.
  • Spending you control: a failed call is not charged; each key can have a limit, X-Max-Price caps one call, and the same Idempotency-Key within 24 hours is never charged twice.
  • Ready for AI: a remote MCP server listed in the official MCP registry as com.dataxapi/mcp, usable from Claude, Cursor and ChatGPT.
  • Free trial of up to 333 calls, no card.

Good to know

  • Upvotes are in metrics.likes. No Zhihu account or cookie, and no x-zse-96 signature.
  • Comments under an answer come from zhihu.answers.comments.list, by the answer's ID.
  • Without code: connect DataXAPI to Claude or ChatGPT and say the sentence under “In your AI”.

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 = "咖啡机推荐"
QUESTIONS = 5

# 1. A page of answers for the search terms; parent_id is each answer's question.
answers = run("zhihu.posts.search", {"query": QUERY, "type": "answer"})["data"]["items"]
answers = sorted(answers, key=lambda each: -(each["metrics"].get("likes") or 0))
questions = list(dict.fromkeys(each["parent_id"] for each in answers if each.get("parent_id")))[:QUESTIONS]

# 2. The first 20 answers to each of those questions, in full.
rows = []
for question in questions:
    for answer in run("zhihu.questions.answers.list", {"id": question})["data"]["items"]:
        rows.append([answer.get("title"), answer["author"].get("name"), answer["metrics"].get("likes"), answer.get("text")])

fetched = len(rows)
with open("zhihu-answers.csv", "w", newline="", encoding="utf-8") as file:
    csv.writer(file).writerows([["question", "author", "upvotes", "text"], *rows])

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