# Cache, change tracking, presets and schedules

> Reuse answers for free with the cache, see what changed on a page, save request options as presets, run jobs on a schedule with a cost cap, and pace yourself with the limits endpoint.

Source: https://docs.virginproxy.com/automation/

Four things that save credits and code when you read the same pages again and again: keep answers and reuse them for free, be told when a page changed, save your options once under a name, and let a job run every hour or every day – always with a cap on what it may cost.

## Reuse an answer: the cache

Add `cache` and the answer is kept. The same request within `max_age_s` gets it again at once and for **0 credits**; nothing is fetched. `true` keeps it one hour; from 60 seconds to 7 days is possible.

**cURL**

```bash
curl https://api.virginproxy.com/v1/requests \
  -H "Authorization: Bearer $VP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example/products/42",
    "format": "markdown",
    "cache": {
      "max_age_s": 3600
    }
  }'
```

**Python**

```python
import os, requests

r = requests.post(
    "https://api.virginproxy.com/v1/requests",
    headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
    json={
        "url": "https://shop.example/products/42",
        "format": "markdown",
        "cache": {"max_age_s": 3600},
    },
    timeout=180,
)
data = r.json()
if not r.ok:
    raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["status"], data["cost"]["credits"])
```

**Node.js**

```javascript
const res = await fetch("https://api.virginproxy.com/v1/requests", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    url: "https://shop.example/products/42",
    format: "markdown",
    cache: { max_age_s: 3600 },
  }),
  signal: AbortSignal.timeout(180_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);
```

**Python SDK**

```pysdk
from virginproxy import VirginProxy  # docs.virginproxy.com/sdk/virginproxy.py

vp = VirginProxy()  # reads VP_KEY
data = vp.request({
    "url": "https://shop.example/products/42",
    "format": "markdown",
    "cache": {"max_age_s": 3600},
})
print(data)
```

**Node SDK**

```nodesdk
import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs

const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.request({
  url: "https://shop.example/products/42",
  format: "markdown",
  cache: { max_age_s: 3600 },
});
console.log(data);
```

**PHP**

```php
<?php
$ch = curl_init("https://api.virginproxy.com/v1/requests");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 180,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("VP_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "url" => "https://shop.example/products/42",
        "format" => "markdown",
        "cache" => ["max_age_s" => 3600],
    ], 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;
```

**Go**

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"os"
	"time"
)

func main() {
	payload := []byte(`{
  "url": "https://shop.example/products/42",
  "format": "markdown",
  "cache": {
    "max_age_s": 3600
  }
}`)
	req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/requests", 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: 180 * 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"])
}
```

POST`/v1/requests`[≈ 1 credit](https://docs.virginproxy.com/billing/#cost)[Open in Playground](https://dash.virginproxy.com/playground#request=eyJ1cmwiOiJodHRwczovL3Nob3AuZXhhbXBsZS9wcm9kdWN0cy80MiIsImZvcm1hdCI6Im1hcmtkb3duIiwiY2FjaGUiOnsibWF4X2FnZV9zIjozNjAwfX0)

A reused answer is marked. Its `id` is the request that fetched it, so the request log shows one charged request.

*A cached answer:*

```json
{
  "id": "req_V3nQ8xLp2KdW7sTm0RcY",
  "status": 200,
  "body": "<!doctype html>…",
  "cost": { "credits": 0, "credits_used": 412, "credits_included": 25000 },
  "cached": true,
  "cached_at": "2026-11-25T08:00:12Z",
  "cache_expires_at": "2026-11-25T09:00:12Z",
  "…": "…"
}
```

What makes two requests “the same”: every option except `tag`, `echo`, `max_credits` and `cache` itself – in any order. Only answers below status 400 are kept.

> **Note:** Without `cache` nothing is kept: the page content of a request is not stored. With it, the answer is kept up to its age (at most 7 days, up to 256 MB per account; the oldest go first) and then deleted.

## Know when a page changed

With `track_changes` the answer says whether the page is new to you, the same as last time or changed. Compared is your last request for the same page read the same way (address, method, `format`, `extract`, `parse`).

**cURL**

```bash
curl https://api.virginproxy.com/v1/requests \
  -H "Authorization: Bearer $VP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example/products/42",
    "extract": {
      "price": {
        "selector": ".price",
        "type": "number"
      }
    },
    "track_changes": {
      "on": "extracted",
      "diff": true
    }
  }'
```

**Python**

```python
import os, requests

r = requests.post(
    "https://api.virginproxy.com/v1/requests",
    headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
    json={
        "url": "https://shop.example/products/42",
        "extract": {"price": {"selector": ".price", "type": "number"}},
        "track_changes": {"on": "extracted", "diff": True},
    },
    timeout=180,
)
data = r.json()
if not r.ok:
    raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["status"], data["cost"]["credits"])
```

**Node.js**

```javascript
const res = await fetch("https://api.virginproxy.com/v1/requests", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    url: "https://shop.example/products/42",
    extract: { price: { selector: ".price", type: "number" } },
    track_changes: { on: "extracted", diff: true },
  }),
  signal: AbortSignal.timeout(180_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);
```

**Python SDK**

```pysdk
from virginproxy import VirginProxy  # docs.virginproxy.com/sdk/virginproxy.py

vp = VirginProxy()  # reads VP_KEY
data = vp.request({
    "url": "https://shop.example/products/42",
    "extract": {"price": {"selector": ".price", "type": "number"}},
    "track_changes": {"on": "extracted", "diff": True},
})
print(data)
```

**Node SDK**

```nodesdk
import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs

const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.request({
  url: "https://shop.example/products/42",
  extract: { price: { selector: ".price", type: "number" } },
  track_changes: { on: "extracted", diff: true },
});
console.log(data);
```

**PHP**

```php
<?php
$ch = curl_init("https://api.virginproxy.com/v1/requests");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 180,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("VP_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "url" => "https://shop.example/products/42",
        "extract" => ["price" => ["selector" => ".price", "type" => "number"]],
        "track_changes" => ["on" => "extracted", "diff" => 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;
```

**Go**

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"os"
	"time"
)

func main() {
	payload := []byte(`{
  "url": "https://shop.example/products/42",
  "extract": {
    "price": {
      "selector": ".price",
      "type": "number"
    }
  },
  "track_changes": {
    "on": "extracted",
    "diff": true
  }
}`)
	req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/requests", 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: 180 * 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"])
}
```

POST`/v1/requests`[≈ 1 credit](https://docs.virginproxy.com/billing/#cost)[Open in Playground](https://dash.virginproxy.com/playground#request=eyJ1cmwiOiJodHRwczovL3Nob3AuZXhhbXBsZS9wcm9kdWN0cy80MiIsImV4dHJhY3QiOnsicHJpY2UiOnsic2VsZWN0b3IiOiIucHJpY2UiLCJ0eXBlIjoibnVtYmVyIn19LCJ0cmFja19jaGFuZ2VzIjp7Im9uIjoiZXh0cmFjdGVkIiwiZGlmZiI6dHJ1ZX19)

*The answer with "change":*

```json
{
  "id": "req_Q1rT7uWx3YzA5bC9dE2f",
  "status": 200,
  "extracted": { "price": 79 },
  "change": {
    "status": "changed",
    "previous_request": "req_V3nQ8xLp2KdW7sTm0RcY",
    "previous_at": "2026-11-24T08:00:03Z",
    "diff": {
      "added": ["{\"extracted\": {\"price\": 79}}"],
      "removed": ["{\"extracted\": {\"price\": 89}}"],
      "added_count": 1, "removed_count": 1, "truncated": false
    }
  },
  "…": "…"
}
```

- `"on": "body"` (default) compares the page itself, whitespace folded. `"on": "extracted"` compares only what `extract`, `parse` or `ai_extract` read – a new banner or ad does not count then.
- `"diff": true` names the lines that came and went (up to 200 each). The text is kept for that; without `diff` only a hash of it is kept.
- `"key": "…"` names what you watch yourself, for example one product across addresses.
- Change tracking is free. A page not requested for 90 days starts again as `new`.

> **Tip:** In a job, send only what changed to your server: `"webhook": {"url": "…", "events": ["item.changed"]}`.

## Save options as a preset

Long render and extraction options belong in one place. Save them once with a key that has the `manage` permission …

**cURL**

```bash
curl https://api.virginproxy.com/v1/presets \
  -H "Authorization: Bearer $VP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "shop-product",
    "description": "Product pages",
    "request": {
      "render": {
        "wait_for": ".price"
      },
      "extract": {
        "price": {
          "selector": ".price",
          "type": "number"
        },
        "title": {
          "selector": "h1"
        }
      }
    }
  }'
```

**Python**

```python
import os, requests

r = requests.post(
    "https://api.virginproxy.com/v1/presets",
    headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
    json={
        "name": "shop-product",
        "description": "Product pages",
        "request": {
            "render": {"wait_for": ".price"},
            "extract": {
                "price": {"selector": ".price", "type": "number"},
                "title": {"selector": "h1"},
            },
        },
    },
    timeout=30,
)
data = r.json()
if not r.ok:
    raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["status"], data["cost"]["credits"])
```

**Node.js**

```javascript
const res = await fetch("https://api.virginproxy.com/v1/presets", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    name: "shop-product",
    description: "Product pages",
    request: {
      render: { wait_for: ".price" },
      extract: {
        price: { selector: ".price", type: "number" },
        title: { selector: "h1" },
      },
    },
  }),
  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);
```

**Python SDK**

```pysdk
from virginproxy import VirginProxy  # docs.virginproxy.com/sdk/virginproxy.py

vp = VirginProxy()  # reads VP_KEY
data = vp.call("POST", "/v1/presets", {
    "name": "shop-product",
    "description": "Product pages",
    "request": {
        "render": {"wait_for": ".price"},
        "extract": {
            "price": {"selector": ".price", "type": "number"},
            "title": {"selector": "h1"},
        },
    },
})
print(data)
```

**Node SDK**

```nodesdk
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/presets", { body: {
  name: "shop-product",
  description: "Product pages",
  request: {
    render: { wait_for: ".price" },
    extract: {
      price: { selector: ".price", type: "number" },
      title: { selector: "h1" },
    },
  },
} });
console.log(data);
```

**PHP**

```php
<?php
$ch = curl_init("https://api.virginproxy.com/v1/presets");
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" => "shop-product",
        "description" => "Product pages",
        "request" => [
            "render" => ["wait_for" => ".price"],
            "extract" => [
                "price" => ["selector" => ".price", "type" => "number"],
                "title" => ["selector" => "h1"],
            ],
        ],
    ], 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;
```

**Go**

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"os"
	"time"
)

func main() {
	payload := []byte(`{
  "name": "shop-product",
  "description": "Product pages",
  "request": {
    "render": {
      "wait_for": ".price"
    },
    "extract": {
      "price": {
        "selector": ".price",
        "type": "number"
      },
      "title": {
        "selector": "h1"
      }
    }
  }
}`)
	req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/presets", 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"])
}
```

POST`/v1/presets`

… and use them by name in a request, a job (also per item), a crawl's `request` or a batch. Options you send win over the preset's (one level deep for objects such as `render`).

**cURL**

```bash
curl https://api.virginproxy.com/v1/requests \
  -H "Authorization: Bearer $VP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example/products/42",
    "preset": "shop-product"
  }'
```

**Python**

```python
import os, requests

r = requests.post(
    "https://api.virginproxy.com/v1/requests",
    headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
    json={
        "url": "https://shop.example/products/42",
        "preset": "shop-product",
    },
    timeout=180,
)
data = r.json()
if not r.ok:
    raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["status"], data["cost"]["credits"])
```

**Node.js**

```javascript
const res = await fetch("https://api.virginproxy.com/v1/requests", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    url: "https://shop.example/products/42",
    preset: "shop-product",
  }),
  signal: AbortSignal.timeout(180_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);
```

**Python SDK**

```pysdk
from virginproxy import VirginProxy  # docs.virginproxy.com/sdk/virginproxy.py

vp = VirginProxy()  # reads VP_KEY
data = vp.request({
    "url": "https://shop.example/products/42",
    "preset": "shop-product",
})
print(data)
```

**Node SDK**

```nodesdk
import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs

const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.request({
  url: "https://shop.example/products/42",
  preset: "shop-product",
});
console.log(data);
```

**PHP**

```php
<?php
$ch = curl_init("https://api.virginproxy.com/v1/requests");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 180,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("VP_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "url" => "https://shop.example/products/42",
        "preset" => "shop-product",
    ], 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;
```

**Go**

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"os"
	"time"
)

func main() {
	payload := []byte(`{
  "url": "https://shop.example/products/42",
  "preset": "shop-product"
}`)
	req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/requests", 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: 180 * 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"])
}
```

POST`/v1/requests`[≈ 1 credit](https://docs.virginproxy.com/billing/#cost)[Open in Playground](https://dash.virginproxy.com/playground#request=eyJ1cmwiOiJodHRwczovL3Nob3AuZXhhbXBsZS9wcm9kdWN0cy80MiIsInByZXNldCI6InNob3AtcHJvZHVjdCJ9)

List, change and delete them with `GET /v1/presets`, `PATCH /v1/presets/{name}` and `DELETE /v1/presets/{name}`. Up to 100 per account. In the dashboard's playground: **Presets → Save these options as a preset**.

## A cost cap for jobs and crawls

`max_credits` on a job or crawl caps the whole run. Once it has used that many credits, requests that have not started end as `job_budget_reached` and are not charged. The job shows `budget`: the cap, what was used and what is left.

**cURL**

```bash
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": {
      "format": "markdown"
    },
    "max_credits": 500
  }'
```

**Python**

```python
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": {"format": "markdown"},
        "max_credits": 500,
    },
    timeout=30,
)
data = r.json()
if not r.ok:
    raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["status"], data["cost"]["credits"])
```

**Node.js**

```javascript
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: { format: "markdown" },
    max_credits: 500,
  }),
  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);
```

**Python SDK**

```pysdk
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": {"format": "markdown"},
    "max_credits": 500,
})
print(data)
```

**Node SDK**

```nodesdk
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: { format: "markdown" },
  max_credits: 500,
});
console.log(data);
```

**PHP**

```php
<?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" => ["format" => "markdown"],
        "max_credits" => 500,
    ], 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;
```

**Go**

```go
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": {
    "format": "markdown"
  },
  "max_credits": 500
}`)
	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"])
}
```

POST`/v1/jobs`

`urls` with `defaults` sends the same options for many addresses; `requests` still takes a full body per item. `GET /v1/jobs/{id}?wait=25` answers as soon as the job moves on (or after the seconds), instead of polling every second.

## Run a job again and again

A schedule starts the same job or crawl every interval: `5m`, `15m`, `30m`, `1h`, `6h`, `12h`, `1d` or `7d` – or on a rhythm in words such as `"weekdays at 09:30"` (see [Monitors](https://docs.virginproxy.com/monitors/#rhythm)). `max_credits` is required: it caps every run.

> **Tip:** With `"track": "pages"` a schedule becomes a [monitor](https://docs.virginproxy.com/monitors/): every run is compared with the last, and you get an e-mail or webhook when pages appear, disappear or change.

**cURL**

```bash
curl https://api.virginproxy.com/v1/schedules \
  -H "Authorization: Bearer $VP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Prices",
    "every": "1h",
    "max_credits": 200,
    "job": {
      "urls": [
        "https://shop.example/p/1",
        "https://shop.example/p/2"
      ],
      "defaults": {
        "preset": "shop-product",
        "track_changes": {
          "on": "extracted"
        }
      },
      "webhook": {
        "url": "https://your-server.example/hooks/virginproxy",
        "events": [
          "item.changed"
        ]
      }
    }
  }'
```

**Python**

```python
import os, requests

r = requests.post(
    "https://api.virginproxy.com/v1/schedules",
    headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
    json={
        "name": "Prices",
        "every": "1h",
        "max_credits": 200,
        "job": {
            "urls": ["https://shop.example/p/1", "https://shop.example/p/2"],
            "defaults": {"preset": "shop-product", "track_changes": {"on": "extracted"}},
            "webhook": {
                "url": "https://your-server.example/hooks/virginproxy",
                "events": ["item.changed"],
            },
        },
    },
    timeout=30,
)
data = r.json()
if not r.ok:
    raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["status"], data["cost"]["credits"])
```

**Node.js**

```javascript
const res = await fetch("https://api.virginproxy.com/v1/schedules", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    name: "Prices",
    every: "1h",
    max_credits: 200,
    job: {
      urls: ["https://shop.example/p/1", "https://shop.example/p/2"],
      defaults: { preset: "shop-product", track_changes: { on: "extracted" } },
      webhook: {
        url: "https://your-server.example/hooks/virginproxy",
        events: ["item.changed"],
      },
    },
  }),
  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);
```

**Python SDK**

```pysdk
from virginproxy import VirginProxy  # docs.virginproxy.com/sdk/virginproxy.py

vp = VirginProxy()  # reads VP_KEY
data = vp.create_schedule({
    "name": "Prices",
    "every": "1h",
    "max_credits": 200,
    "job": {
        "urls": ["https://shop.example/p/1", "https://shop.example/p/2"],
        "defaults": {"preset": "shop-product", "track_changes": {"on": "extracted"}},
        "webhook": {
            "url": "https://your-server.example/hooks/virginproxy",
            "events": ["item.changed"],
        },
    },
})
print(data)
```

**Node SDK**

```nodesdk
import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs

const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.createSchedule({
  name: "Prices",
  every: "1h",
  max_credits: 200,
  job: {
    urls: ["https://shop.example/p/1", "https://shop.example/p/2"],
    defaults: { preset: "shop-product", track_changes: { on: "extracted" } },
    webhook: {
      url: "https://your-server.example/hooks/virginproxy",
      events: ["item.changed"],
    },
  },
});
console.log(data);
```

**PHP**

```php
<?php
$ch = curl_init("https://api.virginproxy.com/v1/schedules");
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" => "Prices",
        "every" => "1h",
        "max_credits" => 200,
        "job" => [
            "urls" => ["https://shop.example/p/1", "https://shop.example/p/2"],
            "defaults" => [
                "preset" => "shop-product",
                "track_changes" => ["on" => "extracted"],
            ],
            "webhook" => [
                "url" => "https://your-server.example/hooks/virginproxy",
                "events" => ["item.changed"],
            ],
        ],
    ], 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;
```

**Go**

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"os"
	"time"
)

func main() {
	payload := []byte(`{
  "name": "Prices",
  "every": "1h",
  "max_credits": 200,
  "job": {
    "urls": [
      "https://shop.example/p/1",
      "https://shop.example/p/2"
    ],
    "defaults": {
      "preset": "shop-product",
      "track_changes": {
        "on": "extracted"
      }
    },
    "webhook": {
      "url": "https://your-server.example/hooks/virginproxy",
      "events": [
        "item.changed"
      ]
    }
  }
}`)
	req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/schedules", 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"])
}
```

POST`/v1/schedules`

- Runs never overlap: while the last run is still open, the next one is left out.
- A schedule pauses itself when the account cannot pay (credits or daily cap used up), its key was revoked or the account is suspended – you get a notice in the dashboard. `paused_reason` says why; `PATCH` with `{"status": "active"}` resumes it.
- `POST /v1/schedules/{id}/run` starts a run now. Per plan: Free 1 schedule (daily at most), Starter 5 (hourly), Growth 20 (every 15 minutes), Scale 50 (every 5 minutes).
- In the dashboard: send many addresses as a job and choose **Repeat**; the jobs page lists your schedules with pause, resume and run now.

## Pace yourself

`GET /v1/limits` shows what your plan and key allow right now and how much of it is in use – before a big batch, instead of running into `429` or `402`. Free, with the `read` or `requests` permission.

*GET /v1/limits:*

```json
{
  "concurrency": { "limit": 5, "in_use": 2, "peak_today": 5 },
  "rate": { "limit": 5, "now": 1.2, "avg_5s": 0.8, "peak_today": 4.6 },
  "daily_cap": { "cap": 2000, "used": 1240, "left": 760, "resets_at": "2026-11-26T00:00:00Z" },
  "key": { "id": "41", "credit_limit": null, "daily_limit": 500, "daily_used": 120, "daily_left": 380 }
}
```

The daily cap, the credit alert thresholds and the alert webhook can be set through the API too: `PATCH /v1/account/settings` with `daily_cap`, `alert_thresholds`, `alert_hook_url` or `alert_hook_slack` (a key with `manage`).

## Get a kept answer again

`GET /v1/requests/{id}/answer` returns the answer itself when it is kept: requests sent with an `Idempotency-Key` (24 hours) and cached answers (up to their age). Useful after a broken connection: nothing runs again, nothing is charged. Otherwise `404 answer_not_kept`.

The request log takes the dashboard's filters too: `GET /v1/requests?host=shop&kind=render&status_class=4xx&from=2026-11-24T00:00:00Z`. Each record names its `kind`, `key_id` and the parts of its cost.

## Respect robots.txt

Crawls and maps take `robots`: `"respect"` leaves out what the site's robots.txt disallows for us (or for every agent), `"report"` (map only) keeps those addresses marked with `"disallowed": true`. Reading robots.txt is an ordinary request of 1 credit. The default is `"ignore"`.

## Standard records without selectors

`parse` reads `product`, `article`, `organization` and `breadcrumbs` from the page's structured data – name, price, currency, availability, brand, rating; headline, author, dates; and so on. Fields the page does not give are `null`; nothing is guessed from the visible text.

**cURL**

```bash
curl https://api.virginproxy.com/v1/requests \
  -H "Authorization: Bearer $VP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example/products/42",
    "parse": [
      "product",
      "breadcrumbs"
    ]
  }'
```

**Python**

```python
import os, requests

r = requests.post(
    "https://api.virginproxy.com/v1/requests",
    headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
    json={
        "url": "https://shop.example/products/42",
        "parse": ["product", "breadcrumbs"],
    },
    timeout=180,
)
data = r.json()
if not r.ok:
    raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["status"], data["cost"]["credits"])
```

**Node.js**

```javascript
const res = await fetch("https://api.virginproxy.com/v1/requests", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    url: "https://shop.example/products/42",
    parse: ["product", "breadcrumbs"],
  }),
  signal: AbortSignal.timeout(180_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);
```

**Python SDK**

```pysdk
from virginproxy import VirginProxy  # docs.virginproxy.com/sdk/virginproxy.py

vp = VirginProxy()  # reads VP_KEY
data = vp.request({
    "url": "https://shop.example/products/42",
    "parse": ["product", "breadcrumbs"],
})
print(data)
```

**Node SDK**

```nodesdk
import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs

const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.request({
  url: "https://shop.example/products/42",
  parse: ["product", "breadcrumbs"],
});
console.log(data);
```

**PHP**

```php
<?php
$ch = curl_init("https://api.virginproxy.com/v1/requests");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 180,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("VP_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "url" => "https://shop.example/products/42",
        "parse" => ["product", "breadcrumbs"],
    ], 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;
```

**Go**

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"os"
	"time"
)

func main() {
	payload := []byte(`{
  "url": "https://shop.example/products/42",
  "parse": [
    "product",
    "breadcrumbs"
  ]
}`)
	req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/requests", 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: 180 * 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"])
}
```

POST`/v1/requests`[≈ 1 credit](https://docs.virginproxy.com/billing/#cost)[Open in Playground](https://dash.virginproxy.com/playground#request=eyJ1cmwiOiJodHRwczovL3Nob3AuZXhhbXBsZS9wcm9kdWN0cy80MiIsInBhcnNlIjpbInByb2R1Y3QiLCJicmVhZGNydW1icyJdfQ)
