Delivery to your own storage
Add your bucket once as a storage destination, then give a job, crawl or schedule a delivery: when it ends, its results are written there as one file. No download script, no 24-hour window.
Add a destination
curl https://api.virginproxy.com/v1/destinations \
-H "Authorization: Bearer $VP_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Results",
"type": "s3",
"endpoint": "https://<account-id>.r2.cloudflarestorage.com",
"region": "auto",
"bucket": "scrapes",
"prefix": "virginproxy/",
"access_key_id": "<access key>",
"secret_access_key": "<secret>"
}'import os, requests
r = requests.post(
"https://api.virginproxy.com/v1/destinations",
headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
json={
"name": "Results",
"type": "s3",
"endpoint": "https://<account-id>.r2.cloudflarestorage.com",
"region": "auto",
"bucket": "scrapes",
"prefix": "virginproxy/",
"access_key_id": "<access key>",
"secret_access_key": "<secret>",
},
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/destinations", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
name: "Results",
type: "s3",
endpoint: "https://<account-id>.r2.cloudflarestorage.com",
region: "auto",
bucket: "scrapes",
prefix: "virginproxy/",
access_key_id: "<access key>",
secret_access_key: "<secret>",
}),
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/destinations", {
"name": "Results",
"type": "s3",
"endpoint": "https://<account-id>.r2.cloudflarestorage.com",
"region": "auto",
"bucket": "scrapes",
"prefix": "virginproxy/",
"access_key_id": "<access key>",
"secret_access_key": "<secret>",
})
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/destinations", { body: {
name: "Results",
type: "s3",
endpoint: "https://<account-id>.r2.cloudflarestorage.com",
region: "auto",
bucket: "scrapes",
prefix: "virginproxy/",
access_key_id: "<access key>",
secret_access_key: "<secret>",
} });
console.log(data);<?php
$ch = curl_init("https://api.virginproxy.com/v1/destinations");
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" => "Results",
"type" => "s3",
"endpoint" => "https://<account-id>.r2.cloudflarestorage.com",
"region" => "auto",
"bucket" => "scrapes",
"prefix" => "virginproxy/",
"access_key_id" => "<access key>",
"secret_access_key" => "<secret>",
], 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(`{
"name": "Results",
"type": "s3",
"endpoint": "https://<account-id>.r2.cloudflarestorage.com",
"region": "auto",
"bucket": "scrapes",
"prefix": "virginproxy/",
"access_key_id": "<access key>",
"secret_access_key": "<secret>"
}`)
req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/destinations", 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/destinations")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer " + ENV.fetch("VP_KEY")
req["Content-Type"] = "application/json"
req.body = JSON.generate({
"name" => "Results",
"type" => "s3",
"endpoint" => "https://<account-id>.r2.cloudflarestorage.com",
"region" => "auto",
"bucket" => "scrapes",
"prefix" => "virginproxy/",
"access_key_id" => "<access key>",
"secret_access_key" => "<secret>",
})
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 = """
{
"name": "Results",
"type": "s3",
"endpoint": "https://<account-id>.r2.cloudflarestorage.com",
"region": "auto",
"bucket": "scrapes",
"prefix": "virginproxy/",
"access_key_id": "<access key>",
"secret_access_key": "<secret>"
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create("https://api.virginproxy.com/v1/destinations"))
.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": "Results",
"type": "s3",
"endpoint": "https://<account-id>.r2.cloudflarestorage.com",
"region": "auto",
"bucket": "scrapes",
"prefix": "virginproxy/",
"access_key_id": "<access key>",
"secret_access_key": "<secret>"
}
""";
var req = new HttpRequestMessage(HttpMethod.Post, "https://api.virginproxy.com/v1/destinations");
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/destinationsAny S3-compatible service works: AWS S3 (leave out endpoint, give the region), Cloudflare R2 (region auto), Google Cloud Storage in interoperability mode (https://storage.googleapis.com), MinIO, Wasabi, Backblaze B2 and others. Services other than AWS are addressed as endpoint/bucket/key; set "path_style": false if yours wants bucket.endpoint/key.
The secret key is stored encrypted and never shown again – not in the API, not in the dashboard. Give the key only the right to write objects (PutObject) into this bucket or prefix. Up to 10 destinations; making and deleting them needs the manage scope.
Test it
POST /v1/destinations/{id}/test writes virginproxy-test.txt into the prefix and answers {"ok": true} – or the storage service's own error, for example HTTP 403 AccessDenied: Access Denied. The dashboard has the same button under Settings › Storage.
Deliver a job
curl https://api.virginproxy.com/v1/jobs \
-H "Authorization: Bearer $VP_KEY" \
-H "Content-Type: application/json" \
-d '{
"urls": [
"https://shop.example/p/1",
"https://shop.example/p/2"
],
"defaults": {
"auto_extract": "product"
},
"delivery": {
"destination": "dst_9Lk2Vb7Qx0Pm3Rn5Tz8W",
"format": "ndjson",
"path": "{date}/{job_id}.ndjson"
}
}'import os, requests
r = requests.post(
"https://api.virginproxy.com/v1/jobs",
headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
json={
"urls": ["https://shop.example/p/1", "https://shop.example/p/2"],
"defaults": {"auto_extract": "product"},
"delivery": {
"destination": "dst_9Lk2Vb7Qx0Pm3Rn5Tz8W",
"format": "ndjson",
"path": "{date}/{job_id}.ndjson",
},
},
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/jobs", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
urls: ["https://shop.example/p/1", "https://shop.example/p/2"],
defaults: { auto_extract: "product" },
delivery: {
destination: "dst_9Lk2Vb7Qx0Pm3Rn5Tz8W",
format: "ndjson",
path: "{date}/{job_id}.ndjson",
},
}),
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.create_job({
"urls": ["https://shop.example/p/1", "https://shop.example/p/2"],
"defaults": {"auto_extract": "product"},
"delivery": {
"destination": "dst_9Lk2Vb7Qx0Pm3Rn5Tz8W",
"format": "ndjson",
"path": "{date}/{job_id}.ndjson",
},
})
print(data)import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs
const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.createJob({
urls: ["https://shop.example/p/1", "https://shop.example/p/2"],
defaults: { auto_extract: "product" },
delivery: {
destination: "dst_9Lk2Vb7Qx0Pm3Rn5Tz8W",
format: "ndjson",
path: "{date}/{job_id}.ndjson",
},
});
console.log(data);<?php
$ch = curl_init("https://api.virginproxy.com/v1/jobs");
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([
"urls" => ["https://shop.example/p/1", "https://shop.example/p/2"],
"defaults" => ["auto_extract" => "product"],
"delivery" => [
"destination" => "dst_9Lk2Vb7Qx0Pm3Rn5Tz8W",
"format" => "ndjson",
"path" => "{date}/{job_id}.ndjson",
],
], 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(`{
"urls": [
"https://shop.example/p/1",
"https://shop.example/p/2"
],
"defaults": {
"auto_extract": "product"
},
"delivery": {
"destination": "dst_9Lk2Vb7Qx0Pm3Rn5Tz8W",
"format": "ndjson",
"path": "{date}/{job_id}.ndjson"
}
}`)
req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/jobs", 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/jobs")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer " + ENV.fetch("VP_KEY")
req["Content-Type"] = "application/json"
req.body = JSON.generate({
"urls" => ["https://shop.example/p/1", "https://shop.example/p/2"],
"defaults" => { "auto_extract" => "product" },
"delivery" => {
"destination" => "dst_9Lk2Vb7Qx0Pm3Rn5Tz8W",
"format" => "ndjson",
"path" => "{date}/{job_id}.ndjson",
},
})
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 = """
{
"urls": [
"https://shop.example/p/1",
"https://shop.example/p/2"
],
"defaults": {
"auto_extract": "product"
},
"delivery": {
"destination": "dst_9Lk2Vb7Qx0Pm3Rn5Tz8W",
"format": "ndjson",
"path": "{date}/{job_id}.ndjson"
}
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create("https://api.virginproxy.com/v1/jobs"))
.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 = """
{
"urls": [
"https://shop.example/p/1",
"https://shop.example/p/2"
],
"defaults": {
"auto_extract": "product"
},
"delivery": {
"destination": "dst_9Lk2Vb7Qx0Pm3Rn5Tz8W",
"format": "ndjson",
"path": "{date}/{job_id}.ndjson"
}
}
""";
var req = new HttpRequestMessage(HttpMethod.Post, "https://api.virginproxy.com/v1/jobs");
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/jobs| Field | Default | Meaning |
|---|---|---|
delivery.destination | required | The id of one of your destinations (dst_…). |
delivery.format | "ndjson" | ndjson, json, csv – the same files as the export. |
delivery.path | "{date}/{job_id}.ndjson" | The file name inside the prefix. Placeholders: {job_id}, {schedule_id}, {date}, {time}, {tag}, {kind}. |
The same delivery works in a crawl and in the job or crawl of a schedule – then every run writes its own file (use {date} or {job_id} in the path).
Where it went
The job says it in delivery: "status": "pending" while it runs, then "delivered" with key and bytes, or "failed" with the reason. The file is written before the job.done webhook goes out, so that webhook already names it. A failed delivery also shows as a notice in the dashboard; the results stay downloadable for 24 hours as usual.
NDJSON and CSV results larger than 90 MB are written as numbered parts (name.part-0001.ndjson …, split at line ends, listed in delivery.keys; a CSV has its header line in the first part only). A JSON file is one document and is not split: above 90 MB deliver ndjson instead. Results larger than 500 MB are not delivered – download those with the export.
Note
Uploads come from our delivery network, not from a fixed address: if your bucket limits access by IP, use the key's permissions instead.
Was this page helpful?
Last updated