Documentation
Baidu Search API reference for six search operations
Read the Baidu Search API reference for query operators, time and site filters, paging inputs and the fields of web, news, image, video and suggestion results.
See also: Baidu Search API overview and prices · Baidu Search API guide: keyword research and monitoring
On this page
Baidu Search API query text and operators
Five operations take body.q: baidu-search, baidu-news, baidu-images, baidu-videos and baidu-suggest. The query can be written in Chinese, English or any other language, and query, keyword and wd are accepted as alternative names for it.
Baidu's own operators work inside the query text of each of these operations: site:zhihu.com limits results to a domain, intitle:word requires a word in the page title, filetype:pdf selects a document type, quotation marks keep an exact phrase together, and a leading minus sign, as in -word, excludes a word.
Fields in this section (6)
baidu-search, baidu-news, baidu-images, baidu-videos, baidu-suggest, body.q
Time windows and date ranges in baidu-search
body.time_period keeps only pages that Baidu dates inside a window: day is the past 24 hours, week the past 7 days, month the past 30 days and year the past 365 days. tbs is accepted as an alternative name.
A custom range takes body.date_from and body.date_to together, both written as YYYY-MM-DD. The start date is read as China time and the end date is inclusive, so an end date of 2026-10-31 puts that day inside the range.
body.gpc holds Baidu's raw time filter, for callers who already build it, in the form stf=1793000000,1793600000|stftype=2, where the numbers are epoch timestamps and stftype is 1 or 2. body.time_period and the date pair are the simpler forms.
Fields in this section (5)
baidu-search, body.time_period, body.date_from, body.date_to, body.gpc
How site, file type and scope change the query
body.site adds the site: operator for the domain you give, so zhihu.com limits the results to that site. body.file_type adds the filetype: operator, and doc, xls and ppt match the doc and docx, xls and xlsx, and ppt and pptx forms respectively. body.scope set to title adds intitle:, set to url adds inurl:, and all, the default, lets the query words appear anywhere on the page.
Fields in this section (4)
baidu-search, body.site, body.file_type, body.scope
Result size and position in baidu-search
body.num decides how many results a page holds. A value outside its range is clamped to the range, and an invalid value is ignored so that the default of 10 applies. rn and results_per_page are accepted as alternative names.
body.offset is an absolute result position and an alternative to body.page; pn and start are accepted as alternative names. With body.num at 10, an offset of 10 gives page 2.
Fields in this section (5)
baidu-search, body.num, body.page, body.offset, data
Organic result and ad rows in baidu-search
Each row of organic_results carries a position, a title, a snippet, a domain and a source. The url field holds the real destination and link holds Baidu's redirect for the same result.
The date and date_text fields give the date of a result. The type field labels the kind of result, and baidu_property labels the Baidu property it belongs to.
Each row of ads carries a position, a title, a description and a domain. The placement field is top, middle or bottom, and landing_url is the advertiser's page.
Fields in this section (2)
baidu-search, data
Other result groups in baidu-search
Besides the organic result and ad rows, baidu-search returns these groups in data:
related_searches: query phrases related to the one searchedtop_stories: the top stories for the queryshopping_results: the shopping cards for the queryknowledge_graph: the Baidu Baike panel for the topic, as a single objectai_overview: Baidu's AI answer, split into sections that each pair aheadingwith itstexthot_searches: Baidu Hot Search, whererankgives an entry's place in the ranking andpinnedshows whether Baidu pins it
Fields in this section (2)
baidu-search, data
Effect of resolve_links on baidu-search results
With body.resolve_links at its default of false, results come back as Baidu prints them. Turning it on follows Baidu's redirect for results whose real address is not printed, such as widget cards and top stories, and the extra step can take up to a second. Rows of organic_results already hold the destination in url, and ad click links stay unfollowed.
Fields in this section (2)
baidu-search, body.resolve_links
News rows and sort order in baidu-news
A page holds 10 articles, and baidu-news orders its results by relevance unless body.sort is date, which lists the newest articles first. The total_results field is Baidu's own count of matching articles.
Each row of news_results describes one article:
titleandsnippet: the headline and a text excerpturlanddomain: the real article address and its domainsource,dateanddate_text: the publisher and the publish timethumbnail: the picture shown beside the article
Fields in this section (4)
baidu-news, body.sort, body.page, data
Image rows in baidu-images
Each row of image_results describes one image. The original field is the address of the image file, thumbnail is its small version and source_page is the page where it was found.
The width, height and format fields describe the file, and is_gif shows whether it is a GIF. The total_results field is Baidu's total image count, and a page holds 30 images.
Fields in this section (3)
baidu-images, body.page, data
Video rows in baidu-videos
Each row of video_results describes one video on a video platform. The url field is the real video page, source names the platform and duration gives the length.
The date field is the publish date and thumbnail is the preview picture, while title and domain name the video and the site that hosts it. A page holds about 10 videos.
Fields in this section (3)
baidu-videos, body.page, data
Redirect links in baidu-resolve-link
baidu-resolve-link takes a Baidu redirect link in body.url, the same kind of link that result rows carry in link, and link is also accepted as an alternative name for that input. It returns the destination address in url and its domain in domain. Ad click links are not followed.
Fields in this section (3)
baidu-resolve-link, body.url, data
Completions in baidu-suggest
Each entry of suggestions is one completion, listed in the order Baidu offers them.
Fields in this section (3)
baidu-suggest, body.q, data
Operations
Every public gateway operation uses POST /api/v1/{project}/{action}.
Use a JSON object with the documented path, query, headers and body locations; omit unused locations. input.headers is JSON data for the operation, not browser request headers. Do not put credentials here. Keep body arrays, scalar values and null as documented; omission is different from null.
Image search
POST /api/v1/baidu/baidu-images
Search Baidu Images for original image URLs, thumbnails, sizes and the pages that show each image.
Input fields
| Field | Type | Required | Default | Allowed values | Limits |
|---|---|---|---|---|---|
body.q | string | Required | — | — | — |
body.page | integer | Optional | 1 | — | 1–76 |
Request examples
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/baidu/baidu-images' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"q":"熊猫"}}'Response fields
search_parameterstotal_resultshas_moreimage_results[]positiontitleoriginalthumbnailsource_pagedomainwidthheightformatis_gif
News search
POST /api/v1/baidu/baidu-news
Search Baidu News for headlines, article URLs, publishers and publish times, by relevance or newest first.
Input fields
| Field | Type | Required | Default | Allowed values | Limits |
|---|---|---|---|---|---|
body.q | string | Required | — | — | — |
body.page | integer | Optional | 1 | — | 1–76 |
body.sort | string | Optional | "relevance" | "relevance""date" | — |
Request examples
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/baidu/baidu-news' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"q":"比亚迪"}}'Response fields
search_parameterstotal_resultsnews_results[]positiontitleurldomainsourcesnippetdatedate_textthumbnail
paginationcurrent_pagenext_page_offset
Redirect link resolver
POST /api/v1/baidu/baidu-resolve-link
Turn a Baidu redirect link into the destination URL and domain it points to.
Input fields
| Field | Type | Required | Allowed values | Limits |
|---|---|---|---|---|
body.url | string | Required | — | — |
Request examples
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/baidu/baidu-resolve-link' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"url":"https://www.baidu.com/link?url=…"}}'Response fields
linkurldomain
Web search
POST /api/v1/baidu/baidu-search
Search Baidu web results with time, site, file type and title or URL filters, plus ads, top stories, shopping cards and a knowledge panel.
Input fields
| Field | Type | Required | Default | Allowed values | Limits |
|---|---|---|---|---|---|
body.q | string | Required | — | — | — |
body.date_from | string | Optional | — | — | — |
body.date_to | string | Optional | — | — | — |
body.file_type | string | Optional | — | "pdf""doc""xls""ppt""rtf""txt" | — |
body.gpc | string | Optional | — | — | — |
body.num | integer | Optional | 10 | — | 10–50 |
body.offset | integer | Optional | — | — | 0–750 |
body.page | integer | Optional | 1 | — | 1–76 |
body.resolve_links | boolean | Optional | false | — | — |
body.scope | string | Optional | "all" | "all""title""url" | — |
body.site | string | Optional | — | — | — |
body.time_period | string | Optional | — | "day""week""month""year" | — |
Request examples
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/baidu/baidu-search' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"q":"笔记本电脑"}}'Response fields
search_parametersorganic_results[]ads[]related_searches[]querylink
top_stories[]titleurlsourcedatesnippetthumbnail
shopping_results[]titlepricecurrencystoresalesurl
knowledge_graphtitletypedescriptionimagelink
ai_overviewtitlesections[]headingtext
sources[]titlesourcelink
hot_searches[]rankquerypinned
paginationcurrent_pageresults_per_pagepage_offsetnext_page_offsettotal_pages
Search suggestions
POST /api/v1/baidu/baidu-suggest
Get the query completions Baidu offers while a query is being typed.
Input fields
| Field | Type | Required | Allowed values | Limits |
|---|---|---|---|---|
body.q | string | Required | — | — |
Request examples
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/baidu/baidu-suggest' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"q":"笔记本"}}'Response fields
search_parameterssuggestions[]
Video search
POST /api/v1/baidu/baidu-videos
Search Baidu Video for video titles, video page URLs, durations, platforms and publish dates.
Input fields
| Field | Type | Required | Default | Allowed values | Limits |
|---|---|---|---|---|---|
body.q | string | Required | — | — | — |
body.page | integer | Optional | 1 | — | 1–30 |
Request examples
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/baidu/baidu-videos' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"q":"iphone 17"}}'Response fields
search_parametersvideo_results[]positiontitleurldomainlinkdurationsourcedatethumbnail
How calls work
POST /api/v1/baidu/<action>withx-api-key,Content-Type: application/jsonand a requiredIdempotency-Key.- A successful call returns
ok: true:datais the result of the operation,meta.requestIdidentifies the recorded request andmeta.chargedCreditUnitsis the amount charged. Otherwiseokisfalseanderror.codenames the reason; readokanderror.coderather than relying on the HTTP status alone. Every gateway reply carries a request id for support:meta.requestId, or a top-levelrequestIdin a reply withoutmeta(such as a refusal before admission). - Charged the listed price only when a call succeeds. Failures are not charged; an unconfirmed outcome is released after at most 900 seconds without a charge.
- Repeating the same request with the same Idempotency-Key after it has finished returns the stored response for 24 hours without a new charge.
In the gateway reference: