# Google Images API

Here is the list of default parameters for this API :\ <br>

<table><thead><tr><th align="center">Parameters</th><th width="362.1479234717686" align="center">Description</th></tr></thead><tbody><tr><td align="center">api_key<br><br><mark style="color:red;">required</mark></td><td align="center">This is your API key.</td></tr><tr><td align="center">q<br><br><mark style="color:red;">required</mark></td><td align="center"><p>Type: <code>String</code></p><p><br>Google Search Query</p></td></tr><tr><td align="center">gl</td><td align="center"><p>Type: <code>String</code><br></p><p>Default: <code>"us"</code><br>  Name of the country. The name should be in <a href="https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes">ISO 3166 Alpha-2</a> format.</p></td></tr><tr><td align="center">domain</td><td align="center"><p>Type: <code>String</code></p><p><br>Default: <code>"google.com"</code> To obtain local results from a specific country, for example, for India, it will be "google.co.in," and for the UK, it will be "google.co.uk."</p></td></tr><tr><td align="center">hl</td><td align="center">Type: <code>String</code><br><br>Default: <code>"en_us"</code><br>The language of the requested results.</td></tr><tr><td align="center">ijn</td><td align="center">Type: <code>Number(Integer)</code><br><code>[0,1,2....]</code><br><br>Default: <code>0</code><br>(Enter 1 for 2nd-page results, 2 for 3rd, etc .)<br>The page number to get targeted search results.</td></tr><tr><td align="center">lr</td><td align="center">Type: <code>String</code><br><br>Limit the search to one or multiple languages.<br>It is used as <mark style="color:red;"><code>lang_{language code}</code></mark><em>.</em> For example <em>- "</em>lang_us".</td></tr><tr><td align="center">uule</td><td align="center">Type: <code>String</code><br><br>Used to encode a place an exact location(with latitude and longitude) into a value used in a cookie, an URL, or an HTTP header.</td></tr><tr><td align="center">duration</td><td align="center"><p>Type: <code>String</code><br><br>Use this as <code>"d/w/m/mn/y"</code><br>where n is from <code>0-10</code>.</p><p><mark style="color:red;"><code>d</code></mark> - the previous 24 hours,  <mark style="color:red;"><code>w</code></mark> - the previous seven days, <mark style="color:red;"><code>m</code></mark> - the previous month, <mark style="color:red;"><code>mn</code></mark> - the previous n number of months, <mark style="color:red;"><code>y</code></mark> - past year</p><p><br>The <code>duration</code> parameter requests search results from a specified time period (quick date range).</p></td></tr><tr><td align="center">nfpr</td><td align="center"><p>Type: <code>Boolean</code></p><p><br>Default: <code>0</code><br>It excludes the result from an auto-corrected query that is spelled wrong. It can be set to <mark style="color:red;"><code>1</code></mark> to exclude these results or <mark style="color:red;"><code>0</code></mark> to include them.</p></td></tr><tr><td align="center">tbs</td><td align="center">Type: <code>String</code><br><br>to be searched - An advanced parameter to filter search results. </td></tr><tr><td align="center">chips</td><td align="center">Type: <code>String</code><br><br>Used to filter image results. They are provided under the section <mark style="color:red;"><code>suggested_searches</code></mark> when <mark style="color:red;"><code>ijn = 0</code></mark>.</td></tr><tr><td align="center">safe</td><td align="center"><p>Type: String<br><code>[active/off]</code><br></p><p>Default: <code>off</code><br>To filter the adult content set <code>safe</code> to <mark style="color:red;"><code>active</code></mark> or to disable it set it <mark style="color:red;"><code>off</code></mark>.</p></td></tr><tr><td align="center">html</td><td align="center">Type: <code>Boolean</code><br><br>Default: <code>false</code><br>To render response as raw HTML.</td></tr></tbody></table>

### Some relevant tbs parameters for the Google Images API

|               TBS               |                                                                                                                                                          Parameters                                                                                                                                                         |
| :-----------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|               Size              | <p><code>tbs = size:l</code><br><mark style="color:red;"><code>l</code></mark> - for large-sized images<br><code>tbs = size:m</code><br><mark style="color:red;"><code>m</code></mark> - for medium-sized images<br><code>tbs = size:i</code><br><mark style="color:red;"><code>i</code></mark> - for icon-sized images</p> |
|     Images of specific color    |                                                                                          <p><code>tbs=ic:specific,isc:color</code><br><br>color = \[orange, yellow, green, teal, blue, purple, pink, white, gray, black, brown]</p>                                                                                         |
| Creative Common licenses images |                                                                                                                                                         `tbs=il:cl`                                                                                                                                                         |
|  Commercial and other licenses  |                                                                                                                                                         `tbs=il:ol`                                                                                                                                                         |

### API Example:

{% tabs %}
{% tab title="cURL" %}

```json
cURL "https://api.serpdog.io/images?api_key=APIKEY&q=football&gl=us"
```

{% endtab %}

{% tab title="Node JS" %}

```javascript
const axios = require('axios');

axios.get('https://api.serpdog.io/images?api_key=APIKEY&q=football&gl=us')
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.log(error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
payload = {'api_key': 'APIKEY', 'q':'football', 'gl' : 'us'}
resp = requests.get('https://api.scrapingdog.io/google', params=payload)
print (resp.text)
```

{% endtab %}

{% tab title="Java" %}

```java
try {
 String apiKey = "APIKEY";
 String url = "https://api.serpdog.io/images?api_key=APIKEY&q=football&gl=us";
 URL urlForGetRequest = new URL(url);
 String readLine = null;
 HttpURLConnection conection = (HttpURLConnection) urlForGetRequest.openConnection();
 conection.setRequestMethod("GET");
 int responseCode = conection.getResponseCode();
 if (responseCode == HttpURLConnection.HTTP_OK) {
 BufferedReader in = new BufferedReader(new InputStreamReader(conection.getInputStream()));
 StringBuffer response = new StringBuffer();
 while ((readLine = in.readLine()) != null) {
 response.append(readLine);
 }
 in.close();
 System.out.println(response.toString());
} else {
 throw new Exception("Error in API Call");
 }
} catch (Exception ex) {
 ex.printStackTrace();
}
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'json'
params = {
 :api_key => "APIKEY",
 :q => "football",
 :gl => "us"
}
uri = URI('https://api.serpdog.io/images')
uri.query = URI.encode_www_form(params)
website_content = Net::HTTP.get(uri)
print(website_content)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$url = "https://api.serpdog.io/images?api_key=APIKEY&q=footbal&gl=us";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
```

{% endtab %}
{% endtabs %}

```json

{
    "meta": {
      "api_key": "APIKEY",
      "q": "football",
      "gl": "us"
    },
    "image_results": [
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS_Tu78LWxIu_M_sN_kMfj2guqIbu2VcSLyI84CQGbuFRIyTCVR&s",
        "title": "Football - Wikipedia",
        "source": "en.wikipedia.org",
        "link": "https://en.wikipedia.org/wiki/Football",
        "original": "https://upload.wikimedia.org/wikipedia/commons/b/b9/Football_iu_1996.jpg",
        "rank": 1
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTxvsz_pjLnFyCnYyCxxY5rSHQCHjNJyYGFZqhQUtTm0XOzOWw&s",
        "title": "Soft toy, American football/brown - IKEA",
        "source": "www.ikea.com · In stock",
        "link": "https://www.ikea.com/us/en/p/oenskad-soft-toy-american-football-brown-90506769/",
        "original": "https://www.ikea.com/us/en/images/products/oenskad-soft-toy-american-football-brown__0982285_pe815602_s5.jpg",
        "rank": 2
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTNJYuYBLrUxLrXkbnP18Y6DEgKf_H4HYGCzecsGRAoFtkiGEM&s",
        "title": "NFL postpones three games due to Covid ...",
        "source": "www.cnbc.com",
        "link": "https://www.cnbc.com/2021/12/17/nfl-will-postpone-some-games-over-covid-surge-source-says.html",
        "original": "https://image.cnbcfm.com/api/v1/image/106991253-1639786378304-GettyImages-1185558312r.jpg?v=1639786403",
        "rank": 3
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTg4WJ88A83JqXwGXsWtiB5qSoHrU_RukbrfXdkWggEKMsJ5Ro1&s",
        "title": "USFL schedule Week 2: What football ...",
        "source": "www.sportingnews.com",
        "link": "https://www.sportingnews.com/us/nfl/news/usfl-schedule-week-2-football-tv-channels-times-scores/oadvrtsc5vn9l4knu8hvnpo0",
        "original": "https://library.sportingnews.com/2022-04/usfl-football-042122-getty-ftr.jpg",
        "rank": 4
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTsOPQ2-nzsTrdRK1HHXIqB-x96yuiPg7pwfJsm8mToVlw5-UaM&s",
        "title": "Why is football called 'football'?",
        "source": "www.newsnationnow.com",
        "link": "https://www.newsnationnow.com/us-news/hold-why-is-football-called-football/",
        "original": "https://www.newsnationnow.com/wp-content/uploads/sites/108/2022/02/FootballGettyImages-78457130.jpg?w=1280",
        "rank": 5
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS0WimlY0Nykjy8k5An6k4wViDvyVZzo_0K1MSZNZcwDFGsugNW&s",
        "title": "The Duke NFL Football | Wilson Sporting ...",
        "source": "www.wilson.com · In stock",
        "link": "https://www.wilson.com/en-gb/product/the-duke-nfl-football-wf10011",
        "original": "https://www.wilson.com/en-gb/media/catalog/product/b/c/bc340309-c2a3-441d-ac36-a26187fd94f0_yceho2py9sgzklxk.png",
        "rank": 6
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ6ZuMtA_I4WZZKXPhiqMpIHsdKJX-SVkcN2yo1KAQ9SQuxdCI&s",
        "title": "National Football League",
        "source": "www.nfl.com",
        "link": "https://www.nfl.com/",
        "original": "https://static.www.nfl.com/image/private/t_editorial_landscape_mobile/f_auto/league/iaesayubxpbxmbxfwm3b.jpg",
        "rank": 7
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTBsiF6SkhqAc0yJt-uNXVPpo8bvS-cgcnv6NbXGGJf6DuvH0A&s",
        "title": "Who Invented (American) Football - HISTORY",
        "source": "www.history.com",
        "link": "https://www.history.com/news/who-invented-football",
        "original": "https://www.history.com/.image/ar_4:3%2Cc_fill%2Ccs_srgb%2Cfl_progressive%2Cq_auto:good%2Cw_1200/MTgyODAxOTQ1NzM4NjE4Mjc1/whoinventedfootball.jpg",
        "rank": 8
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8xdCSnDPsO1wgzP55WJW3EgsTaA03snLx87YZH7vH1tftK973&s",
        "title": "NCAA Football - College Football News ...",
        "source": "www.cbssports.com",
        "link": "https://www.cbssports.com/college-football/",
        "original": "https://sportshub.cbsistatic.com/i/r/2022/06/23/1d4d3695-76d3-4ec4-900a-c95a21ee6736/thumbnail/450x253/f9e52fd2041021143dec867fce61ff8b/quinn-ewers-ut-spring-getty.jpg",
        "rank": 9
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRYoOyUNPtfEHupSubUij7_88Tj-FD0slK2WJGANAP0igxgaGc&s",
        "title": "Football | Videos | Watch ESPN",
        "source": "www.espn.com",
        "link": "https://www.espn.com/watch/catalog/60459870-f8fc-3b3a-a6b9-d8af4bf19223/football",
        "original": "https://artwork.espncdn.com/categories/60459870-f8fc-3b3a-a6b9-d8af4bf19223/1x1Feature/1440_201903062025.jpg",
        "rank": 10
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQgFBkr-DEdsMCBGRhKuBjqOVMjzn33MIARq_f2I-VnpjC5hRA&s",
        "title": "Olympic flag football ...",
        "source": "olympics.nbcsports.com",
        "link": "https://olympics.nbcsports.com/2022/04/05/flag-football-olympics-nfl/",
        "original": "https://olympics.nbcsports.com/wp-content/uploads/sites/10/2022/04/GettyImages-1237679853-e1649181927440.jpg?w=811",
        "rank": 11
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR_ID5wsyiMn-hrORJBFJ3tC4ZqDt1TGPUekV7SF9CfoGi8f9N3&s",
        "title": "Call Football “Soccer”? | Britannica",
        "source": "www.britannica.com",
        "link": "https://www.britannica.com/story/why-do-some-people-call-football-soccer",
        "original": "https://cdn.britannica.com/51/190751-050-147B93F7/soccer-ball-goal.jpg?q=60",
        "rank": 12
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT87bnoeOqGX_yt5XI4K2T88zAN3QOHlFZggNgSK0xMcrM683ae&s",
        "title": "Football - News, Athletes, Highlights ...",
        "source": "olympics.com",
        "link": "https://olympics.com/en/sports/football/",
        "original": "https://img.olympicchannel.com/images/image/private/t_social_share_thumb/f_auto/primary/qjxgsf7pqdmyqzsptxju",
        "rank": 13
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSM4FRwtIQRJUVeS7DZl_Lhihi4H_64esiFnJSHwBGwuS3_Gtqc&s",
        "title": "Contenders for 2022 College Football ...",
        "source": "bleacherreport.com",
        "link": "https://bleacherreport.com/articles/2956222-buying-or-selling-top-contenders-for-2022-college-football-playoff",
        "original": "https://img.bleacherreport.net/img/slides/photos/004/518/828/512481ab6d70f9d3660891e778786d86_crop_exact.jpg?w=2975&h=2048&q=85",
        "rank": 14
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRXWTpsr6MX9r1w7CUAfa3Ewfh8uvUDMuN9uAGz0NMkhOU5htk&s",
        "title": "College football rankings 2022: Alabama ...",
        "source": "www.sportingnews.com",
        "link": "https://www.sportingnews.com/us/ncaa-division-i-fbs/news/college-football-rankings-top-25-alabama-ohio-state/hvqw0stg7d4jvimndjuf6ip2",
        "original": "https://library.sportingnews.com/2021-12/bryce-young-120421-getty-ftr_1q4nq494zev631bgr3qbc1zvap.jpg",
        "rank": 15
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQuvr-VyKe5QAP5QspJh5fuI-rn5M_wVwJQt6uzE6GqN746-8qb&s",
        "title": "National Football League - HISTORY",
        "source": "www.history.com",
        "link": "https://www.history.com/news/the-birth-of-the-national-football-league",
        "original": "https://www.history.com/.image/ar_4:3%2Cc_fill%2Ccs_srgb%2Cfl_progressive%2Cq_auto:good%2Cw_1200/MTU3ODc4NjAwMDI2ODkxNTkz/the-nfl-begins-football-grass-2014-hero-2.jpg",
        "rank": 16
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTrb7Br2V9vL9dS0cKP2gMvpVl_JQ_oR-HwvclzFJbDnVUf6685&s",
        "title": "File:Football (soccer ball).svg - Wikipedia",
        "source": "en.wikipedia.org",
        "link": "https://en.wikipedia.org/wiki/File:Football_(soccer_ball).svg",
        "original": "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Football_%28soccer_ball%29.svg/1928px-Football_%28soccer_ball%29.svg.png",
        "rank": 17
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ7OnRj5tm8V9jeP50bJxvnDeA91FOanwppImIQ-z-nFN01p5El&s",
        "title": "NCAA football: College players could ...",
        "source": "sports.yahoo.com",
        "link": "https://sports.yahoo.com/could-hundreds-of-college-football-players-be-left-stranded-by-ncaa-apathy-014322627.html",
        "original": "https://s.yimg.com/os/creatr-uploaded-images/2020-12/e3514670-3fbf-11eb-b67f-efeaa313555f",
        "rank": 18
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ3jIzJvWYzX9cl4nIHyCIL5Fe_lbKo1ChNzNV6HZtsudkiTZX_&s",
        "title": "Concerns raised over how football clubs ...",
        "source": "www.theguardian.com",
        "link": "https://www.theguardian.com/football/2021/jul/28/major-heading-restrictions-agreed-for-english-football-at-all-levels-from-this-season",
        "original": "https://i.guim.co.uk/img/media/1388397fc76bf11b35cbebe73e18f9098b58ef58/0_0_3878_2327/master/3878.jpg?width=1200&quality=85&auto=format&fit=max&s=8724b4198ece7b3b0f71cdfa0cbb11cb",
        "rank": 19
      },
      {
        "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTHr10vi61VGARt5FCndZ1xOpgRFpG_WOvALQdJfWQQ8a_c7jpT&s",
        "title": "Virtual reality football video game ...",
        "source": "sportsnaut.com",
        "link": "https://sportsnaut.com/virtual-reality-football-video-game-nfl-licensing/",
        "original": "https://sportsnaut.com/wp-content/uploads/2022/04/generic-football-18139090-scaled.jpg",
        "rank": 20
      },
    ]
  }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.serpdog.io/google-images-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
