curl --request GET \
--url https://ydc-index.io/search \
--header 'X-API-Key: <api-key>'import requests
url = "https://ydc-index.io/search"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://ydc-index.io/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://ydc-index.io/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://ydc-index.io/search"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://ydc-index.io/search")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://ydc-index.io/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"hits": [
{
"url": "https://you.com",
"title": "The World's Greatest Search Engine!",
"description": "Search on YDC",
"favicon_url": "https://someurl.com/favicon",
"thumbnail_url": "https://www.somethumbnailsite.com/thumbnail.jpg",
"snippets": [
"I'm an AI assistant that helps you get more done. What can I help you with?"
]
}
],
"latency": 1
}Search (Legacy)
curl --request GET \
--url https://ydc-index.io/search \
--header 'X-API-Key: <api-key>'import requests
url = "https://ydc-index.io/search"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://ydc-index.io/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://ydc-index.io/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://ydc-index.io/search"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://ydc-index.io/search")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://ydc-index.io/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"hits": [
{
"url": "https://you.com",
"title": "The World's Greatest Search Engine!",
"description": "Search on YDC",
"favicon_url": "https://someurl.com/favicon",
"thumbnail_url": "https://www.somethumbnailsite.com/thumbnail.jpg",
"snippets": [
"I'm an AI assistant that helps you get more done. What can I help you with?"
]
}
],
"latency": 1
}Search Operators
| Operator | Description | Example |
|---|---|---|
| site | Searches for webpages from a particular domain (including subdomains) | site:uscourts.gov USA v. Enron |
| filetype | Searches for webpages that are of the specified file type | USA v. Enron filetype:pdf |
| lang | Searches for webpages that are in a particular language (ISO 639-1 format) | Modelo lang:es |
| + | Searches for webpages that contain the exact term after the + | Enron +GAAP |
| - | Searches for webpages that do not contain the exact term after the - | guitar -prs |
| AND | Logical operator to combine expressions | guitar +prs AND +silversky |
| OR | Logical operator to combine expressions | guitar -prs AND -silversky |
| NOT | Negation of expressions | USA v. Enron NOT site:uscourts.gov |
Authorizations
The unique API Key required to authorize API access. Learn how to get yours in the “Get your API key” section of the documentation.
Query Parameters
Search query used to retrieve relevant results from index. You may also include search operators to refine your search.
Specifies the maximum number of web results to return. Range 1 ≤ num_web_results ≤ 100.
Specifies the freshness of the results to return. Provide either one of day, week, month, year, or a date range string in the format YYYY-MM-DDtoYYYY-MM-DD.
Indicates the offset for pagination. The offset is calculated in multiples of num_web_results. For example, if num_web_results = 5 and offset = 1, results 5–10 will be returned. Range 0 ≤ offset ≤ 9.
Country Code, one of ['AR', 'AU', 'AT', 'BE', 'BR', 'CA', 'CL', 'DK', 'FI', 'FR', 'DE', 'HK', 'IN', 'ID', 'IT', 'JP', 'KR', 'MY', 'MX', 'NL', 'NZ', 'NO', 'CN', 'PL', 'PT', 'PH', 'RU', 'SA', 'ZA', 'ES', 'SE', 'CH', 'TW', 'TR', 'GB', 'US'].
Configures the safesearch filter for content moderation. off - no filtering applied.moderate - moderate content filtering (default). strict - strict content filtering.