> ## Documentation Index
> Fetch the complete documentation index at: https://developers.flameproxies.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate proxies

> Generates ready-to-use proxy lines from a residential or premium residential package. Doesn't debit your balance.

Generates proxy lines from a residential or premium residential package you own, with location, session, pool, and mode parameters already encoded. It's the API version of the dashboard's [proxy generator](/dashboard/proxy-generator).

Generating proxies doesn't debit your balance. Bandwidth is only used when you send traffic through the proxies.

## How the fields map to username parameters

This endpoint takes **JSON fields**, and writes the matching **username parameters** into every line it returns. The two are named differently, so here's how they line up:

| JSON field in this request | Username parameter in the returned line |
| - | - |
| `country` | `country-<cc>` |
| `city` | `city-<city>` |
| `pool` | `pool-1` or `pool-2` |
| `fast_mode: true` | `mode-fast` |
| `udp_mode: true` | `mode-udp` |
| `proxy_type: "sticky"` and `session_time_minutes` | `session-<id>-time-<minutes>` |

So a request with `"fast_mode": true` gives you a proxy line whose username contains `mode-fast`. If you build lines yourself instead of calling this endpoint, use the username parameters directly — see the [Residential proxies](/proxies/residential#full-parameter-reference) reference.

<ParamField body="package_id" type="number" required>
  ID of the package to generate proxies for, from [list packages](/api/packages/list).
</ParamField>

<ParamField body="quantity" type="number">
  Number of proxy lines to generate.
</ParamField>

<ParamField body="format" type="string">
  Output layout of each line: `standard` (`host:port:username:password`), `secondary` (`username:password@host:port`), `http_url` (`http://username:password@host:port`), or `socks5_url` (`socks5://username:password@host:port`).
</ParamField>

<ParamField body="protocol" type="string">
  `HTTP` or `SOCKS5`. When you use SOCKS5 with URL output, use the `socks5_url` format.
</ParamField>

<ParamField body="proxy_type" type="string">
  Session type. `sticky` adds `session-<id>` to the username, which keeps the same IP for `session_time_minutes`.
</ParamField>

<ParamField body="country" type="string">
  Two-letter country code to target, for example `US`. See [Locations](/proxies/locations).
</ParamField>

<ParamField body="city" type="string">
  City to target within the country, for example `newyorkcity`.
</ParamField>

<ParamField body="pool" type="string">
  Sub-pool to draw from. `all` uses the whole network. See [Pools](/proxies/residential#pools).
</ParamField>

<ParamField body="fast_mode" type="boolean">
  Fast mode: route through the peer with the lowest latency available. Sets `mode-fast` in the username of each generated line.
</ParamField>

<ParamField body="udp_mode" type="boolean">
  UDP mode: enable UDP traffic. Sets `mode-udp` in the username of each generated line.
</ParamField>

<ParamField body="session_time_minutes" type="number">
  For sticky proxies, how many minutes each session holds its IP. Sets `time-<minutes>` in the username of each generated line.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl https://flameproxies.com/api/customer/proxies/generate \
    -H "Authorization: Bearer fp_live_xxx" \
    -H "Content-Type: application/json" \
    -d '{"package_id":123,"quantity":10,"country":"US","proxy_type":"sticky","format":"http_url"}'
  ```

  ```python Python theme={null}
  import requests

  resp = requests.post(
      "https://flameproxies.com/api/customer/proxies/generate",
      headers={"Authorization": "Bearer fp_live_xxx"},
      json={
          "package_id": 123,
          "quantity": 10,
          "format": "http_url",
          "protocol": "HTTP",
          "proxy_type": "sticky",
          "country": "US",
          "city": "newyorkcity",
          "pool": "all",
          "fast_mode": False,
          "udp_mode": False,
          "session_time_minutes": 10,
      },
  )
  for proxy in resp.json()["proxies"]:
      print(proxy)
  ```

  ```javascript Node.js theme={null}
  const resp = await fetch("https://flameproxies.com/api/customer/proxies/generate", {
    method: "POST",
    headers: {
      Authorization: "Bearer fp_live_xxx",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      package_id: 123,
      quantity: 10,
      format: "http_url",
      protocol: "HTTP",
      proxy_type: "sticky",
      country: "US",
      city: "newyorkcity",
      pool: "all",
      fast_mode: false,
      udp_mode: false,
      session_time_minutes: 10,
    }),
  });
  const { proxies } = await resp.json();
  console.log(proxies);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "package_id": 123,
    "internal_id": "70437286-78a1-427c-b9fd-c299baadf3a9",
    "subuser_id": "56789",
    "plan": "residential",
    "count": 10,
    "proxies": [
      "http://username:password@proxy.flameproxies.com:8989"
    ]
  }
  ```
</ResponseExample>

## Response

<ResponseField name="package_id" type="number">
  Numeric package ID.
</ResponseField>

<ResponseField name="internal_id" type="string">
  The package's UUID.
</ResponseField>

<ResponseField name="subuser_id" type="string">
  ID of the sub-user behind this package.
</ResponseField>

<ResponseField name="plan" type="string">
  Product: `residential` or `premium_residential`.
</ResponseField>

<ResponseField name="count" type="number">
  Number of proxy lines returned.
</ResponseField>

<ResponseField name="proxies" type="string[]">
  The generated proxy lines, in the requested `format`. Pass each one straight to your HTTP client.
</ResponseField>
