Generate dynamic proxy credentials
Generate a set of proxy connection credentials for an existing dynamic sub-account. You can select an exit region and a rotation mode.
API information
| Item | Value |
|---|---|
| Method | POST |
| Path | /open-api/v1/dynamic/accounts/{id}/proxy-credentials |
| Authentication | X-API-Key |
| Content-Type | application/json |
| Processing | Synchronous |
Path parameter
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
string | Yes | Dynamic sub-account ID |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
country_code |
string | No | Country code returned by the regions API |
province_code |
string | No | Province/state code; requires a country code |
city_code |
string | No | City code; requires both country and province/state codes |
rotation_type |
string | Yes | ROTATING or STICKY |
session_duration_minutes |
integer | Conditional | STICKY session duration; currently supported range is 1–120 minutes |
To select an exit region, provide the country and any applicable province/state and city. Use the region codes exactly as returned by the regions API, preserving case and characters within each code. Omit all three region fields to use the default exit.
- For
ROTATING, omitsession_duration_minutes. - For
STICKY, setsession_duration_minutesto an integer from1to120.
Request examples
Rotating mode:
curl --request POST \
--url 'https://api.puraroute.com/gin/open-api/v1/dynamic/accounts/1912345678901234567/proxy-credentials' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <YOUR_API_KEY>' \
--data '{
"country_code": "<COUNTRY_CODE>",
"rotation_type": "ROTATING"
}'
Sticky-session mode:
{
"country_code": "<COUNTRY_CODE>",
"province_code": "<PROVINCE_CODE>",
"city_code": "<CITY_CODE>",
"rotation_type": "STICKY",
"session_duration_minutes": 30
}
Replace the example placeholders with the region_code returned for each level. To list cities, provide both the country and province/state codes. List dynamic proxy regions
Response fields
| Field | Type | Description |
|---|---|---|
proxy_username |
string | Proxy username generated for the selected region and rotation mode |
password |
string | Proxy connection password |
host |
string | Proxy connection hostname |
http_port |
integer | HTTP proxy port |
socks5_port |
integer | SOCKS5 proxy port |
Successful response example
{
"code": 0,
"msg": "success",
"data": {
"proxy_username": "example-proxy-user",
"password": "example-secret",
"host": "gateway.example.com",
"http_port": 8000,
"socks5_port": 1080
},
"next": null
}
Possible error codes
code |
Description |
|---|---|
300001 |
The dynamic sub-account does not exist or is inaccessible |
300323 |
The specified region does not exist, is unavailable, or does not support credential generation |
300370 |
The source IP address is outside the allowlist |
400001 |
Authentication failed |
400009 |
The region hierarchy, rotation mode, session duration, or request body is invalid |
500000 |
System processing failed; the request did not complete |
Use the returned username and password as provided. Use http_port for an HTTP proxy connection or socks5_port for SOCKS5. Keep connection credentials out of ordinary logs, front-end source, and public support tickets.