Baidu Maps API
Our Baidu Maps API allows you to scrape places from Baidu Maps (百度地图), the most used map in China. For each place, the API returns its name, type, address and district, GPS coordinates, rating and number of reviews, price, opening hours, phone, photo, user reviews, and more.
Search places in China and around the world: in a city with c, using one of the Baidu Maps cities, or near GPS coordinates with lat and lon. In China, including Hong Kong, Macau and Taiwan, coordinates are shifted a few hundred meters from GPS coordinates, like on all maps of mainland China (a system called GCJ-02). Elsewhere, they are the usual GPS coordinates.
Searches for an area, like a district (e.g., 朝阳区), return the area itself in place_results.
The API endpoint is https://serpapi.com/search?engine=baidu_maps
Head to the playground for a live and interactive demo.
API Parameters
Search Query
q
Required
Parameter defines the search query. You can use anything that you would use in a regular Baidu Maps search: a type of place, a business, a brand, or a landmark (e.g., 咖啡 (coffee), 酒店 (hotels), 星巴克 (Starbucks), or 故宫 (the Forbidden City)).
Without c, the query can include the city to search in (e.g., 上海 咖啡 for coffee in Shanghai).
Geographic Location
c
Optional
Parameter defines the city to search in, with its Baidu Maps city code (e.g., 131 for Beijing, 289 for Shanghai, or 257 for Guangzhou). Head to the Baidu Maps cities page for the cities of China. Cities in other countries have codes too (e.g., 49872 for Paris): a search near their coordinates returns it in search_information.city_code.
Without it, Baidu Maps searches in the city named in q, in China or abroad, or lists the cities with results in cities. With lat and lon, it searches in the city at the coordinates.
With lat and lon, the city must be the one where the coordinates are: Baidu Maps only searches in the city of c, even when the coordinates are elsewhere.
lat
Optional
Parameter defines the latitude to search near (e.g., 39.908776). Results are the places near these coordinates, and their distance field says how far each one is.
In China, including Hong Kong, Macau and Taiwan, Baidu Maps uses coordinates shifted a few hundred meters from GPS coordinates, like all maps of mainland China (a system called GCJ-02).
Parameter is required when using lon parameter. c is optional with coordinates: without it, the city at the coordinates is used. If it's set, it must be the city where the coordinates are.
lon
Optional
Parameter defines the longitude to search near (e.g., 116.39759). Results are the places near these coordinates, and their distance field says how far each one is.
In China, including Hong Kong, Macau and Taiwan, Baidu Maps uses coordinates shifted a few hundred meters from GPS coordinates, like all maps of mainland China (a system called GCJ-02).
Parameter is required when using lat parameter. c is optional with coordinates: without it, the city at the coordinates is used. If it's set, it must be the city where the coordinates are.
Serpapi Parameters
no_cache
Optional
Parameter will force SerpApi to fetch the Baidu Maps results even if a cached version is already present. A cache is served only if the query and all parameters are exactly the same. Cache expires after 1h. Cached searches are free, and are not counted towards your searches per month. It can be set to false (default) to allow results from the cache, or true to disallow results from the cache. no_cache and async parameters should not be used together.
async
Optional
Parameter defines the way you want to submit your search to SerpApi. It can be set to false (default) to open an HTTP connection and keep it open until you got your search results, or true to just submit your search to SerpApi and retrieve them later. In this case, you'll need to use our Searches Archive API to retrieve your results. async and no_cache parameters should not be used together. async should not be used on accounts with Ludicrous Speed enabled.
zero_trace
Optional
Enterprise only. Parameter enables ZeroTrace mode. It can be set to false (default) or true. Enable this mode to skip storing search parameters, search files, and search metadata on our servers. This may make debugging more difficult.
output
Optional
Parameter defines the format of the result. It can be set to json (default) to get a structured JSON of the results, html to get the raw HTML retrieved, or md to get a markdown-formatted version optimized for LLMs and AI agents.
json_restrictor
Optional
Parameter defines the fields you want to include in the output, reducing payload size for faster response. See the JSON Restrictor documentation for more details.
API Results
JSON Results
JSON output includes structured data for Local Results, Place Results, Cities.
A search status is accessible through search_metadata.status.
It flows this way: Processing -> Success || Error.
If a search has failed, error will contain an error message.
search_metadata.id is the search ID inside SerpApi.
HTML Results
HTML output gives you the raw HTML of Baidu Maps' mobile website, which embeds the results. It is useful to debug JSON results. search_metadata.prettify_html_file contains a link to a prettified version of the results, displayed in the playground.
Markdown Results
Markdown output is optimized for LLMs and AI agents. It provides a curated view of the JSON results
in a token-efficient format using tables, markdown links, and YAML frontmatter.
To access, use the output=md parameter, the /search.md endpoint, or request header Accept: text/markdown.
API Examples
Result for q: 咖啡 (coffee) and c: 131 (Beijing)
Each place of local_results has its place_id on Baidu Maps, a link to its page on Baidu Maps, and its gps_coordinates. Prices are in Chinese yuan, like the average spending per person (人均消费) of restaurants.
{
...
"local_results": [
{
"position": 1,
"title": "COSTA COFFEE(华熙LIVE店)",
"place_id": "325563a477c45765c51e515f",
"link": "https://map.baidu.com/mobile/webapp/place/detail/qt=ninf&uid=325563a477c45765c51e515f/vt=map",
"gps_coordinates": {
"latitude": 39.909528,
"longitude": 116.278211
},
"rating": 4.1,
"reviews": 10,
"price": "¥27.2",
"extracted_price": 27.2,
"price_description": "人均消费",
"type": "咖啡厅",
"types": [
"美食",
"咖啡厅"
],
"tags": [
"店面较大",
"人不多",
"服务一般"
],
"address": "复兴路69号院五棵松HI-UP2号楼负一层023、025室",
"structured_address": {
"province": "北京市",
"city": "北京市",
"district": "海淀区",
"town": "万寿路街道"
},
"neighborhoods": [
"五棵松"
],
"phone": "010-68156695",
"hours": "周五至周日10:00-24:00 周一至周四10:00-22:00",
"thumbnail": "https://poi-pic.cdn.bcebos.com/swd/48ce9dc3-f2b2-32c8-a3d1-525b713f5852.jpg",
"user_reviews": {
"most_relevant": [
{
"username": "学克alecis28",
"user_thumbnail": "https://himg.bdimg.com/sys/portrait/item/ma.1.6034b252.oNNQUoaxO4U5_n1jlIeolA.jpg",
"description": "啊啊啊!costa的服务真的超级好啊!介绍得超详细又热情,而且咖啡和熊猫生椰拿铁也超级好喝!环境也超用心的,我还买了七杯咖啡、一个包包和好多券,办了会员卡,真的太棒了!店家还特别有人格魅力,对工作超认真的,感觉好棒啊!",
"date": "2023-05-06 22:01",
"source": "百度地图",
"link": "https://ugc.map.baidu.com/cube/comment/choicepage?tab=1&uid=325563a477c45765c51e515f&comment_sort=1"
}
]
}
},
{
"position": 2,
"title": "星巴克(南锣鼓巷店)",
"place_id": "b4802f292889fb5e09b93a9c",
"link": "https://map.baidu.com/mobile/webapp/place/detail/qt=ninf&uid=b4802f292889fb5e09b93a9c/vt=map",
"gps_coordinates": {
"latitude": 39.939635,
"longitude": 116.403308
},
"rating": 4.7,
"reviews": 12,
"price": "¥40.8",
"extracted_price": 40.8,
"price_description": "人均消费",
"type": "咖啡厅",
"types": [
"美食",
"咖啡厅"
],
"tags": [
"店面较大",
"回头客",
"人气旺"
],
"address": "北京市东城区南锣鼓巷20号",
"structured_address": {
"province": "北京市",
"city": "北京市",
"district": "东城区",
"town": "交道口街道"
},
"phone": "010-84084985",
"hours": "08:00-21:00",
"thumbnail": "https://poi-pic.cdn.bcebos.com/swd/28a1b2ce-de00-3b51-afb7-d02a1beaca28.jpg",
"user_reviews": {
"most_relevant": [
{
"username": "敏荣brittany29",
"user_thumbnail": "https://himg.bdimg.com/sys/portrait/item/ma.1.6d2c717.mVi3OcKOnE5vUlD3itHJxQ.jpg",
"description": "去鼓楼溜达到南楼古巷,发现星巴克,点了海盐焦糖,馥芮白,焦糖玛奇朵,小甜点,味道不错",
"date": "2023-02-05 20:07",
"source": "百度地图",
"link": "https://ugc.map.baidu.com/cube/comment/choicepage?tab=1&uid=b4802f292889fb5e09b93a9c&comment_sort=1"
}
]
}
},
...
],
"serpapi_pagination": {
"current": 1,
"next": "https://serpapi.com/search.json?c=131&engine=baidu_maps&page=2&q=%E5%92%96%E5%95%A1"
}
}
Result for lat and lon (People's Square, Shanghai)
With lat and lon, the results are places near the coordinates, with their distance from them. Without c, Baidu Maps searches in the city at the coordinates, and the links of serpapi_pagination set its c.
{
...
"local_results": [
{
"position": 1,
"title": "星巴克(迪美广场店)",
"place_id": "6f7ad8eac224fb8e9cec2bc1",
"link": "https://map.baidu.com/mobile/webapp/place/detail/qt=ninf&uid=6f7ad8eac224fb8e9cec2bc1/vt=map",
"gps_coordinates": {
"latitude": 31.228332,
"longitude": 121.473343
},
"rating": 4.3,
"reviews": 1,
"price": "¥28.8",
"extracted_price": 28.8,
"price_description": "人均消费",
"type": "咖啡厅",
"types": [
"美食",
"咖啡厅"
],
"tags": [
"菜品精致",
"停车方便",
"交通方便"
],
"address": "人民大道221号236号-238号",
"structured_address": {
"province": "上海市",
"city": "上海市",
"district": "黄浦区",
"town": "南京东路街道"
},
"neighborhoods": [
"人民广场"
],
"hours": "周一至周日10:00-21:00",
"distance": "231m",
"thumbnail": "https://poi-pic.cdn.bcebos.com/swd/28a1b2ce-de00-3b51-afb7-d02a1beaca28.jpg",
"user_reviews": {
"most_relevant": [
{
"username": "ycraig8",
"user_thumbnail": "https://himg.bdimg.com/sys/portrait/item/ma.1.81b013b0.D9C_1BjIa1AdbEYFGqu3-w.jpg",
"description": "环境很安静,推荐太妃榛果拿铁和熔岩黑巧燕麦摩卡,冬季限定款式也不错,星巴克研发有点慢",
"date": "2023-02-11 21:19",
"source": "百度地图",
"link": "https://ugc.map.baidu.com/cube/comment/choicepage?tab=1&uid=6f7ad8eac224fb8e9cec2bc1&comment_sort=1"
}
]
}
},
{
"position": 2,
"title": "Marmalade(北海路店)",
"place_id": "925e3971fa731d8bbadf8fdd",
"link": "https://map.baidu.com/mobile/webapp/place/detail/qt=ninf&uid=925e3971fa731d8bbadf8fdd/vt=map",
"gps_coordinates": {
"latitude": 31.230231,
"longitude": 121.47814
},
"rating": 4.2,
"reviews": 6,
"price": "¥33.6",
"extracted_price": 33.6,
"price_description": "人均消费",
"type": "咖啡厅",
"types": [
"美食",
"咖啡厅"
],
"address": "北海路261号",
"structured_address": {
"province": "上海市",
"city": "上海市",
"district": "黄浦区",
"town": "南京东路街道"
},
"neighborhoods": [
"外滩",
"南京东路",
"人民广场"
],
"phone": "18555966310",
"distance": "425m",
"thumbnail": "https://lbsugc.cdn.bcebos.com/images/B65c01da0be9e24351.jpeg",
"user_reviews": {
...
}
},
...
],
"serpapi_pagination": {
"current": 1,
"next": "https://serpapi.com/search.json?c=289&engine=baidu_maps&lat=31.2304&lon=121.4737&page=2&q=%E5%92%96%E5%95%A1"
}
}
Result for q: 咖啡 (coffee), without c
Without c, Baidu Maps searches in the city the query names, in China or abroad (e.g., 巴黎 酒店 for hotels in Paris). When the query doesn't name a city, like here, Baidu Maps lists the cities with the most results instead. They are in cities, with the SerpApi links to search in them.
{
...
"cities": [
{
"position": 1,
"city": "上海市",
"city_code": 289,
"total_results": 6298,
"serpapi_link": "https://serpapi.com/search.json?c=289&engine=baidu_maps&q=%E5%92%96%E5%95%A1"
},
{
"position": 2,
"city": "广州市",
"city_code": 257,
"total_results": 5906,
"serpapi_link": "https://serpapi.com/search.json?c=257&engine=baidu_maps&q=%E5%92%96%E5%95%A1"
},
{
"position": 3,
"city": "深圳市",
"city_code": 340,
"total_results": 5288,
"serpapi_link": "https://serpapi.com/search.json?c=340&engine=baidu_maps&q=%E5%92%96%E5%95%A1"
},
...
],
"error": "Baidu Maps hasn't returned any results for this query."
}
Result for page: 2
page gets the results of a specific page. Baidu Maps returns up to 10 results per page. serpapi_pagination has the SerpApi links to get the previous and the next pages.
{
...
"local_results": [
{
"position": 1,
"title": "红栗子咖啡厅",
"place_id": "3703cff6075dc071c51e5183",
"link": "https://map.baidu.com/mobile/webapp/place/detail/qt=ninf&uid=3703cff6075dc071c51e5183/vt=map",
"gps_coordinates": {
"latitude": 40.364093,
"longitude": 116.595654
},
"rating": 4.3,
"reviews": 2,
"price": "¥41.6",
"extracted_price": 41.6,
"price_description": "人均消费",
"type": "咖啡厅",
"types": [
"美食",
"咖啡厅"
],
"address": "怀黄公路与西甘路交叉口",
...
},
...
],
"serpapi_pagination": {
"current": 2,
"previous": "https://serpapi.com/search.json?c=131&engine=baidu_maps&page=1&q=%E5%92%96%E5%95%A1",
"next": "https://serpapi.com/search.json?c=131&engine=baidu_maps&page=3&q=%E5%92%96%E5%95%A1"
}
}
JSON Structure Overview
{
...
"local_results": [
{
"position": "Integer - Position of the place in the results of the page.",
"title": "String - Name of the place.",
"place_id": "String - Baidu Maps ID of the place.",
"link": "String - Link to the page of the place on Baidu Maps.",
"gps_coordinates": {
"latitude": "Float - Latitude of the place, in GCJ-02 in China (including Hong Kong, Macau and Taiwan), and GPS elsewhere.",
"longitude": "Float - Longitude of the place, in GCJ-02 in China (including Hong Kong, Macau and Taiwan), and GPS elsewhere."
},
"rating": "Float - Average rating of the place, out of 5.",
"reviews": "Integer - Number of reviews of the place.",
"price": "String - Price, in Chinese yuan. (Ex. ¥49.2)",
"extracted_price": "Number - Price, in Chinese yuan.",
"price_description": "String - What the price is for. (Ex. 人均消费 for the average spending per person)",
"type": "String - Type of the place, as Baidu Maps shows it. (Ex. 咖啡厅, 四川火锅, AAAAA景区,古迹, 五星级)",
"types": [
"String - Category of the place, from the most general to the most specific. (Ex. 美食)"
],
"tags": [
"String - Tag Baidu Maps shows on the place: what reviews say about restaurants (Ex. 回头客 for regulars), or a category of other places (Ex. 5A景区)."
],
"description": "String - Short introduction of the place by Baidu Maps. (Ex. 中国最大的仿唐皇家建筑群)",
"address": "String - Address of the place.",
"structured_address": {
"province": "String - Province of the place.",
"city": "String - City of the place.",
"district": "String - District of the place.",
"town": "String - Town or subdistrict of the place."
},
"neighborhoods": [
"String - Business district of the place. Baidu Maps shows them before the type of hotels. (Ex. 五角场)"
],
"phone": "String - Phone number of the place.",
"hours": "String - Opening hours of the place.",
"distance": "String - Distance of the place from the `lat` and `lon` coordinates. (Ex. 231m, 1.6km)",
"thumbnail": "String - Link to a photo of the place.",
"user_reviews": {
"most_relevant": [
{
"username": "String - Name of the user.",
"user_thumbnail": "String - Link to the photo of the user.",
"rating": "Float - Rating given by the user, out of 5.",
"description": "String - Text of the review.",
"images": [
"String - Link to a photo of the review."
],
"date": "String - Date of the review.",
"source": "String - Platform of the review. (Ex. 百度地图, 大众点评, tripadvisor)",
"link": "String - Link to the reviews of the place on Baidu Maps."
}
]
}
}
],
"place_results": {
"title": "String - Name of the area. (Ex. 朝阳区)",
"place_id": "String - Baidu Maps ID of the area.",
"link": "String - Link to the page of the area on Baidu Maps.",
"gps_coordinates": {
"latitude": "Float - Latitude of the center of the area, in GCJ-02 in China (including Hong Kong, Macau and Taiwan), and GPS elsewhere.",
"longitude": "Float - Longitude of the center of the area, in GCJ-02 in China (including Hong Kong, Macau and Taiwan), and GPS elsewhere."
},
"type": "String - Type of the area. (Ex. 区县级 for a district)",
"types": [
"String - Category of the area, from the most general to the most specific. (Ex. 行政区划)"
],
"structured_address": {
"province": "String - Province of the area.",
"city": "String - City of the area.",
"district": "String - District of the area."
}
},
"cities": [
{
"position": "Integer - Position of the city.",
"city": "String - Name of the city.",
"city_code": "Integer - Baidu Maps code of the city, to use in the `c` parameter.",
"total_results": "Integer - Approximate number of results in the city.",
"serpapi_link": "String - SerpApi link to search in the city."
}
],
"serpapi_pagination": {
"current": "Integer - Current page.",
"previous": "String - SerpApi link to the previous page.",
"next": "String - SerpApi link to the next page."
}
}