# Generate dynamic proxies

Generate residential or mobile proxy credentials with country, state or city targeting; ASN targeting is available for residential proxies.

- **Endpoint** `https://www.arcvenza.com/api/ProxyLogic/Generate`
- **Authentication** `Bearer account API key`
- **Protocol** `HTTPS · text/plain`

## Workflow

1. **Look up location values**

   Use Location/Search for country, state and city values, or GetAsnsByCountryCode for numeric ASNs.

2. **Build the query**

   Send MealType=basic for residential, then set quantity, gateway, session lifetime and optional exit location. The account API key identifies the user; the server selects BasicMainKey.

3. **Read proxy lines**

   A successful request returns one proxy credential per line as text/plain.

## Parameters

| Name | Location | Type | Use | Description |
| --- | --- | --- | --- | --- |
| `Authorization` | `HEADER` | `string` | Required | Bearer `<YOUR_API_KEY>`. |
| `MealType` | `QUERY` | `enum` | Required | basic for residential; mobile for mobile proxies. |
| `Num` | `QUERY` | `integer` | Required | 1–10,000 proxy lines per request. |
| `Country` | `QUERY` | `string` | Optional | Exit country value from Location/Search, such as US. If omitted, the exit country is unrestricted and State, City and Asn are ignored. |
| `State` | `QUERY` | `string` | Optional | State value returned for the selected country by Location/Search. |
| `City` | `QUERY` | `string` | Optional | City value returned for the selected state by Location/Search; send the returned value unchanged. |
| `Asn` | `QUERY` | `integer` | Residential only | For MealType=basic only: numeric ASN from GetAsnsByCountryCode, without AS; range 1–4294967295. Requires Country. Mobile proxies do not support ASN targeting. |
| `LifeTime` | `QUERY` | `integer` | Optional | Defaults to 0 (rotating). A value from 1 to 120 adds a sticky session ID with that lifetime in minutes. |
| `Server` | `QUERY` | `enum` | Optional | Connection gateway: us, eu, as or smart; default us. Smart uses the shared gateway. This does not set the exit country. |
| `Format` | `QUERY` | `enum` | Optional | 0 host:port:user:pass; 1 user:pass@host:port; 2 user:pass:host:port. |

## Examples

### Country

```bash
curl -G 'https://www.arcvenza.com/api/ProxyLogic/Generate' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  --data-urlencode 'MealType=basic' --data-urlencode 'Num=1' \
  --data-urlencode 'Country=US' --data-urlencode 'Server=us' \
  --data-urlencode 'LifeTime=5' --data-urlencode 'Format=0'
```

### State and city

```bash
curl -G 'https://www.arcvenza.com/api/ProxyLogic/Generate' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  --data-urlencode 'MealType=basic' --data-urlencode 'Num=1' \
  --data-urlencode 'Country=US' --data-urlencode 'State=CA' \
  --data-urlencode 'City=<CITY_VALUE_FROM_LOCATION_SEARCH>' \
  --data-urlencode 'Server=us' --data-urlencode 'Format=0'
```

### ASN

```bash
curl -G 'https://www.arcvenza.com/api/ProxyLogic/Generate' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  --data-urlencode 'MealType=basic' --data-urlencode 'Num=1' \
  --data-urlencode 'Country=US' --data-urlencode 'Asn=7922' \
  --data-urlencode 'Server=us' --data-urlencode 'Format=0'
```

## Success response

`200 · text/plain`

```text
proxy-us.arcvenza.com:10000:<GENERATED_USERNAME>:<GENERATED_PASSWORD>
```

## Error response

HTTP 401 means the account API key is missing, invalid, or reset. For HTTP 403, check that the key type and the requested operation are supported. Check the HTTP status before parsing the body.

```http
HTTP/1.1 401 Unauthorized
```

For JSON responses, check that `code` is `200` before using `body`. For a business error, read `message` and correct the request before retrying.

## Troubleshooting and notes

- Generated usernames and passwords are sensitive. Use the exact returned values. Region-specific routing still uses the residential BasicMainKey for metering.

## Related resources

- [API reference](/docs/api)
- [Authentication](/docs/authentication#account-api-key)

## AI integration prompt

```text
Read the Arcvenza Markdown at https://www.arcvenza.com/docs/markdown/api/generate.md and use https://www.arcvenza.com/llms.txt to find related guides. Cite https://www.arcvenza.com/docs/api/generate for this page. Ask what I want to integrate, then identify the correct product, endpoint and authentication method. Confirm the required access before sending a live request through API Playground, and show how to supply credentials through environment variables. Indicate any account, plan or usage requirements and flag anything the docs do not establish.
```

[Open API Playground](/docs/playground?endpoint=generate#send-request)

[llms.txt](/llms.txt)

