# Image Search

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

```bash
cURL 'https://api.enrich.so/v1/api/image-search?query=Inspire&page=1&page_size=10' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json'
```

{% endtab %}

{% tab title="Javascript" %}

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

axios.get('https://api.enrich.so/v1/api/image-search?query=Inspire&page=1&page_size=10', {
    headers: {accept: 'application/json', Authorization: 'Bearer <token>'}
})
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.log(error);
  });// Some code
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
payload = {'query': 'Inspire', 'page': 1, 'page_size': 10}
headers = {'accept': 'application/json', 'authorization': 'Bearer <token>'}
resp = requests.get('https://api.enrich.so/v1/api/image-search', params=payload, headers=headers)
print (resp.text)
```

{% endtab %}

{% tab title="Java" %}

```java
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.enrich.so/v1/api/image-search?query=Inspire&page=1&page_size=10")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("authorization", "Bearer <token>")
  .build();

Response response = client.newCall(request).execute();
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.enrich.so/v1/api/image-search?query=Inspire&page=1&page_size=10")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

{% endtab %}

{% tab title="Php" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.enrich.so/v1/api/image-search?query=Inspire&page=1&page_size=10",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "accept: application/json",
    "authorization: Bearer <token>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

{% endtab %}
{% endtabs %}

## Example response

#### Status Code: <mark style="color:green;">200 OK</mark>

```json
{
    "success": true,
    "message": "Search successfully executed.",
    "data": {
        "request_parameters": {
            "query": "\"Inspire\"",
            "type": "images",
            "page_size": 10,
            "current_page": 0,
            "engine": "bing"
        },
        "result": [
            {
                "title": "Inspire Creativity - Art & Design",
                "imageUrl": "https://example.com/images/inspire-creativity.jpg",
                "imageWidth": 1200,
                "imageHeight": 800,
                "thumbnailUrl": "https://example.com/thumbnails/inspire-creativity-thumb.jpg",
                "thumbnailWidth": 300,
                "thumbnailHeight": 200,
                "source": "Creative Minds",
                "domain": "creativeminds.com",
                "link": "https://creativeminds.com/inspire-creativity",
                "googleUrl": "https://www.google.com/imgres?imgurl=https://example.com/images/inspire-creativity.jpg",
                "position": 1
            },
            {
                "title": "Inspirational Quotes Collection",
                "imageUrl": "https://example.com/images/quotes-collection.jpg",
                "imageWidth": 1024,
                "imageHeight": 768,
                "thumbnailUrl": "https://example.com/thumbnails/quotes-collection-thumb.jpg",
                "thumbnailWidth": 300,
                "thumbnailHeight": 225,
                "source": "QuoteHub",
                "domain": "quotehub.com",
                "link": "https://quotehub.com/inspirational-quotes",
                "googleUrl": "https://www.google.com/imgres?imgurl=https://example.com/images/quotes-collection.jpg",
                "position": 2
            },
            {
                "title": "Inspire Learning - Education for All",
                "imageUrl": "https://example.com/images/inspire-learning.jpg",
                "imageWidth": 1280,
                "imageHeight": 720,
                "thumbnailUrl": "https://example.com/thumbnails/inspire-learning-thumb.jpg",
                "thumbnailWidth": 300,
                "thumbnailHeight": 168,
                "source": "Inspire Learn",
                "domain": "inspirelearn.com",
                "link": "https://inspirelearn.com/education",
                "googleUrl": "https://www.google.com/imgres?imgurl=https://example.com/images/inspire-learning.jpg",
                "position": 3
            },
            {
                "title": "Inspiring Nature Scenery",
                "imageUrl": "https://example.com/images/nature-scenery.jpg",
                "imageWidth": 1920,
                "imageHeight": 1080,
                "thumbnailUrl": "https://example.com/thumbnails/nature-scenery-thumb.jpg",
                "thumbnailWidth": 300,
                "thumbnailHeight": 169,
                "source": "Nature Shots",
                "domain": "natureshots.com",
                "link": "https://natureshots.com/scenery",
                "googleUrl": "https://www.google.com/imgres?imgurl=https://example.com/images/nature-scenery.jpg",
                "position": 4
            },
            {
                "title": "Fitness Motivation - Inspire Yourself",
                "imageUrl": "https://example.com/images/fitness-motivation.jpg",
                "imageWidth": 1080,
                "imageHeight": 720,
                "thumbnailUrl": "https://example.com/thumbnails/fitness-motivation-thumb.jpg",
                "thumbnailWidth": 300,
                "thumbnailHeight": 200,
                "source": "FitLife",
                "domain": "fitlife.com",
                "link": "https://fitlife.com/motivation",
                "googleUrl": "https://www.google.com/imgres?imgurl=https://example.com/images/fitness-motivation.jpg",
                "position": 5
            },
            {
                "title": "Inspire Travel - Beautiful Destinations",
                "imageUrl": "https://example.com/images/travel-destinations.jpg",
                "imageWidth": 1600,
                "imageHeight": 900,
                "thumbnailUrl": "https://example.com/thumbnails/travel-destinations-thumb.jpg",
                "thumbnailWidth": 300,
                "thumbnailHeight": 168,
                "source": "TravelMore",
                "domain": "travelmore.com",
                "link": "https://travelmore.com/destinations",
                "googleUrl": "https://www.google.com/imgres?imgurl=https://example.com/images/travel-destinations.jpg",
                "position": 6
            },
            {
                "title": "Inspire Art Gallery",
                "imageUrl": "https://example.com/images/art-gallery.jpg",
                "imageWidth": 800,
                "imageHeight": 600,
                "thumbnailUrl": "https://example.com/thumbnails/art-gallery-thumb.jpg",
                "thumbnailWidth": 300,
                "thumbnailHeight": 225,
                "source": "ArtDaily",
                "domain": "artdaily.com",
                "link": "https://artdaily.com/gallery",
                "googleUrl": "https://www.google.com/imgres?imgurl=https://example.com/images/art-gallery.jpg",
                "position": 7
            },
            {
                "title": "Inspire Photography - Capturing Life",
                "imageUrl": "https://example.com/images/photography.jpg",
                "imageWidth": 1440,
                "imageHeight": 960,
                "thumbnailUrl": "https://example.com/thumbnails/photography-thumb.jpg",
                "thumbnailWidth": 300,
                "thumbnailHeight": 200,
                "source": "PhotoWorld",
                "domain": "photoworld.com",
                "link": "https://photoworld.com/gallery",
                "googleUrl": "https://www.google.com/imgres?imgurl=https://example.com/images/photography.jpg",
                "position": 8
            },
            {
                "title": "Inspire Innovations - Technology and Creativity",
                "imageUrl": "https://example.com/images/innovations.jpg",
                "imageWidth": 1024,
                "imageHeight": 768,
                "thumbnailUrl": "https://example.com/thumbnails/innovations-thumb.jpg",
                "thumbnailWidth": 300,
                "thumbnailHeight": 225,
                "source": "TechToday",
                "domain": "techtoday.com",
                "link": "https://techtoday.com/innovations",
                "googleUrl": "https://www.google.com/imgres?imgurl=https://example.com/images/innovations.jpg",
                "position": 9
            },
            {
                "title": "Inspire Home Decor - Modern Living",
                "imageUrl": "https://example.com/images/home-decor.jpg",
                "imageWidth": 960,
                "imageHeight": 720,
                "thumbnailUrl": "https://example.com/thumbnails/home-decor-thumb.jpg",
                "thumbnailWidth": 300,
                "thumbnailHeight": 200,
                "source": "HomeStyle",
                "domain": "homestyle.com",
                "link": "https://homestyle.com/decor",
                "googleUrl": "https://www.google.com/imgres?imgurl=https://example.com/images/home-decor.jpg",
                "position": 10
            }
        ]
    },
    "total_credits": 100,
    "credits_used": 54.3,
    "credits_remaining": 45.7
}
```

#### Status code: <mark style="color:red;">404 NOT FOUND</mark>

```json
{
    "message": "We couldn't find the results for this query"
}
```
