CLI · Proxies
buyproxy generate
Generate proxies — rotating or sticky, geo-targeted, in the format you need.
Usage
$ buyproxy generate [product] [-c US] [--state S] [--city C] [-n 5] [-s 10] [--socks5] [-f url|plain|json|env|curl|playwright|requests] [--copy]Aliases: buyproxy gen, buyproxy g
generate is the command you'll use most. It asks BuyProxy for fresh proxy lines against one of your plans and prints them ready to paste: as URLs, as host:port:user:pass style lines, as shell exports, as a Playwright config, and more.
Generation costs nothing — bandwidth is only used when traffic flows through a proxy — so it's fine to generate again whenever you need a new IP. Lines are not saved anywhere; generate fresh ones rather than storing them.
Options
| Option | What it does |
|---|---|
| [product] | Which plan to use, by product key (residential, premium, isp, mobile, ipv4, ipv6) or a unique part of its name. Optional when you only hold one plan. |
| --plan <id> | Use a specific plan id (from buyproxy plans) instead of a product. |
| -c, --country <XX> | Two-letter ISO country code, e.g. US, DE, JP. Omit for a worldwide IP. |
| --state <name> | State or region, where the product supports it. |
| --city <name> | City, where the product supports it. |
| --isp <name> | Network or carrier, where the product supports it. |
| -n, --count <n> | How many proxies to return (1–1000).Default: 1. |
| -s, --sticky <minutes> | Keep the same IP for this many minutes. Leave it out for a fresh IP on every request. |
| --socks5 | Generate SOCKS5 proxies instead of HTTP. |
| -f, --format <format> | How to print the result: url, plain, json, env, curl, playwright or requests.Default: url in a terminal, plain when piped. |
| --copy | Also copy the printed output to your clipboard. |
Plus the global options (--json, --key, --no-color, --help).
How it works
- The CLI loads your plans and picks one: the
--planid if you gave one, otherwise the plan matching[product], otherwise your only plan. With several plans and no hint it shows a menu in a terminal, or exits with a clear error when piped. - Run with no arguments in a terminal and it walks you through it — country, state and city (only the fields that plan supports), how many, a sticky window (only if the product has sticky sessions), and HTTP or SOCKS5.
- It asks the API to generate and prints the proxies in the chosen format. In a terminal you get a boxed, colour-coded result (long lists show the first 12 and tell you how many more); when piped you get only the data.
- If the plan has no bandwidth left it warns you, because new connections will fail until you top up.
Targeting is baked into each line's username, so the same line always means "a US/Austin exit" — you can hand it to any HTTP client.
Examples
Guided mode
$ buyproxy generate? Country code (blank = anywhere) US
? State / region (blank = any)
? City (blank = any) Austin
? How many proxies? 3
? Sticky session in minutes (blank = rotate every request, max 60)
? Protocol HTTP / HTTPS
╭─ 3 proxies · Austin, US · rotating ──────────────────────────────╮
│ http://user-country-us-city-austin:s3cr3tA@gw.buyproxy.org:6969 │
│ http://user2-country-us-city-austin:s3cr3tB@gw.buyproxy.org:6969 │
│ http://user3-country-us-city-austin:s3cr3tC@gw.buyproxy.org:6969 │
╰──────────────────────────────────────────────────────────────────╯Only the questions your plan supports are asked.
Ten US proxies, no questions
$ buyproxy generate residential -c US -n 10Passing any argument skips the guided prompts.
Sticky German session for 30 minutes, copied to the clipboard
$ buyproxy generate premium -c DE --city Berlin -s 30 --copyA sticky window keeps the same IP for that long, up to the plan's maximum.
SOCKS5
$ buyproxy generate isp --socks5 -n 5Export into your shell
$ eval "$(buyproxy generate residential -c US -f env)"
$ curl https://api.ipify.orgenv prints export HTTP_PROXY=… / HTTPS_PROXY / ALL_PROXY for the first proxy, so every tool that honours them uses it.
A list for another program
$ buyproxy generate -n 100 -f plain > proxies.txtplain prints one username:password@host:port per line.
Paste straight into code
$ buyproxy generate -c US -f playwright --copy
$ buyproxy generate -f requests
$ buyproxy generate -f curlplaywright and requests print a ready snippet using the first proxy; curl prints a command that fetches your exit IP.
JSON output
With --json (or -f json) you get an array, one object per proxy:
[
{
"host": "gw.buyproxy.org",
"port": 6969,
"username": "user-country-us-city-austin",
"password": "s3cr3tA",
"protocol": "http",
"url": "http://user-country-us-city-austin:s3cr3tA@gw.buyproxy.org:6969"
}
]Troubleshooting
| You see | How to fix it |
|---|---|
| You don't have any bandwidth yet. | Buy some with buyproxy topup. |
| You don't have a plan for "mobile". | The error lists the products you do have; top up the one you want, or pass --plan <id>. |
| You have several plans — say which one. | Piped output can't show a menu. Pass a product (buyproxy generate residential) or --plan <id>. |
| --country takes a 2-letter ISO code like US or DE. | Use the two-letter code, not the country name. |
| This plan doesn't support that combination of options. | Not every product supports every option. Run buyproxy plans to see each plan's protocols, targeting fields and sticky limit. |
Tips
Use
-f plainfor files and-f urlfor code — URLs have special characters in the password percent-encoded for you.Hitting the 60 requests/minute limit? Ask for more per call:
-n 1000is one request.buyproxy testproves a generated proxy actually works end to end.
Related commands
Was this page helpful?