SerpApi Official icon

SerpApi Official

Get live Google Search data and more from SerpApi's official node

Overview

The node provides an interface to perform live Baidu web searches using SerpApi's official API. It allows users to send customized search queries with various parameters to retrieve search results directly from Baidu, one of the largest Chinese search engines. This node is useful for scenarios such as market research, competitive analysis, SEO monitoring, or gathering real-time data from Baidu search results.

For example, a user can search for "Coffee" and specify language restrictions, pagination, or device type to tailor the search results. The node supports advanced Baidu search operators and options to refine the query and control output format.

Properties

Name Meaning
Search Query (q) Defines the main search query string including Baidu search operators like inurl:, site:, intitle:, etc. Example: "Coffee"
Additional Fields A collection of optional parameters to further customize the search:
- Choose Language (ct) Restricts results by language: All Languages, Simplified Chinese, Traditional Chinese
- Result Offset (pn) Pagination offset; number of results to skip. For example, 0 for first page, 10 for second page, etc.
- Number of Results (rn) Maximum number of results to return (up to 50). Default is 10. Only applicable for desktop/tablet searches.
- Time Period for Results (gpc) Unix timestamp range to limit results to a specific time period (e.g., last 7 days).
- Search Type (q5) Search by page title or web address (similar to inurl: or intitle:). Values like 1 or 2 specify the type.
- Search Type (q6) Domain-specific search (similar to site:). For example, restrict results to serpapi.com.
- Previous Search Query (bs) Defines the previous search query string.
- Original Search Query (oq) Defines the original search query when navigating from related searches.
- Originating Search Type (f) Indicates the originating search type (e.g., 8 = normal search, 3 = suggestion list, 1 = related search).
- Device (device) Device type for search results: desktop (default), tablet, or mobile.
- Disable Caching (no_cache) Boolean flag to force fetching fresh results instead of cached ones. Cached results are free and expire after 1 hour. Cannot be used together with async.
- Async (async) Boolean flag to perform asynchronous search submission. If true, results must be retrieved later via Search Archive API. Cannot be used with no_cache. Not for accounts with Ludicrous Speed enabled.
- ZeroTrace Mode (zero_trace) Enterprise-only option to disable storing search parameters and metadata on SerpApi servers for privacy. May complicate debugging.
- Output (output) Format of the final output: json (default) for structured JSON results or html for raw HTML content.
- JSON Restrictor (json_restrictor) Limits fields in the JSON response. For example, organic_results[0:3].{title,snippet} returns only titles and snippets of the first 3 organic results.

Output

The node outputs the search results in the json field of the item. By default, this is a structured JSON object containing all the data returned by the Baidu search API through SerpApi. This includes organic results, ads, related searches, and other metadata depending on the query and parameters.

If the output property is set to html, the node returns the raw HTML content of the search results page instead of JSON.

The node does not output binary data.

Dependencies

  • Requires an active SerpApi account with a valid API key credential configured in n8n.
  • Internet access to call SerpApi endpoints.
  • No additional external dependencies beyond the SerpApi service.

Troubleshooting

  • Common issues:

    • Invalid or missing API key credential will cause authentication errors.
    • Using incompatible parameter combinations, e.g., setting both no_cache and async to true, will result in errors.
    • Exceeding rate limits or quota on SerpApi account may cause request failures.
    • Incorrect formatting of advanced parameters like json_restrictor may lead to incomplete or empty responses.
  • Error messages:

    • Authentication errors indicate problems with the API key setup.
    • Parameter validation errors suggest invalid or conflicting input values.
    • Network or timeout errors may require checking internet connectivity or retrying later.

To resolve these, verify API credentials, review parameter usage, and consult SerpApi documentation for limits and best practices.

Links and References

Discussion