BuyProxy logo
Log inSign up

CLI · Proxies

buyproxy generate

Generate proxies — rotating or sticky, geo-targeted, in the format you need.

Usage

shell
$ 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

OptionWhat 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.
--socks5Generate 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.
--copyAlso copy the printed output to your clipboard.

Plus the global options (--json, --key, --no-color, --help).

How it works

  1. The CLI loads your plans and picks one: the --plan id 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.
  2. 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.
  3. 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.
  4. 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

shell
$ buyproxy generate
example output
? 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

shell
$ buyproxy generate residential -c US -n 10

Passing any argument skips the guided prompts.

Sticky German session for 30 minutes, copied to the clipboard

shell
$ buyproxy generate premium -c DE --city Berlin -s 30 --copy

A sticky window keeps the same IP for that long, up to the plan's maximum.

SOCKS5

shell
$ buyproxy generate isp --socks5 -n 5

Export into your shell

shell
$ eval "$(buyproxy generate residential -c US -f env)"
$ curl https://api.ipify.org

env 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

shell
$ buyproxy generate -n 100 -f plain > proxies.txt

plain prints one username:password@host:port per line.

Paste straight into code

shell
$ buyproxy generate -c US -f playwright --copy
$ buyproxy generate -f requests
$ buyproxy generate -f curl

playwright 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:

json
[
  {
    "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 seeHow 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 plain for files and -f url for code — URLs have special characters in the password percent-encoded for you.

  • Hitting the 60 requests/minute limit? Ask for more per call: -n 1000 is one request.

  • buyproxy test proves a generated proxy actually works end to end.

Was this page helpful?