Official SDKs
Scrapio ships official SDKs for six languages, covering fetch, crawl, interact, Google and Fast Search, Amazon, Walmart, YouTube, Booking.com, and Agoda. Published to their respective package registries.| Language | Package | Registry |
|---|---|---|
| TypeScript / Node.js | @scrapio/api | npm |
| Python | scrapio-py | PyPI |
| Go | github.com/xsronhou/scrapio-go | pkg.go.dev |
| Ruby | scrapio | RubyGems |
| PHP | scrapio/scrapio | Packagist |
| Java | io.github.xsronhou:scrapio-java | Maven Central |
TypeScript SDK
Install
npm install @scrapio/api
Initialize
import { ApiClient } from "@scrapio/api";
const client = new ApiClient({ apiKey: process.env.SCRAPIO_API_KEY! });
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your API key |
baseUrl | string | https://api.scrapio.dev | Override for local/staging |
timeoutMs | number | 30000 | Per-request timeout |
maxRetries | number | 3 | Max retries on 429/503 |
Usage
// Fetch a page
const page = await client.fetch.fetch({ url: "https://example.com", output: ["markdown"] });
// Google search
const results = await client.google.search({ search: "web scraping tools" });
// Amazon product
const product = await client.amazon.getProduct({ asin: "B08N5WRWNW" });
// Walmart search
const items = await client.walmart.search({ search: "headphones" });
// YouTube video
const video = await client.youtube.getVideo({ video_id: "dQw4w9WgXcQ" });
// Booking.com hotel search
const hotels = await client.booking.search({
location: "Paris, France",
check_in: "2026-09-10",
check_out: "2026-09-14",
});
// Agoda property details
const property = await client.agoda.getProperty({
url: "https://www.agoda.com/example-hotel",
check_in: "2026-09-10",
check_out: "2026-09-14",
});
// Async job with polling helper
const job = await client.jobs.create({
kind: "fetch",
input: { url: "https://example.com", output: ["markdown"] },
});
const result = await client.jobs.waitForCompletion(job.job_id, {
pollIntervalMs: 2000,
timeoutMs: 120_000,
});
Error handling
import {
ApiClient,
AuthError,
RateLimitError,
CreditsExhaustedError,
ApiError,
} from "@scrapio/api";
try {
await client.fetch.fetch({ url: "https://example.com" });
} catch (err) {
if (err instanceof AuthError) {
console.error("Invalid API key");
} else if (err instanceof CreditsExhaustedError) {
console.error("No credits remaining");
} else if (err instanceof RateLimitError) {
console.error("Rate limited — back off and retry");
} else if (err instanceof ApiError) {
console.error(`API error ${err.statusCode}: ${err.message}`);
}
}
Python SDK
Install
pip install scrapio-py
httpx for HTTP and pydantic v2 for types.
Initialize (sync)
from scrapio import ApiClient
client = ApiClient(api_key=os.environ["SCRAPIO_API_KEY"])
Initialize (async)
from scrapio import AsyncApiClient
async with AsyncApiClient(api_key=os.environ["SCRAPIO_API_KEY"]) as client:
...
| Option | Type | Default | Description |
|---|---|---|---|
api_key | str | required | Your API key |
base_url | str | https://api.scrapio.dev | Override for local/staging |
timeout | float | 30.0 | Per-request timeout (seconds) |
max_retries | int | 3 | Max retries on 429/503 |
Usage (sync)
from scrapio import ApiClient, FetchRequest
from scrapio.types import GoogleSearchParams
client = ApiClient(api_key="sk-...")
# Fetch a page
page = client.fetch.fetch(FetchRequest(url="https://example.com", output=["markdown"]))
# Google search
results = client.google.search(GoogleSearchParams(search="web scraping tools"))
# Amazon product
product = client.amazon.get_product("B08N5WRWNW")
# Walmart search
items = client.walmart.search("headphones")
# YouTube video
video = client.youtube.get_video("dQw4w9WgXcQ")
# Booking.com hotel search
hotels = client.booking.search("Paris, France", check_in="2026-09-10", check_out="2026-09-14")
# Agoda property details
property = client.agoda.get_property(
url="https://www.agoda.com/example-hotel",
check_in="2026-09-10",
check_out="2026-09-14",
)
# Async job with polling helper
from scrapio import CreateJobRequest
job = client.jobs.create(CreateJobRequest(
kind="fetch",
input={"url": "https://example.com", "output": ["markdown"]},
))
result = client.jobs.wait_for_completion(job.job_id, poll_interval=2.0, timeout=120.0)
Usage (async)
import asyncio
from scrapio import AsyncApiClient, FetchRequest, CreateJobRequest
async def main():
async with AsyncApiClient(api_key="sk-...") as client:
page = await client.fetch.fetch(FetchRequest(url="https://example.com", output=["markdown"]))
job = await client.jobs.create(CreateJobRequest(
kind="fetch",
input={"url": "https://example.com", "output": ["markdown"]},
))
result = await client.jobs.wait_for_completion(job.job_id, poll_interval=2.0, timeout=120.0)
asyncio.run(main())
Error handling
from scrapio import (
ApiClient, FetchRequest,
AuthError, RateLimitError, CreditsExhaustedError, ApiError,
)
try:
client.fetch.fetch(FetchRequest(url="https://example.com"))
except AuthError:
print("Invalid API key")
except CreditsExhaustedError:
print("No credits remaining")
except RateLimitError:
print("Rate limited — back off and retry")
except ApiError as e:
print(f"API error {e.status_code}: {e}")
Go SDK
Install
go get github.com/xsronhou/scrapio-go
Initialize
import scrapio "github.com/xsronhou/scrapio-go"
// Hardcoded:
client := scrapio.NewClient("YOUR_API_KEY")
// Or from env (pick one):
// client := scrapio.NewClient(os.Getenv("SCRAPIO_API_KEY"))
Usage
// Fetch a page
result, err := client.Fetch.Fetch(ctx, &scrapio.FetchRequest{
URL: "https://example.com",
Output: []string{"markdown"},
})
fmt.Println(result.Outputs["markdown"])
// Google search
results, err := client.Google.Search(ctx, &scrapio.GoogleSearchParams{
Search: "web scraping tools",
})
// Booking.com hotel search
hotels, err := client.Booking.Search(ctx, "Paris, France", "2026-09-10", "2026-09-14")
// Async job
job, err := client.Jobs.Create(ctx, &scrapio.CreateJobRequest{
Kind: "fetch",
Input: map[string]any{"url": "https://example.com", "output": []string{"markdown"}},
})
jobResult, err := client.Jobs.WaitForCompletion(ctx, job.JobID, nil)
Ruby SDK
Install
gem install scrapio
Initialize
require "scrapio"
client = Scrapio::Client.new(ENV["SCRAPIO_API_KEY"])
Usage
# Fetch a page
result = client.fetch.fetch(url: "https://example.com", output: ["markdown"])
puts result["outputs"]["markdown"]
# Google search
results = client.google.search(search: "web scraping tools")
# Amazon product
product = client.amazon.get_product("B08N5WRWNW")
# Booking.com hotel search
hotels = client.booking.search(location: "Paris, France", check_in: "2026-09-10", check_out: "2026-09-14")
# Async job
job = client.jobs.create(kind: "fetch", input: { url: "https://example.com", output: ["markdown"] })
result = client.jobs.wait_for_completion(job["job_id"])
PHP SDK
Install
composer require scrapio/scrapio
Initialize
use Scrapio\ScrapioClient;
$client = new ScrapioClient(apiKey: $_ENV["SCRAPIO_API_KEY"]);
Usage
// Fetch a page
$result = $client->fetch->fetch([
"url" => "https://example.com",
"output" => ["markdown"],
]);
echo $result['outputs']['markdown'];
// Google search
$results = $client->google->search(["search" => "web scraping tools"]);
// Amazon product
$product = $client->amazon->getProduct("B08N5WRWNW");
// Booking.com hotel search
$hotels = $client->booking->search("Paris, France", "2026-09-10", "2026-09-14");
// Async job
$job = $client->jobs->create(
"fetch",
["url" => "https://example.com", "output" => ["markdown"]],
);
$result = $client->jobs->waitForCompletion($job['job_id']);
Java SDK
Install
Add to yourpom.xml:
<dependency>
<groupId>io.github.xsronhou</groupId>
<artifactId>scrapio-java</artifactId>
<version>1.0.2</version>
</dependency>
implementation 'io.github.xsronhou:scrapio-java:1.0.2'
Initialize
import io.github.xsronhou.scrapio.ScrapioClient;
ScrapioClient client = ScrapioClient.builder()
.apiKey(System.getenv("SCRAPIO_API_KEY"))
.build();
Usage
// Fetch a page
var result = client.fetch().fetch(
FetchRequest.builder()
.url("https://example.com")
.output(List.of("markdown"))
.build()
);
System.out.println(result.outputs.get("markdown"));
// Google search
var results = client.google().search(
GoogleSearchRequest.builder().search("web scraping tools").build()
);
// Booking.com hotel search
var hotels = client.booking().search(
HotelSearchParams.builder()
.location("Paris, France")
.checkIn("2026-09-10")
.checkOut("2026-09-14")
.build()
);
// Async job
var job = client.jobs().create(
CreateJobRequest.builder()
.kind("fetch")
.input(Map.of("url", "https://example.com", "output", List.of("markdown")))
.build()
);
var completed = client.jobs().waitForCompletion(job.jobId);
Changelog
Each SDK maintains aCHANGELOG.md in its package directory, updated on every release.