OpenAPI Documentation
OpenAPI Documentation
Generate dynamic proxy credentials
Generate one complete set of proxy connection credentials using an optional region and a rotation mode. This operation does not create a new dynamic sub-account.
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 |
Region fields must be continuous. Do not provide a province/state or city without its parents. Omit all three region fields when no region is specified.
ROTATING: Do not providesession_duration_minutes.STICKY: Integersession_duration_minutesis required. The currently supported range is1–120minutes. Values greater than120may be accepted but are outside the supported range, and the actual session duration is not guaranteed.
Request examples
Rotating mode:
curl --request POST \
--url 'https://api-test.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": "US",
"rotation_type": "ROTATING"
}'
Sticky-session mode:
{
"country_code": "US",
"province_code": "US_CA",
"rotation_type": "STICKY",
"session_duration_minutes": 30
}
Region values above illustrate field relationships only. Obtain actual values from 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": "customer-zone-us-session-example",
"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 |
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 |
Every response field is sensitive. Do not write it to ordinary logs, front-end page source, or public support tickets.