Search the web
POST /v1/search sends your query to a web search engine (DuckDuckGo) and returns the results as JSON. With scrape it also fetches every result page – as Markdown, text or data – so an agent gets the answer and the sources in one call.
Search
curl https://api.virginproxy.com/v1/search \
-H "Authorization: Bearer $VP_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "web scraping api pricing",
"limit": 5,
"language": "en",
"country": "us"
}'import os, requests
r = requests.post(
"https://api.virginproxy.com/v1/search",
headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
json={
"query": "web scraping api pricing",
"limit": 5,
"language": "en",
"country": "us",
},
timeout=30,
)
data = r.json()
if not r.ok:
raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["results"])
print(data["credits"])const res = await fetch("https://api.virginproxy.com/v1/search", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
query: "web scraping api pricing",
limit: 5,
language: "en",
country: "us",
}),
signal: AbortSignal.timeout(30_000),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error.code + ": " + data.error.message);
console.log(data.results);
console.log(data.credits);from virginproxy import VirginProxy # docs.virginproxy.com/sdk/virginproxy.py
vp = VirginProxy() # reads VP_KEY
data = vp.call("POST", "/v1/search", {
"query": "web scraping api pricing",
"limit": 5,
"language": "en",
"country": "us",
})
print(data)import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs
const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.call("POST", "/v1/search", { body: {
query: "web scraping api pricing",
limit: 5,
language: "en",
country: "us",
} });
console.log(data);<?php
$ch = curl_init("https://api.virginproxy.com/v1/search");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("VP_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"query" => "web scraping api pricing",
"limit" => 5,
"language" => "en",
"country" => "us",
], JSON_UNESCAPED_SLASHES),
]);
$data = json_decode(curl_exec($ch), true);
if (isset($data["error"])) {
exit($data["error"]["code"] . ": " . $data["error"]["message"] . PHP_EOL);
}
echo json_encode($data["results"], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), PHP_EOL;
echo $data["credits"], PHP_EOL;package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"time"
)
func main() {
payload := []byte(`{
"query": "web scraping api pricing",
"limit": 5,
"language": "en",
"country": "us"
}`)
req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/search", bytes.NewReader(payload))
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("VP_KEY"))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 30 * time.Second}
res, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var data map[string]any
if err := json.NewDecoder(res.Body).Decode(&data); err != nil {
log.Fatal(err)
}
if res.StatusCode >= 300 {
e := data["error"].(map[string]any)
log.Fatalf("%v: %v", e["code"], e["message"])
}
fmt.Println(data["results"])
fmt.Println(data["credits"])
}require "json"
require "net/http"
uri = URI("https://api.virginproxy.com/v1/search")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer " + ENV.fetch("VP_KEY")
req["Content-Type"] = "application/json"
req.body = JSON.generate({
"query" => "web scraping api pricing",
"limit" => 5,
"language" => "en",
"country" => "us",
})
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 30) { |http| http.request(req) }
data = JSON.parse(res.body)
abort(data["error"]["code"] + ": " + data["error"]["message"]) unless res.is_a?(Net::HTTPSuccess)
puts JSON.pretty_generate(data["results"])
puts data["credits"]import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"query": "web scraping api pricing",
"limit": 5,
"language": "en",
"country": "us"
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create("https://api.virginproxy.com/v1/search"))
.header("Authorization", "Bearer " + System.getenv("VP_KEY"))
.header("Content-Type", "application/json")
.timeout(Duration.ofSeconds(30))
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
if (res.statusCode() >= 300) {
System.err.println(res.statusCode() + " " + res.body()); // the error object: code, message
System.exit(1);
}
System.out.println(res.body()); // JSON: read it with the JSON library of your choice
}
}using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("VP_KEY"));
var payload = """
{
"query": "web scraping api pricing",
"limit": 5,
"language": "en",
"country": "us"
}
""";
var req = new HttpRequestMessage(HttpMethod.Post, "https://api.virginproxy.com/v1/search");
req.Content = new StringContent(payload, Encoding.UTF8, "application/json");
var res = await http.SendAsync(req);
using var data = JsonDocument.Parse(await res.Content.ReadAsStringAsync());
if (!res.IsSuccessStatusCode)
{
var e = data.RootElement.GetProperty("error");
Console.Error.WriteLine(e.GetProperty("code") + ": " + e.GetProperty("message"));
Environment.Exit(1);
}
Console.WriteLine(data.RootElement.GetProperty("results"));
Console.WriteLine(data.RootElement.GetProperty("credits"));/v1/search{
"query": "web scraping api pricing",
"engine": "duckduckgo",
"results": [
{ "position": 1, "title": "Pricing – Example Scraper", "url": "https://scraper.example/pricing", "snippet": "Plans from $29 a month …" },
{ "position": 2, "title": "Web scraping APIs compared (2026)", "url": "https://blog.example/compare", "snippet": "We tested eight services …", "date": "2026-10-14" }
],
"ads": [],
"related": ["web scraping api free", "best web scraping api"],
"questions": ["How much does a web scraping API cost?"],
"credits": 1,
"requests": ["req_8PqT2nL0aZx4mWcVb7sE"]
}Search and read the results
scrape takes the options of POST /v1/requests without url. true means Markdown of the main content. Each result then has a page with body, format, tokens, status and its credits – or error with the code when that page could not be fetched; the other results are not affected.
curl https://api.virginproxy.com/v1/search \
-H "Authorization: Bearer $VP_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "site:docs.virginproxy.com crawl",
"limit": 3,
"scrape": {
"format": "markdown",
"main_content": true
}
}'import os, requests
r = requests.post(
"https://api.virginproxy.com/v1/search",
headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
json={
"query": "site:docs.virginproxy.com crawl",
"limit": 3,
"scrape": {"format": "markdown", "main_content": True},
},
timeout=30,
)
data = r.json()
if not r.ok:
raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["status"], data["cost"]["credits"])const res = await fetch("https://api.virginproxy.com/v1/search", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
query: "site:docs.virginproxy.com crawl",
limit: 3,
scrape: { format: "markdown", main_content: true },
}),
signal: AbortSignal.timeout(30_000),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error.code + ": " + data.error.message);
console.log(data.status, data.cost.credits);from virginproxy import VirginProxy # docs.virginproxy.com/sdk/virginproxy.py
vp = VirginProxy() # reads VP_KEY
data = vp.call("POST", "/v1/search", {
"query": "site:docs.virginproxy.com crawl",
"limit": 3,
"scrape": {"format": "markdown", "main_content": True},
})
print(data)import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs
const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.call("POST", "/v1/search", { body: {
query: "site:docs.virginproxy.com crawl",
limit: 3,
scrape: { format: "markdown", main_content: true },
} });
console.log(data);<?php
$ch = curl_init("https://api.virginproxy.com/v1/search");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("VP_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"query" => "site:docs.virginproxy.com crawl",
"limit" => 3,
"scrape" => ["format" => "markdown", "main_content" => true],
], JSON_UNESCAPED_SLASHES),
]);
$data = json_decode(curl_exec($ch), true);
if (isset($data["error"])) {
exit($data["error"]["code"] . ": " . $data["error"]["message"] . PHP_EOL);
}
echo $data["status"], " ", $data["cost"]["credits"], PHP_EOL;package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"time"
)
func main() {
payload := []byte(`{
"query": "site:docs.virginproxy.com crawl",
"limit": 3,
"scrape": {
"format": "markdown",
"main_content": true
}
}`)
req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/search", bytes.NewReader(payload))
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("VP_KEY"))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 30 * time.Second}
res, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var data map[string]any
if err := json.NewDecoder(res.Body).Decode(&data); err != nil {
log.Fatal(err)
}
if res.StatusCode >= 300 {
e := data["error"].(map[string]any)
log.Fatalf("%v: %v", e["code"], e["message"])
}
fmt.Println(data["status"], data["cost"].(map[string]any)["credits"])
}require "json"
require "net/http"
uri = URI("https://api.virginproxy.com/v1/search")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer " + ENV.fetch("VP_KEY")
req["Content-Type"] = "application/json"
req.body = JSON.generate({
"query" => "site:docs.virginproxy.com crawl",
"limit" => 3,
"scrape" => { "format" => "markdown", "main_content" => true },
})
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 30) { |http| http.request(req) }
data = JSON.parse(res.body)
abort(data["error"]["code"] + ": " + data["error"]["message"]) unless res.is_a?(Net::HTTPSuccess)
puts [data["status"], data["cost"]["credits"]].join(" ")import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"query": "site:docs.virginproxy.com crawl",
"limit": 3,
"scrape": {
"format": "markdown",
"main_content": true
}
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create("https://api.virginproxy.com/v1/search"))
.header("Authorization", "Bearer " + System.getenv("VP_KEY"))
.header("Content-Type", "application/json")
.timeout(Duration.ofSeconds(30))
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
if (res.statusCode() >= 300) {
System.err.println(res.statusCode() + " " + res.body()); // the error object: code, message
System.exit(1);
}
System.out.println(res.body()); // JSON: read it with the JSON library of your choice
}
}using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("VP_KEY"));
var payload = """
{
"query": "site:docs.virginproxy.com crawl",
"limit": 3,
"scrape": {
"format": "markdown",
"main_content": true
}
}
""";
var req = new HttpRequestMessage(HttpMethod.Post, "https://api.virginproxy.com/v1/search");
req.Content = new StringContent(payload, Encoding.UTF8, "application/json");
var res = await http.SendAsync(req);
using var data = JsonDocument.Parse(await res.Content.ReadAsStringAsync());
if (!res.IsSuccessStatusCode)
{
var e = data.RootElement.GetProperty("error");
Console.Error.WriteLine(e.GetProperty("code") + ": " + e.GetProperty("message"));
Environment.Exit(1);
}
Console.WriteLine(data.RootElement.GetProperty("status") + " " + data.RootElement.GetProperty("cost").GetProperty("credits"));/v1/searchOptions
| Field | Default | Meaning |
|---|---|---|
query | required | 1 to 400 characters. The engine's operators work: quotes, site:, -word. |
engine | "duckduckgo" | duckduckgo. Further engines are described in the member guides. |
limit | 10 | 1 to 50 results. Up to 5 result pages are read to reach it. |
language | "en" | Language of the results, e.g. de or pt-BR. |
country | – | Two letters, e.g. us: the country the engine picks results for. It is a search setting – it does not change where the request comes from. |
time_range | – | day, week, month, year: only results from this period. |
include_domains | – | Up to 20 domains: only results from them (subdomains included). |
exclude_domains | – | Up to 20 domains: no results from them. |
scrape | – | true or the options of a request: also fetch every result. |
max_credits | – | 1 to 10,000: cap for the whole call, fetched results included. Results not fetched any more get "error": "budget_exhausted". |
tag | – | Your tag; every request of the call is in your log with it. |
What it costs
Every result page of the engine and every fetched result is an ordinary request in your request log and costs what a request costs – usually 1 credit each. A search is mostly 1 credit. With scrape add about 1 credit per fetched result. credits is the sum, requests lists every request.
Each result has its real address in url; display_url is the address as the engine shows it, when it does.
When the engine sends no page that can be read, the call fails with search_failed (424): the page that came is charged like any request, and error.credits says how much. Retry a little later.
Tip
In the MCP server this is the tool search: an AI agent can search, read the sources and quote them – in one tool call.
Test keys
With a test key you get sample results that keep to your options (limit, domains), nothing is fetched and nothing charged.
Was this page helpful?
Last updated