Zhihu APIs - Search (V1)
Search for Zhihu content (including questions, answers, and articles) by keyword.
Typical use cases:
- Topic discovery and competitive brand monitoring.
- Identifying trending discussions and high-value creators.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
token | query | string | Yes | TOKEN |
keyword | query | string | Yes | Search keywords. |
offset | query | integer | No | Start offset, begins with 0. |
Code Samples
💡 Environment Note
Default samples use https://api.justoneapi.com (prod-global). For users in Mainland China, it is recommended to replace it with http://47.117.133.51:30015 (prod-cn) for better performance. See Environment Guide.
bash
# Tip: For Mainland China, replace https://api.justoneapi.com with http://47.117.133.51:30015
curl -X GET "https://api.justoneapi.com/api/zhihu/search/v1?token=YOUR_API_KEY&keyword=VALUE"text
I want to use the "Search (V1)" API from Just One API.
API Endpoint: https://api.justoneapi.com/api/zhihu/search/v1
HTTP Method: GET
Authentication: Append "?token=YOUR_API_KEY" to the URL.
OpenAPI Definition: https://docs.justoneapi.com/openapi/zhihu-apis/search-v1-en.json
Parameters:
- token (query): TOKEN (Required)
- keyword (query): Search keywords. (Required)
- offset (query): Start offset, begins with 0.
Return format: JSON
Response Handling & Error Codes:
1. Business results should be determined by the "code" field in the response body (code 0 means success).
2. Timeout Recommendation: Set request timeout to at least 60 seconds.
3. Business Code Reference:
- 0: Success
- 100: Invalid or Inactive Token
- 301: Collection Failed. Please Retry.
- 302: Rate Limit Exceeded
- 303: Daily Quota Exceeded
- 400: Invalid Parameters
- 500: Internal Server Error
- 600: Permission Denied
- 601: Insufficient Balance
Please help me write a script in my preferred programming language to call this API and handle the response.python
# Tip: For Mainland China, replace https://api.justoneapi.com with http://47.117.133.51:30015
import requests
url = "https://api.justoneapi.com/api/zhihu/search/v1?token=YOUR_API_KEY&keyword=VALUE"
response = requests.get(url)
print(response.json())js
// Tip: For Mainland China, replace https://api.justoneapi.com with http://47.117.133.51:30015
const response = await fetch("https://api.justoneapi.com/api/zhihu/search/v1?token=YOUR_API_KEY&keyword=VALUE", {
method: "GET"
});
const data = await response.json();
console.log(data);java
// Tip: For Mainland China, replace https://api.justoneapi.com with http://47.117.133.51:30015
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.justoneapi.com/api/zhihu/search/v1?token=YOUR_API_KEY&keyword=VALUE"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}go
// Tip: For Mainland China, replace https://api.justoneapi.com with http://47.117.133.51:30015
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
client := &http.Client{}
url := "https://api.justoneapi.com/api/zhihu/search/v1?token=YOUR_API_KEY&keyword=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}php
// Tip: For Mainland China, replace https://api.justoneapi.com with http://47.117.133.51:30015
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.justoneapi.com/api/zhihu/search/v1?token=YOUR_API_KEY&keyword=VALUE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
curl_close($ch);
echo $response;Responses
json
{
"code": 0,
"data": {
"paging": {
"is_end": false,
"next": "https://api.zhihu.com/search_v3?advert_count=0&correction=1&filter_fields=&gk_version=gz-gaokao&lc_i..."
},
"data": [
{
"type": "search_result",
"highlight": {
"description": "不能相信,现在的ai不是很靠谱,甚至有时候是很离谱的好不好。之前很多次新闻了,就是搜索出来的内容很荒唐。就是最近一次,我看到的搜索结果是“张凌赫是侯明昊的母亲”?!还有之前的,除了专业性的知识和严肃的...",
"title": "<em>Deepseek</em>说我写小说很有天分,能相信吗?"
},
"object": {
"original_id": "772386614",
"id": "2014453517826418057",
"type": "answer",
"excerpt": "不能相信,现在的ai不是很靠谱,甚至有时候是很离谱的好不好。之前很多次新闻了,就是搜索出来的内容很荒唐。就是最近一次,我看到的搜索结果是“张凌赫是侯明昊的母亲”?!还有之前的,除了专业性的知识和严肃的...",
"url": "https://api.zhihu.com/answers/2014453517826418057",
"voteup_count": 1,
"comment_count": 0,
"favorites_count": 0,
"created_time": 1773063145,
"updated_time": 1773063145,
"content": "<p data-pid=\"Z27nnJaI\">不能相信,现在的ai不是很靠谱,甚至有时候是很离谱的好不好。</p><p data-pid=\"8CKJ_nf_\">之前很多次新闻了,就是搜索出来的内容很荒...",
"thumbnail_info": {
"count": 0,
"thumbnails": [],
"type": "thumbnail_info",
"total_count": 0
},
"relationship": {
"voting": 0,
"is_author": false,
"is_thanked": false,
"is_nothelp": false,
"following_upvoter": [],
"following_upvoter_count": 0,
"following_collect": [],
"following_collect_count": 0,
"high_level_creator": [],
"high_level_creator_count": 0,
"is_following": false
},
"question": {
"id": "2012286308316381299",
"type": "question",
"name": "<em>Deepseek</em>说我写小说很有天分,能相信吗?",
"url": "https://api.zhihu.com/questions/2012286308316381299",
"answer_count": 0,
"follow_count": 0,
"attached_info_bytes": ""
},
"author": {
"id": "bd068c9a1db4daba555e8b14dbec4107",
"url_token": "jiu-shi-xiao-xia-57",
"name": "就是小夏",
"headline": "好像一只躺躺兽",
"gender": -1,
"is_followed": false,
"is_following": false,
"user_type": "people",
"url": "https://api.zhihu.com/people/bd068c9a1db4daba555e8b14dbec4107",
"type": "people",
"avatar_url": "https://picx.zhimg.com/50/v2-5796cb037aeb3c69e6b14d7f22184c41_l.jpg?source=4e949a73",
"badge": [],
"authority_info": null,
"voteup_count": 400,
"follower_count": 647,
"badge_v2": {
"title": "",
"merged_badges": [],
"detail_badges": [],
"icon": "",
"night_icon": ""
},
"badge_v2_string": "{\"title\":\"\",\"merged_badges\":[],\"detail_badges\":null,\"icon\":\"\",\"night_icon\":\"\"}",
"topic_bayes_map": null,
"topic_map": {},
"verify_bayes": ""
},
"is_anonymous": false,
"is_zhi_plus": false,
"is_zhi_plus_content": false,
"extra": "",
"health_tag": "",
"answer_type": "normal",
"sub_content_type": "",
"settings": {
"table_of_contents": {
"enabled": false
}
},
"attached_info_bytes": "OvkBCgtwbGFjZWhvbGRlchIgMDZiNDlmODQ0YWExNjk5MjNhMjk5YjM0NjNkY2YzOTYYBCIJNzcyMzg2NjE0KhMyMDE0NDUzNTE3...",
"biz_encoded_params": "sw%3Ddeepseek",
"answer_count": 27,
"visits_count": 3950,
"description": "<p>无论怎么问,无论重开多少次,它都把我的文章夸出花来,还在思考里一次又一次的说用户非常有天分。</p><a data-draft-node=\"block\" data-draft-type=\"lin...",
"title": "Deepseek说我写小说很有天分,能相信吗?",
"native": 0,
"doc_relevance_scores": null,
"bert_rel": 0
},
"hit_labels": null,
"index": 0
}
],
"hit_labels": null,
"related_search_result": [],
"search_action_info": {
"attached_info_bytes": "OnoSIDA2YjQ5Zjg0NGFhMTY5OTIzYTI5OWIzNDYzZGNmMzk2SghkZWVwc2Vla1AAWAFgAWoIZGVlcHNlZWtwJoABlJyPk/2SkwOA...",
"lc_idx": 20,
"search_hash_id": "06b49f844aa169923a299b3463dcf396",
"isfeed": false
},
"is_brand_word": false,
"pendant": null,
"sensitive_level": -1,
"warning": "",
"filter_items": null,
"ab_params": "dm_l2_tower=0;dm_adjust_ctr=0;sb_vip_xunzhi=1;adflow=0;dm_preset_opt=1;dm_guess_pool=6;dm_integrate=...",
"item_in_view": [
{
"type": "user_survey",
"index": 5,
"token": "b62a7302709544129797697d76efeb6c"
}
],
"domain_info": {
"first_category": ""
},
"is_koc_words": false,
"is_hit_koc_cache": false
}
}💡 Note: For list data, the example shows only 1-2 items for simplicity. The actual count depends on the API response.
