Test mode
A test key (vp_test_…) works like a live key, but every call gets a realistic sample answer instead of fetching the page. Your options are checked for real, the limits of your plan apply, errors look exactly as they will in production – and nothing is ever charged.
Get a test key
Create one in the dashboard under API keys (choose “Test key”), or through the API with a live key:
curl https://api.virginproxy.com/v1/keys \
-H "Authorization: Bearer $VP_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "local development",
"mode": "test"
}'import os, requests
r = requests.post(
"https://api.virginproxy.com/v1/keys",
headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
json={"name": "local development", "mode": "test"},
timeout=30,
)
data = r.json()
if not r.ok:
raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["key"])const res = await fetch("https://api.virginproxy.com/v1/keys", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ name: "local development", mode: "test" }),
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.key);from virginproxy import VirginProxy # docs.virginproxy.com/sdk/virginproxy.py
vp = VirginProxy() # reads VP_KEY
data = vp.call("POST", "/v1/keys", {"name": "local development", "mode": "test"})
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/keys", { body: { name: "local development", mode: "test" } });
console.log(data);<?php
$ch = curl_init("https://api.virginproxy.com/v1/keys");
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(["name" => "local development", "mode" => "test"], 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["key"], PHP_EOL;package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"time"
)
func main() {
payload := []byte(`{
"name": "local development",
"mode": "test"
}`)
req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/keys", 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["key"])
}require "json"
require "net/http"
uri = URI("https://api.virginproxy.com/v1/keys")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer " + ENV.fetch("VP_KEY")
req["Content-Type"] = "application/json"
req.body = JSON.generate({ "name" => "local development", "mode" => "test" })
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["key"]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 = """
{
"name": "local development",
"mode": "test"
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create("https://api.virginproxy.com/v1/keys"))
.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 = """
{
"name": "local development",
"mode": "test"
}
""";
var req = new HttpRequestMessage(HttpMethod.Post, "https://api.virginproxy.com/v1/keys");
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("key"));/v1/keysUse it everywhere a live key goes: Authorization: Bearer vp_test_…. Switching to production is changing the key, nothing else.
What you get
{
"id": "req_V3nQ8xLp2KdW7sTm0RcY",
"status": 200,
"final_url": "https://shop.example/products/1",
"format": "markdown",
"body": "# Trail Runner 2\n\nThis is a sample answer of the VirginProxy test mode. …",
"extracted": { "price": 129 },
"exit": { "ip": "203.0.113.10", "country": "DE" },
"cost": { "credits": 0, "credits_used": 412, "credits_included": 25000 },
"test": true,
"…": "…"
}- Pages: a sample shop page for the host you ask for, with a title, links, a price table, contact details and structured data.
format,main_content,parseand the size limit work as usual;extractreturns sample values of the type you asked for ("Sample text",129,42,true, lists of two). - Screenshots and PDFs: a small placeholder picture and a one-page PDF.
- Map and crawl: a sample site with a robots.txt, a sitemap and a handful of linked pages, so map finds addresses and a crawl grows and ends.
- Jobs, batches and webhooks: jobs and crawls made with a test key run in the background with sample answers, and their webhooks are really delivered – signed – to your URL.
- MCP and the SDKs: work with test keys unchanged.
- Every answer carries
"test": true(or the headerX-VP-Test: truefor images, PDFs and raw answers) andcost.credits0.
Simulate errors
Two query parameters in the target URL steer the sample answer. They are only read in test mode and never sent anywhere.
| Parameter | Effect |
|---|---|
vp_test_status=404 | The target answers with this HTTP status (100–599). |
vp_test_error=timeout | The call fails with this error code, exactly as in production. Possible: timeout, target_unreachable, connection_failed, tls_error, too_many_redirects, request_failed, busy, render_unavailable, rate_limited, concurrency_limited, credits_exhausted, maintenance. |
curl https://api.virginproxy.com/v1/requests \
-H "Authorization: Bearer $VP_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://shop.example/?vp_test_error=busy"}'
# → 503 {"error": {"code": "busy", "retry_after_ms": 2000, …}} with Retry-After: 2What is the same, what is different
| Test key | |
|---|---|
| Checks of your options | Real: an unknown option, a bad URL or a value out of range is refused as in production. |
| Plan rules | Real: what your plan does not include (for example a response larger than its size limit) is refused. |
| Rate and parallel limits | Your plan's, in a bucket of their own: testing never slows your live keys down. |
| Credits | Never charged; works with an empty balance. |
| Request log and usage | Not written: test calls do not appear in the request log or the statistics. The dashboard keeps them apart: its tab Test calls shows the last 200 of the past 24 hours (see below). |
| Keys and webhook settings | Not available with a test key (key_management_not_allowed). |
See your test calls
In the dashboard, the tab Test calls lists the last 200 calls made with your test keys within the past 24 hours, so you can check what your integration sent and what it got back. Older test calls are not kept, and none of them count towards your usage.
Note
Sample answers show the shape of real answers, not the real content of a site. Before going live, run a few calls with a live key against the pages you need.
Was this page helpful?
Last updated