Search API
curl --request GET \
--url https://api.example.com/api/v1/searchimport requests
url = "https://api.example.com/api/v1/search"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/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://api.example.com/api/v1/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.example.com/api/v1/search"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/search")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"query": "<string>",
"results": [
{
"title": "<string>",
"snippet": "<string>",
"url": "<string>",
"published_date": "<string>",
"domain": "<string>"
}
],
"summary": "<string>",
"result_count": 123
}API Reference
Search API
Search the web with multiple providers and get structured results
GET
/
api
/
v1
/
search
Search API
curl --request GET \
--url https://api.example.com/api/v1/searchimport requests
url = "https://api.example.com/api/v1/search"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/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://api.example.com/api/v1/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.example.com/api/v1/search"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/search")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"query": "<string>",
"results": [
{
"title": "<string>",
"snippet": "<string>",
"url": "<string>",
"published_date": "<string>",
"domain": "<string>"
}
],
"summary": "<string>",
"result_count": 123
}The search endpoint returns formatted results from external search providers like Google, Bing, and DuckDuckGo.
Query Parameters
string
required
The search query string
number
default:"5"
Number of results to return (1-10)
string
default:"google"
Search provider to use (google, bing, duckduckgo)
boolean
default:"false"
Generate an AI summary of the search results
string
ISO language code (e.g., ‘en’, ‘fr’)
string
Country code (e.g., ‘us’, ‘gb’)
string
Search topic category (general, news, images, videos, finance)
boolean
default:"false"
Whether to enhance DuckDuckGo results with Selenium (only applies to
DuckDuckGo provider)
string
Start date for published content (YYYY-MM-DD)
string
End date for published content (YYYY-MM-DD)
string[]
Domains to include in search results
string[]
Domains to exclude from search results
Response
string
The search query that was processed
SearchResult[]
string
Optional LLM-generated summary of results (only if summarize=true)
number
Number of results returned
TypeScript Example
import { client } from "@agent-toolkit/client-ts";
import type { SearchResponse } from "@agent-toolkit/client-ts";
// Configure the client
client.setConfig({
baseUrl: "https://api.agenttoolkit.ai",
headers: {
"Content-Type": "application/json",
"X-API-Key": "your-api-key",
},
});
// Perform a search
const response = await client.get<SearchResponse>({
url: "/api/v1/search",
query: {
query: "typescript openapi client",
max_results: 5,
provider: "google",
summarize: true,
},
});
// Display results
console.log("Search Results:");
response.data.results.forEach((result, i) => {
console.log(`\n${i + 1}. ${result.title}`);
console.log(` URL: ${result.url}`);
console.log(` ${result.snippet}`);
});
// Access the AI-generated summary
if (response.data.summary) {
console.log(`\nSummary: ${response.data.summary}`);
}
Was this page helpful?
⌘I