Calculate an order
Updated:
Returns the order price before checkout, including discount, balance check, and warnings. Always call this before Create an order to surface validation issues without spending balance.
Endpoint:
Path parameters
Name | Type | Description |
|---|---|---|
apiKey* | String | Your personal API key. |
Request body
Name | Type | Description |
|---|---|---|
| string | Which proxy type to calculate for.
|
| number | Number of IP addresses to order. |
| number | Rental duration in days. Get valid values from Rent period. |
| string | ISO 3166-1 alpha-3 code (e.g. USA). Get valid values from Country. |
| string | Custom goal label for the order. |
| string | Discount promo code. Get valid values from Promo codes. |
Additional fields when proxyType=MOBILE
Name | Type | Description |
|---|---|---|
rotationTime* | number | Rotation interval in seconds. Get valid values from Mobile operator. |
mobileOperator* | string | Operator tag. Get valid values from Mobile operator. |
Examples
curl -X POST https://youproxy.io/client/api/v1/$KEY/calculate/order \
-H "Content-Type: application/json" \
-d '{
"proxyType": "IPv4",
"quantity": 5,
"rentPeriodDays": 30,
"country": "USA",
"goal": "scraping",
"promoCode": "SAVE10"
}'curl -X POST https://youproxy.io/client/api/v1/$KEY/calculate/order \
-H "Content-Type: application/json" \
-d '{
"proxyType": "IPv6",
"quantity": 5,
"rentPeriodDays": 30,
"country": "USA",
"goal": "scraping",
"promoCode": "SAVE10"
}'# MOBILE β note the extra fields
curl -X POST https://youproxy.io/client/api/v1/$KEY/calculate/order \
-H "Content-Type: application/json" \
-d '{
"proxyType": "MOBILE",
"quantity": 5,
"rentPeriodDays": 30,
"country": "USA",
"goal": "scraping",
"rotationTime": 300,
"mobileOperator": "verizon"
}'curl -X POST https://youproxy.io/client/api/v1/$KEY/calculate/order \
-H "Content-Type: application/json" \
-d '{
"proxyType": "ISP",
"quantity": 5,
"rentPeriodDays": 30,
"country": "USA",
"goal": "scraping",
"promoCode": "SAVE10"
}'Response
{
"success": true,
"proxyType": "IPv4",
"balance": 7.18,
"price": 1.31,
"currency": "USD",
"discount": 0,
"promoCodeStatus": null,
"error": null,
"warnings": null
}If there're warnings, the order with current data won't be executed.
{
"success": true,
"proxyType": "IPv4",
"balance": 7.18,
"price": 22.61,
"currency": "USD",
"discount": 0,
"promoCodeStatus": null,
"error": null,
"warnings": [
{
"code": 14,
"message": "Incorrect goal"
},
{
"code": 16,
"message": "Insufficient funds on balance"
}
]
}{
"success": true,
"proxyType": "IPv4",
"balance": 7.18,
"price": 1.18,
"currency": "USD",
"discount": 10,
"promoCodeStatus": "VALID",
"error": null,
"warnings": null
}{
"success": true,
"proxyType": "IPv4",
"balance": 7.18,
"price": 1.31,
"currency": "USD",
"discount": 0,
"promoCodeStatus": "NO_VALID",
"error": null,
"warnings": null
}{
"success": false,
"proxyType": null,
"balance": 7.18,
"price": null,
"currency": "USD",
"discount": null,
"promoCodeStatus": null,
"error": {
"code": 4,
"message": "Incorrect proxy type"
},
"warnings": null
}Response fields
Field | Type | Description |
|---|---|---|
| boolean |
|
| string | null | Echoes the requested type. |
| number | Account balance in |
| number | null | Calculated total. |
| string | ISO currency code (e.g. USD). |
| number | null | Discount percentage applied (e.g. 10 means 10%). |
| string | null |
|
| array | null | Non-blocking issues. If present, the order won't go through with current data β fix and retry. |
| object | null |
|