SerpApi Official icon

SerpApi Official

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

Overview

This node integrates with SerpApi's official API to perform Google Autocomplete searches. It sends a search query to Google's autocomplete engine via SerpApi and retrieves suggested completions for the query in real-time. This is useful for applications that want to provide users with dynamic search suggestions, improve search input UX, or analyze popular search terms.

Common scenarios include:

  • Enhancing search bars with autocomplete suggestions.
  • Gathering keyword ideas for SEO or marketing campaigns.
  • Building predictive text features based on Google’s autocomplete data.

For example, if you input "best restaurants", the node can return autocomplete suggestions like "best restaurants near me", "best restaurants in New York", etc.

Properties

Name Meaning
Search Query (q) The main search query string for which autocomplete suggestions are requested.
Additional Fields A collection of optional parameters to customize the autocomplete request:
- Country (gl) Country code to localize the search results (e.g., "us" for United States, "fr" for France). A long list of country codes is available.
- Language (hl) Language code to specify the language of the search results (e.g., "en" for English, "fr" for French). Many language options are supported.
- Cursor pointer (cp) Position of the cursor within the query string, influencing autocomplete suggestions.
- Client (client) Defines the client type for autocomplete, such as "chrome", "firefox", "youtube", etc., affecting how results are fetched.
- Disable Caching (no_cache) Boolean flag to force fetching fresh results instead of cached ones. Cached results expire after 1 hour.
- Async (async) Boolean flag to perform the search asynchronously. If true, results must be retrieved later via a separate API call. Cannot be used together with no_cache.
- ZeroTrace Mode (zero_trace) Boolean flag to enable enterprise-only mode that skips storing search metadata on SerpApi servers, enhancing privacy but making debugging harder.
- Output (output) Defines the output format: "json" for structured JSON (default), or "html" for raw HTML response.
- JSON Restrictor (json_restrictor) Allows restricting the fields returned in the JSON response by specifying a path and fields, e.g., limiting to certain result titles and snippets.

Output

The node outputs the autocomplete results in the json field of the output data. By default, this is a structured JSON object containing the autocomplete suggestions and related metadata from SerpApi.

If the output format is set to "html", the raw HTML content of the autocomplete response is returned instead.

The node does not output binary data.

Dependencies

  • Requires an active SerpApi account and an API key credential configured in n8n.
  • The node makes HTTP requests to SerpApi's endpoint at https://serpapi.com/search.json.
  • Proper API authentication must be set up in n8n credentials for SerpApi.

Troubleshooting

  • Invalid API Key or Authentication Errors: Ensure your SerpApi API key is correctly configured in n8n credentials.
  • Empty or No Results: Verify the search query (q) is non-empty and valid. Also check country and language settings.
  • Conflicting Parameters: Do not use no_cache and async parameters together; they are mutually exclusive.
  • Rate Limits or Quotas: SerpApi enforces usage limits; exceeding them will cause errors. Monitor your account usage.
  • ZeroTrace Mode Issues: Enabling zero trace may make debugging difficult due to lack of stored metadata.
  • Unexpected Output Format: If you expect JSON but get HTML, verify the output property is set correctly.

Links and References

Discussion