# Videos Search

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

```bash
cURL 'https://api.enrich.so/v1/api/videos-search?query=Inspiration&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/videos-search?query=Inspiration&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': 'Inspiration', 'page': 1, 'page_size': 10}
headers = {'accept': 'application/json', 'authorization': 'Bearer <token>'}
resp = requests.get('https://api.enrich.so/v1/api/videos-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/videos-search?query=Inspiration&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/videos-search?query=Inspiration&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/videos-search?query=Inspiration&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": "\"Inspiration\"",
            "type": "videos",
            "page_size": 5,
            "current_page": 3,
            "engine": "bing"
        },
        "result": [
            {
                "title": "Finding Daily Inspiration for a Positive Life",
                "link": "https://www.youtube.com/watch?v=dailyinspiration",
                "snippet": "Learn how to find daily inspiration to keep a positive outlook on life. Simple practices that help transform your mindset.",
                "imageUrl": "https://example.com/images/video1.jpg",
                "duration": "10:15",
                "source": "YouTube",
                "channel": "Positive Vibes",
                "date": "Sep 10, 2023",
                "position": 1
            },
            {
                "title": "Inspiring Stories from Around the World",
                "link": "https://www.youtube.com/watch?v=inspiringstories",
                "snippet": "Heartwarming stories of resilience and hope from people around the globe. This video will inspire and motivate you.",
                "imageUrl": "https://example.com/images/video2.jpg",
                "duration": "15:30",
                "source": "YouTube",
                "channel": "Global Inspiration",
                "date": "Oct 5, 2023",
                "position": 2
            },
            {
                "title": "Creative Inspiration for Artists",
                "link": "https://www.youtube.com/watch?v=artinspiration",
                "snippet": "Explore tips and techniques to spark your creativity as an artist. Perfect for painters, sculptors, and designers.",
                "imageUrl": "https://example.com/images/video3.jpg",
                "duration": "8:20",
                "source": "YouTube",
                "channel": "Artful Living",
                "date": "Jun 12, 2023",
                "position": 3
            },
            {
                "title": "Motivational Speech - Stay Inspired!",
                "link": "https://www.youtube.com/watch?v=motivationspeech",
                "snippet": "A powerful motivational speech to help you stay inspired and achieve your goals. Perfect for mornings or tough days.",
                "imageUrl": "https://example.com/images/video4.jpg",
                "duration": "12:45",
                "source": "YouTube",
                "channel": "Goal Getters",
                "date": "Aug 15, 2023",
                "position": 4
            },
            {
                "title": "Nature as Inspiration - A Visual Journey",
                "link": "https://www.youtube.com/watch?v=naturejourney",
                "snippet": "Take a peaceful journey through the beauty of nature. A visual masterpiece to inspire and relax your mind.",
                "imageUrl": "https://example.com/images/video5.jpg",
                "duration": "20:05",
                "source": "YouTube",
                "channel": "Nature Wonders",
                "date": "Jul 22, 2023",
                "position": 5
            }
        ]
    },
    "total_credits": 120,
    "credits_used": 60.2,
    "credits_remaining": 59.8
}
```

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

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