# Serp API

### API playground

With our powerful [API playground](https://app.spaceserp.com/playground), you can quickly and flexibly configure requests. Just fill in some fields and we'll generate a request for you.

<figure><img src="https://1602873078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSAeoiLyXsMVHNndYArij%2Fuploads%2FPIr9FjWGBix22IxlpuSl%2FScreenshot%202022-11-03%20at%2012.23.09.png?alt=media&#x26;token=650e8065-f6ed-4467-8d8c-0e718d65e3bd" alt=""><figcaption><p>SpaceSerp API Playground</p></figcaption></figure>

## Making Requests

## You can scrape any data from Google search via this endpoint.

<mark style="color:blue;">`GET`</mark> `https://api.spaceserp.com/google/search`

#### Query Parameters

| Name                                     | Type   | Description                                                  |
| ---------------------------------------- | ------ | ------------------------------------------------------------ |
| apiKey<mark style="color:red;">\*</mark> | String | An account API key that used to authorize user API requests. |
| q<mark style="color:red;">\*</mark>      | String | The keyword which you want to search.                        |

{% tabs %}
{% tab title="200: OK Structured SERP Data" %}

```javascript
{
  "organic_results": [
    {
      "position": 1,
      "domain": "www.macrumors.com",
      "link": "https://www.macrumors.com/roundup/iphone-14/",
      "title": "iPhone 14: Just Launched! New 'Plus' Size ... - MacRumors",
      "description": "13 Oct 2022 — The new 6.7-inch iPhone 14 is called the \"iPhone 14 Plus,\" harkening back to the iPhone 8 and 8 Plus and prior generations. Apple's iPhone 14 ..."
    }
  ],
  "shopping_carousel": [
    {
      "position": 1,
      "title": "Apple Iphone 14 Pro, 128Gb",
      "price": "£1,099.00",
      "seller_name": "Very"
    }
  ],
  "ads_results": [
    {
      "position": 1,
      "domain": "www.apple.com",
      "link": "https://www.apple.com/uk/iphone-14/",
      "title": "The new iPhone 14 - Apple Official Site",
      "description": "Big and bigger. Buy now. 0% financing available. 5 colours. Longest battery life ever. A15 Bionic chip. Crash Detection.‎Buy now · ‎Apple Trade In · ‎Compare iPhone models · ‎Switch to iPhone · ‎Tech Specs"
    }
  ]
}
```

{% endtab %}
{% endtabs %}

Below is a quick overview of all the parameters we support for Google searches. They should be appended as query parameters to the above request.

| Parameter      | Description                                                                                                                                                                                                                                                                                     |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `apiKey`       | <p>An account API key that used to authorize user API requests. </p><p><strong>Note:</strong>  Required parameter.</p>                                                                                                                                                                          |
| `q`            | <p>The keyword which you want to search. </p><p><strong>Note:</strong>  Required parameter.</p>                                                                                                                                                                                                 |
| `location`     | Location in which the query is executed. You can get a full list of available locations [here](https://spaceserp.gitbook.io/get-started/serp-api#location).                                                                                                                                     |
| `domain`       | <p>Google domain that performs the search. You can find a full list of the available domains <a href="https://spaceserp.gitbook.io/get-started/serp-api#google-domains">here</a>.<br><strong>Note:</strong>  Default value: google.com.</p>                                                     |
| `gl`           | <p>Indicate the country of the Google result page. Full list of the available <code>gl</code>  parameters you can find <a href="https://spaceserp.gitbook.io/get-started/serp-api#google-countries">here</a>.<br><strong>Note:</strong>  Default value : <code>us</code>.</p>                   |
| `hl`           | <p>Specify the interface language for the Google search result page.  Full list of the available <code>hl</code>  parameters you can find <a href="https://spaceserp.gitbook.io/get-started/serp-api#google-languages">here</a>.<br><strong>Note:</strong>  Default value: <code>en</code>.</p> |
| `resultFormat` | <p>Results format. Possible values: <code>json</code>, <code>csv</code>, <code>html.</code> </p><p><strong>Note:</strong>  Default value: <code>json</code>.</p>                                                                                                                                |
| `device`       | <p>The device which performed search requests. Possible values: <code>desktop</code>, <code>mobile</code>, <code>tablet.</code></p><p><strong>Note:</strong>  Default value: <code>desktop</code>.</p>                                                                                          |
| `mobileOs`     | <p>Mobile OS. Possible values: <code>ios</code>, <code>android.</code> </p><p><strong>Note:</strong>  Should be used with <code>device=true</code>.</p>                                                                                                                                         |
| `pageSize`     | The number of results shown per page. **Note:** Should be from 1 to 100.                                                                                                                                                                                                                        |
| `pageNumber`   | Number of the page of results to return.                                                                                                                                                                                                                                                        |

### Location

The `location` parameter is used to localize your query. You can use any string, but for increase accuracy, you should choose supported by Google value. There are several ways to do this:

#### SpaceSerp [API Playground](https://app.spaceserp.com/playground).&#x20;

Just start fill location input and we'll pick up right value for you.&#x20;

<figure><img src="https://1602873078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSAeoiLyXsMVHNndYArij%2Fuploads%2FzKRtzYooBAsEjTqTka1N%2FScreenshot%202022-11-03%20at%2013.00.05.png?alt=media&#x26;token=ee5d5a07-1c46-43de-bde5-c1f4f61aeab8" alt=""><figcaption><p>Location parameter</p></figcaption></figure>

#### Locations Autocomplete  API

## Find related Google locations.

<mark style="color:blue;">`GET`</mark> `https://api.spaceserp.com/google/locations`

#### Query Parameters

| Name                                     | Type   | Description                                                  |
| ---------------------------------------- | ------ | ------------------------------------------------------------ |
| apiKey<mark style="color:red;">\*</mark> | String | An account API key that used to authorize user API requests. |
| q<mark style="color:red;">\*</mark>      | String | Search string                                                |
| pageSize                                 | Number | Default 10                                                   |
| pageNumber                               | String | Default 1                                                    |

{% tabs %}
{% tab title="200: OK List of Google Locations" %}

```javascript
{
  "meta": {
    "pageNumber": 1,
    "pageSize": 10,
    "totalItems": 34,
    "totalPages": 4
  },
  "data": [
    {
      "_id": "62d53be936e0946cea6ae216",
      "criteriaId": 1006886,
      "name": "London",
      "canonicalName": "London,England,United Kingdom",
      "parentId": 20339,
      "countryCode": "GB",
      "targetType": "City",
      "status": "Active"
    },
    {
      "_id": "62d53be936e0946cea6ae217",
      "criteriaId": 1006887,
      "name": "London Colney",
      "canonicalName": "London Colney,England,United Kingdom",
      "parentId": 20339,
      "countryCode": "GB",
      "targetType": "City",
      "status": "Active"
    },
    {
      "_id": "62d53be936e0946cea6ae3a2",
      "criteriaId": 1007284,
      "name": "Londonderry",
      "canonicalName": "Londonderry,Northern Ireland,United Kingdom",
      "parentId": 20341,
      "countryCode": "GB",
      "targetType": "City",
      "status": "Active"
    }
  ]
}
```

{% endtab %}
{% endtabs %}

#### Google domains

You can find a full list of the available domains in CSV file or via [API Playground](https://app.spaceserp.com/playground).

{% file src="<https://1602873078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSAeoiLyXsMVHNndYArij%2Fuploads%2FYQkCs7V3CkeNdLWQKC0n%2FGoogle%20Domains.csv?alt=media&token=393cc5c0-e3aa-4590-9259-c7d620fecf90>" %}
Google domains list
{% endfile %}

#### Google countries

You can find a full list of the available google countries in CSV file or via [API Playground](https://app.spaceserp.com/playground).

{% file src="<https://1602873078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSAeoiLyXsMVHNndYArij%2Fuploads%2FyeZruBHUeJJSBeHPzGsu%2FGoogle%20Countries.csv?alt=media&token=1f41b0cb-6b72-48b9-99cf-5dd49a7f4363>" %}
Google countries list
{% endfile %}

#### Google languages

You can find a full list of the available google languages in CSV file or via [API Playground](https://app.spaceserp.com/playground).

{% file src="<https://1602873078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSAeoiLyXsMVHNndYArij%2Fuploads%2FubL2IIOtbLT64O9LjaZ5%2FGoogle%20Languages.csv?alt=media&token=0b35a449-ad8b-4dc4-ad89-b4290d1fb6a5>" %}
Google language list
{% endfile %}
