Query with Localization

This documentation explains how to use localization parameters with the SERP API to tailor search results based on the user's preferred language and location.

Parameters for Localization

The SERP API provides three optional parameters for localization:

  • googleDomain (Optional): This parameter defines the Google domain to use. By default, it is set to www.google.com. Ensure you include "www" before the domain name.

  • gl (Optional): This parameter defines the country to use for the Google search. It should be a two-letter country code (e.g., us for the United States, uk for the United Kingdom, or fr for France).

  • hl (Optional): This parameter defines the language to use for the Google search. It should be a two-letter language code (e.g., en for English, es for Spanish, or fr for French). You can find a full list of supported Google languages on the Google languages page.

Using Localization Parameters

To customize your SERP API request for localization, include the localization parameters in your GET request. Here's an example using various programming languages:

  • Bash

  • Javascript

  • Python

  • Go

curl -L 'https://serp-api.netnut.io/search?device=desktop&q=news&gl=us&hl=en' \
-H 'Accept: application/json' \
-H 'Authorization: Basic base64(username:password)'

API Response

When you include localization parameters, the API response will contain search results tailored to the specified country and language preferences.

This documentation demonstrates how to use localization parameters to customize your SERP API requests. You can adjust the gl and hl parameters to provide users with search results that match their location and language preferences.

{
    "url": "https://www.google.com/search?q=news&hl=en&gl=US",
    "general": {
        "searchEngine": "google",
        "resultsCount": 25270000000,
        "searchTime": 0.61,
        "language": "en",
        "mobile": false,
        "searchType": "text",
        "pageTitle": "news - Google Search",
        "timestamp": "2023-10-01T12:41:07.971Z"
    },
    "input": {
        "originalUrl": "https://www.google.com/search?q=news&hl=en&gl=US",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",
        "jobId": "a21a4108-6669-4abf-9afd-2ba7fd95fafc"
    },
    "organic": [
        {
            "title": "Google News",
            "description": "3 hours ago — Comprehensive up-to-date news coverage, aggregated from sources all over the world by Google News.",
            "link": "https://news.google.com/",
            "displayLink": "https://news.google.com",
            "rank": 1,
            "globalRank": 1
        },
        {
            "title": "NBC News - Breaking News & Top Stories - Latest World, US ...",
            "description": "Go to NBCNews.com for breaking news, videos, and the latest top stories in world news, business, politics, health and pop culture.",
            "link": "https://www.nbcnews.com/",
            "displayLink": "https://www.nbcnews.com",
            "rank": 2,
            "globalRank": 2
        },
        {
            "title": "CNN: Breaking News, Latest News and Videos",
            "description": "4 hours ago — View the latest news and breaking news today for U.S., world, weather, entertainment, politics and health at CNN.com.",
            "link": "https://www.cnn.com/",
            "displayLink": "https://www.cnn.com",
            "rank": 3,
            "globalRank": 3
        },
        {
            "title": "Fox News - Breaking News Updates | Latest News Headlines ...",
            "description": "23 hours ago — Breaking News, Latest News and Current News from FOXNews.com. Breaking news and video. Latest Current News: U.S., World, Entertainment, ...",
            "link": "https://www.foxnews.com/",
            "displayLink": "https://www.foxnews.com",
            "rank": 4,
            "globalRank": 4
        },
        {
            "title": "ABC News - Breaking News, Latest News and Videos",
            "description": "4 hours ago — Your trusted source for breaking news, analysis, exclusive interviews, headlines, and videos at ABCNews.com.",
            "link": "https://abcnews.go.com/",
            "displayLink": "https://abcnews.go.com",
            "rank": 5,
            "globalRank": 5
        },
        {
            "title": "CBS News - Breaking news, 24/7 live streaming news & top ...",
            "description": "2 hours ago — Watch CBS News live and get the latest, breaking news headlines of the day for national news and world news today.",
            "link": "https://www.cbsnews.com/",
            "displayLink": "https://www.cbsnews.com",
            "rank": 6,
            "globalRank": 6
        },
        {
            "title": "U.S. News & World Report: News, Rankings and Analysis on ...",
            "description": "US News is a recognized leader in college, grad school, hospital, mutual fund, and car rankings. Track elected officials, research health conditions, ...",
            "link": "https://www.usnews.com/",
            "displayLink": "https://www.usnews.com",
            "rank": 7,
            "globalRank": 7
        },
        {
            "title": "Associated Press News: Breaking News, Latest Headlines ...",
            "description": "6 hours ago — Read the latest headlines, breaking news, and videos at APNews.com, the definitive source for independent journalism from every corner of the globe.",
            "link": "https://apnews.com/",
            "displayLink": "https://apnews.com",
            "rank": 8,
            "globalRank": 8
        }
    ],
    "pagination": {
        "currentPage": 1,
        "nextPage": 2,
        "nextPageLink": "https://www.google.com/search?q=news&sca_esv=569845833&hl=en&gl=US&ei=4mgZZdvlI9-awbkPtNSuoAs&start=10&sa=N",
        "nextPageStart": 10
    }
}
}

Last updated

Copyright NetNut LTD