SDKs
Official SDKs
BuyProxy publishes an open-source Go SDK. It wraps the same REST API with typed requests and responses, automatic retries, typed errors and helpers for Go's HTTP client, so generating a proxy, topping up bandwidth or running a reseller business is a few lines of Go. It's MIT-licensed. From any other language, call the REST API directly, for example with curl.
Choose your language
Before you start
A BuyProxy account has two kinds of API key. Both go in the X-API-Key header, and every SDK sends it for you.
| Key | Looks like | Create it | Unlocks |
|---|---|---|---|
| Personal | bp_key_… | Dashboard → API keys | Your own bandwidth: account, balances, plans, generating proxies, top-ups, payments |
| Reseller | bp_live_… | Dashboard → Reseller → API keys (Business plan or higher) | Your customers: create and fund sub-accounts, the reseller pool, generating on their behalf, payments |
Keys are shown once when you create them — store them in a secrets manager or environment variable, never in source control or in a browser. Revoke a key from the same page at any time. Requests with a suspended account's key return 403, and a reseller key stops working if the account drops below the Business plan.
The catalog (products) and account creation (signup, verify otp) work without a key.
The Go SDK reads BUYPROXY_API_KEY from the environment, so in most programs you never pass the key at all:
export BUYPROXY_API_KEY=bp_key_xxxxxxxxxxxxxxxxxxxxxxxxProduct keys
Every top-up and allocation call takes a product key. Live prices come from the catalog call, so you never hard-code a rate.
| Key | Product | Min order | Best for |
|---|---|---|---|
residential | Core Residential | 6 GB | Everyday rotating residential IPs with country targeting |
premium | Premium Residential | 2 GB | State, city and ASN targeting, and sticky sessions with a length you set |
isp | ISP Rotating | 4 GB | Rotating ISP-registered IPs on datacenter infrastructure (currently US only) |
mobile | Mobile Proxies | 2 GB | Real carrier IPs for mobile-only targets |
ipv4 | Datacenter IPv4 | 6 GB | Workloads compatible with datacenter IPv4 network addresses (currently US only) |
ipv6 | IPv6 Proxies | 18 GB | Workloads that support IPv6 addressing and require an IPv6-compatible connection (currently US only) |
Min order is the fewest whole GB that reach the $5 minimum top-up at each product's rate. Pay-as-you-go top-ups of 100 GB or more include a 10% volume bonus, and a single order is capped at 10,000 GB.
Generating proxies
Generation is free and instant — bandwidth is only consumed when traffic flows through a proxy. Every parameter is optional; omit one and the API's default applies. (Names follow each language's conventions, e.g. stickyMinutes / sticky_minutes / StickyMinutes.)
| Parameter | Type | What it does | |
|---|---|---|---|
protocol | "http" \ | "socks5" | Proxy protocol. Default http (which also carries HTTPS). Check plan.generate.protocols for what a product supports |
count | integer 1–1000 | How many proxy lines to return. Default 1 | |
country | ISO 3166-1 alpha-2 | e.g. US, DE, JP. Omit for a worldwide IP | |
state | string | State or region, where the product supports it | |
city | string | City, where the product supports it | |
isp | string | Network / carrier, where the product supports it | |
stickyMinutes | integer | Sticky session: on Premium Residential it sets the length (3 minutes to 24 hours), and on Core Residential it turns sticky on. Omit for a fresh IP on every request. The maximum is plan.generate.maxStickyMinutes; 0 there means the product has no sticky sessions |
Each returned line is username:password@host:port with your targeting encoded in the username. Lines are on-demand and not persistent — generate fresh ones when you need them instead of storing them, because credentials can rotate when the pool moves.
Retries & rate limits
Every SDK retries for you, with the same rules:
- Rate limits (`429`) are always retried, waiting for the
Retry-Afterthe API sends (capped at 30 s) or an exponential back-off with jitter. - Reads (
GET) are also retried on502/503/504and on network failures. - Writes are not retried on server errors — a repeated checkout or allocation must never double-charge — unless you attach an idempotency key (see below), which makes the retry provably safe.
- The default is 2 retries; set it to 0 to turn retries off. After the last attempt you get the typed error.
The API allows 60 requests per minute per key. Batch with count (up to 1000 lines per call) rather than looping over single-proxy calls.
Idempotency
Allocating bandwidth to a customer moves real GB, so it accepts an idempotency key. Send the same key twice and the second call moves nothing and returns alreadyApplied: true with the same result — safe to retry after a timeout or crash.
Use a value you can derive again from your own data (an order id, an invoice number), not a random value created per attempt. Keys are scoped to your account and may be up to 200 characters.
At a glance
| Language | Package | Runtime | Dependencies | Calls | Proxy helpers |
|---|---|---|---|---|---|
| Go | …/buyproxy-go | 1.21+ | none | context | *http.Client, env, curl |
The Go SDK's source is at github.com/DishantSinghDev2/buyproxy-go. Building something bigger? Start at the developer hub.
Was this page helpful?