# Zhihu Article Search (`zhihu.search_articles`)

Search public Zhihu articles by keyword, sorted by relevance, upvotes or date, with author and engagement data.

Docs: https://primaryapi.com/docs/api-reference/zhihu/search_articles

- Endpoint: `POST https://api.primaryapi.com/v1/run/zhihu.search_articles`
- Category: Social · Platform: `zhihu` · Kind: search · Status: live
- Price: 2 credits per call; up to 72 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost.
- Billing unit: per successful call
- Reliability: routed to a healthy upstream and retried automatically when an attempt fails; live 30-day status: `GET https://api.primaryapi.com/v1/status/apis?sku=zhihu.search_articles`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `query` | string | yes |  | max 500 chars | Search keyword, e.g. "人工智能". |
| `limit` | integer \| string | no | 20 |  | Articles per page (1-20, default 20); a number or a numeric string. |
| `offset` | integer \| string | no | 0 |  | Result offset; pass the previous response's nextOffset (default 0). |
| `searchHashId` | string | no | "" | max 200 chars | searchHashId from the previous response, to keep paging consistent (default empty). |
| `showAllTopics` | integer | no | 0 | 0–1 | 1 to include all topics, 0 to exclude them (default 0). |
| `sort` | enum | no | "" | one of: , upvoted_count, created_time | Ordering: "" comprehensive (default), "upvoted_count" most upvoted, "created_time" newest. |
| `timeInterval` | enum | no | "" | one of: , a_day, a_week, a_month, three_months, half_a_year, a_year | Publication-time filter (default "" = any time). |
| `verticalInfo` | string | no | "0,0,0,0,0,0,0,0,0,2,0,0" | max 200 chars | Article-search continuation state; pass the previous response's nextVerticalInfo. |

Unknown fields are rejected with `400 invalid_input`. The routing controls `preferLatencyUnderMs` and `maxCredits` may be sent in the same JSON body.

## Output

When `output.found` is `true`, `output.data` has this shape:

| Field | Type | Description |
|---|---|---|
| `articles` | object[] |  |
| `articles[].id` | string |  |
| `articles[].title` | string \| null |  |
| `articles[].excerpt` | string \| null |  |
| `articles[].text` | string \| null | Article body as plain text when the source returns it |
| `articles[].createdUtc` | integer \| null | UTC epoch seconds |
| `articles[].updatedUtc` | integer \| null | UTC epoch seconds |
| `articles[].votes` | integer \| null |  |
| `articles[].comments` | integer \| null |  |
| `articles[].saves` | integer \| null |  |
| `articles[].authorName` | string \| null |  |
| `articles[].authorUserId` | string \| null |  |
| `articles[].authorToken` | string \| null | Author URL token (zhihu.com/people/<token>) |
| `articles[].authorHeadline` | string \| null |  |
| `articles[].authorImage` | string \| null |  |
| `articles[].authorUrl` | string \| null |  |
| `articles[].url` | string |  |
| `isEnd` | boolean \| null | true when Zhihu reports no further page; null when the source cannot tell |
| `nextOffset` | string \| null | Pass back as `offset` for the next page |
| `searchHashId` | string \| null | Pass back as `searchHashId` for the next page |
| `nextVerticalInfo` | string \| null | Pass back as `verticalInfo` for the next page |
| `nextCursor` | string \| null | Always null: page with offset / searchHashId / verticalInfo |

When the thing you asked about does not exist (or a search matches nothing) the call still succeeds: `output.found` is `false`, `output.data` is `null` and `output.reason` says why (`not_found`, `private`, `no_results`, …). Misses are free unless the notes below say misses are billed.

## Example request

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/zhihu.search_articles" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"人工智能"}'
```

## Example response

_Values are placeholders that follow the output schema; `credits` is what this call would cost at the usual price._

```json
{
  "output": {
    "found": true,
    "data": {
      "articles": [
        {
          "id": "string",
          "title": "string",
          "excerpt": "string",
          "text": "string",
          "createdUtc": 0,
          "updatedUtc": 0,
          "votes": 0,
          "comments": 0,
          "saves": 0,
          "authorName": "string",
          "authorUserId": "string",
          "authorToken": "string",
          "authorHeadline": "string",
          "authorImage": "string",
          "authorUrl": "https://example.com",
          "url": "https://example.com"
        }
      ],
      "isEnd": true,
      "nextOffset": "string",
      "searchHashId": "string",
      "nextVerticalInfo": "string",
      "nextCursor": null
    }
  },
  "provider": "PrimaryAPI",
  "credits": 2,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z",
  "nextCursor": null
}
```

## Pricing and reliability

- Usual price: 2 credits per call
- Price ceiling: up to 72 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost; the `maxCredits` routing control caps it per call
- Live 30-day status, success rate, uptime and latency: `GET https://api.primaryapi.com/v1/status/apis?sku=zhihu.search_articles`

## Errors to handle

`invalid_input`, `unauthorized`, `insufficient_balance`, `key_limit_reached`, `trial_cap_reached`, `forbidden`, `not_found`, `idempotency_conflict`, `rate_limited`, `all_sources_failed`, `service_unavailable`, `timeout`. See https://primaryapi.com/docs/errors.

