# Calculate an order

## IPv4 type

The request allows to calculate the price before ordering for proxy type IPv4.

<mark style="color:purple;">POST</mark> `/client/api/v1/`<mark style="color:purple;">`{apiKey}`</mark>`/calculate/order`

### **Path parameters**

| Name                                     | Type   | Description            |
| ---------------------------------------- | ------ | ---------------------- |
| apiKey<mark style="color:red;">\*</mark> | String | Your personal API key. |

### **Request body**

| Name                                             | Type   | Description                                                               |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------- |
| proxyType<mark style="color:red;">\*</mark>      | String | Proxy type IPv4.                                                          |
| promoCode                                        | String | Code of the promo code (can be obtained by another request).              |
| quantity<mark style="color:red;">\*</mark>       | Number | Quantity of IP addresses.                                                 |
| rentPeriodDays<mark style="color:red;">\*</mark> | Number | Number of days in the rental period (can be obtained by another request). |
| goal<mark style="color:red;">\*</mark>           | String | Custom goal.                                                              |
| country<mark style="color:red;">\*</mark>        | String | Alfa3 country code (can be obtained by another request).                  |

### Response

<details>

<summary>200: OK Success response</summary>

```javascript
{
    "success": true,
    "proxyType": "IPv4",
    "balance": 7.18,
    "price": 1.31,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": null,
    "error": null,
    "warnings": null
}
```

</details>

<details>

<summary>200: OK Success response with warnings</summary>

{% hint style="warning" %}
If there're warnings, the order with current data won't be executed.
{% endhint %}

```javascript
{
    "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"
        }
    ]
}
```

</details>

<details>

<summary>200: OK Success response with valid promo code</summary>

```javascript
{
    "success": true,
    "proxyType": "IPv4",
    "balance": 7.18,
    "price": 1.18,
    "currency": "USD",
    "discount": 10,
    "promoCodeStatus": "VALID",
    "error": null,
    "warnings": null
}
```

</details>

<details>

<summary>200: OK Success response with invalid promo code</summary>

```javascript
{
    "success": true,
    "proxyType": "IPv4",
    "balance": 7.18,
    "price": 1.31,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": "NO_VALID",
    "error": null,
    "warnings": null
}
```

</details>

<details>

<summary>200: OK Error response</summary>

```javascript
{
    "success": false,
    "proxyType": null,
    "balance": 7.18,
    "price": null,
    "currency": "USD",
    "discount": null,
    "promoCodeStatus": null,
    "error": {
        "code": 4,
        "message": "Incorrect proxy type"
    },
    "warnings": null
}
```

</details>

## IPv6 type

The request allows to calculate the price before ordering for proxy type IPv6.

<mark style="color:purple;">POST</mark> `/client/api/v1/`<mark style="color:purple;">`{apiKey}`</mark>`/calculate/order`

### **Path parameters**

| Name                                     | Type   | Description            |
| ---------------------------------------- | ------ | ---------------------- |
| apiKey<mark style="color:red;">\*</mark> | String | Your personal API key. |

### **Request body**

| Name                                             | Type   | Description                                                               |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------- |
| proxyType<mark style="color:red;">\*</mark>      | String | Proxy type IPv6.                                                          |
| promoCode                                        | String | Code of the promo code (can be obtained by another request).              |
| quantity<mark style="color:red;">\*</mark>       | Number | Quantity of IP addresses.                                                 |
| rentPeriodDays<mark style="color:red;">\*</mark> | Number | Number of days in the rental period (can be obtained by another request). |
| goal<mark style="color:red;">\*</mark>           | String | Custom goal.                                                              |
| country<mark style="color:red;">\*</mark>        | String | Alfa3 country code (can be obtained by another request).                  |

<details>

<summary>200: OK Success response</summary>

```javascript
{
    "success": true,
    "proxyType": "IPv6",
    "balance": 7.18,
    "price": 2.05,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": null,
    "error": null,
    "warnings": null
}
```

</details>

<details>

<summary>200: OK Success response with warnings</summary>

{% hint style="warning" %}
If there're warnings, the order with current data won't be executed.
{% endhint %}

```javascript
{
    "success": true,
    "proxyType": "IPv6",
    "balance": 7.18,
    "price": 21.32,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": null,
    "error": null,
    "warnings": [
        {
            "code": 14,
            "message": "Incorrect goal"
        },
       
        {
            "code": 16,
            "message": "Insufficient funds on balance"
        }
    ]
}
```

</details>

<details>

<summary>200: OK Success response with valid promo code</summary>

```javascript
{
    "success": true,
    "proxyType": "IPv6",
    "balance": 7.18,
    "price": 1.85,
    "currency": "USD",
    "discount": 10,
    "promoCodeStatus": "VALID",
    "error": null,
    "warnings": null
}
```

</details>

<details>

<summary>200: OK Success response with invalid promo code</summary>

```javascript
{
    "success": true,
    "proxyType": "IPv6",
    "balance": 7.18,
    "price": 2.05,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": "NO_VALID",
    "error": null,
    "warnings": null
}
```

</details>

<details>

<summary>200: OK Error response</summary>

```javascript
{
    "success": false,
    "proxyType": null,
    "balance": 7.18,
    "price": null,
    "currency": "USD",
    "discount": null,
    "promoCodeStatus": null,
    "error": {
        "code": 4,
        "message": "Incorrect proxy type"
    },
    "warnings": null
}
```

</details>

## Mobile type

The request allows to calculate the price before ordering for proxy type MOBILE.

<mark style="color:purple;">POST</mark> `/client/api/v1/`<mark style="color:purple;">`{apiKey}`</mark>`/calculate/order`

### **Path parameters**

| Name                                     | Type   | Description            |
| ---------------------------------------- | ------ | ---------------------- |
| apiKey<mark style="color:red;">\*</mark> | String | Your personal API key. |

### **Request body**

| Name                                             | Type   | Description                                                               |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------- |
| proxyType<mark style="color:red;">\*</mark>      | String | Proxy type MOBILE.                                                        |
| rotationTime<mark style="color:red;">\*</mark>   | Number | Rotation time (can be obtained by another request with mobile operators). |
| mobileOperator<mark style="color:red;">\*</mark> | String | Mobile operator tag (can be obtained by another request).                 |
| quantity<mark style="color:red;">\*</mark>       | Number | Quantity of IP addresses.                                                 |
| rentPeriodDays<mark style="color:red;">\*</mark> | Number | Number of days in the rental period (can be obtained by another request). |
| goal<mark style="color:red;">\*</mark>           | String | Custom goal.                                                              |
| country<mark style="color:red;">\*</mark>        | String | Alfa3 country code (can be obtained by another request).                  |
| promoCode                                        | String | Code of the promo code (can be obtained by another request).              |

<details>

<summary>200: OK Success response</summary>

```javascript
{
    "success": true,
    "proxyType": "MOBILE",
    "balance": 7.18,
    "price": 2.05,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": null,
    "error": null,
    "warnings": null
}
```

</details>

<details>

<summary>200: OK Success response with warnings</summary>

{% hint style="warning" %}
If there're warnings, the order with current data won't be executed.
{% endhint %}

```javascript
{
    "success": true,
    "proxyType": "MOBILE",
    "balance": 7.18,
    "price": 21.32,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": null,
    "error": null,
    "warnings": [
        {
            "code": 14,
            "message": "Incorrect goal"
        },
       
        {
            "code": 16,
            "message": "Insufficient funds on balance"
        }
    ]
}
```

</details>

<details>

<summary>200: OK Success response with valid promo code</summary>

```javascript
{
    "success": true,
    "proxyType": "MOBILE",
    "balance": 7.18,
    "price": 2.05,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": "VALID",
    "error": null,
    "warnings": null
}
```

</details>

<details>

<summary>200: OK Success response with invalid promo code</summary>

```javascript
{
    "success": true,
    "proxyType": "MOBILE",
    "balance": 7.18,
    "price": 2.05,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": "NO_VALID",
    "error": null,
    "warnings": null
}
```

</details>

<details>

<summary>200: OK Error response</summary>

```javascript
{
    "success": false,
    "proxyType": null,
    "balance": 7.18,
    "price": null,
    "currency": "USD",
    "discount": null,
    "promoCodeStatus": null,
    "error": {
        "code": 4,
        "message": "Incorrect proxy type"
    },
    "warnings": null
}
```

</details>

## ISP type

The request allows to calculate the price before ordering for proxy type ISP.

<mark style="color:purple;">POST</mark> `/client/api/v1/`<mark style="color:purple;">`{apiKey}`</mark>`/calculate/order`

### **Path parameters**

| Name                                     | Type   | Description            |
| ---------------------------------------- | ------ | ---------------------- |
| apiKey<mark style="color:red;">\*</mark> | String | Your personal API key. |

### **Request body**

| Name                                             | Type   | Description                                                               |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------- |
| proxyType<mark style="color:red;">\*</mark>      | String | Proxy type ISP.                                                           |
| promoCode                                        | String | Code of the promo code (can be obtained by another request).              |
| quantity<mark style="color:red;">\*</mark>       | Number | Quantity of IP addresses.                                                 |
| rentPeriodDays<mark style="color:red;">\*</mark> | Number | Number of days in the rental period (can be obtained by another request). |
| goal<mark style="color:red;">\*</mark>           | String | Custom goal.                                                              |
| country<mark style="color:red;">\*</mark>        | String | Alfa3 country code (can be obtained by another request).                  |

### Response

<details>

<summary>200: OK Success response</summary>

```javascript
{
    "success": true,
    "proxyType": "ISP",
    "balance": 7.18,
    "price": 2.65,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": null,
    "error": null,
    "warnings": null
    ]
}
```

</details>

<details>

<summary>200: OK Success response with warnings</summary>

{% hint style="warning" %}
If there're warnings, the order with current data won't be executed.
{% endhint %}

```javascript
{
    "success": true,
    "proxyType": "ISP",
    "balance": 7.18,
    "price": 8.30,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": null,
    "error": null,
    "warnings": [
        {
            "code": 16,
            "message": "Insufficient funds on balance"
        }
    ]
}
```

</details>

<details>

<summary>200: OK Success response with valid promo code</summary>

```javascript
{
    "success": true,
    "proxyType": "ISP",
    "balance": 7.18,
    "price": 2.65,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": "VALID",
    "error": null,
    "warnings": null
    ]
}
```

</details>

<details>

<summary>200: OK Success response with invalid promo code</summary>

```javascript
{
    "success": true,
    "proxyType": "ISP",
    "balance": 7.18,
    "price": 2.65,
    "currency": "USD",
    "discount": 0,
    "promoCodeStatus": "NO_VALID",
    "error": null,
    "warnings": null
    ]
}
```

</details>

<details>

<summary>200: OK Error response</summary>

```javascript
{
    "success": false,
    "proxyType": null,
    "balance": 0.65,
    "price": null,
    "currency": "USD",
    "discount": null,
    "promoCodeStatus": null,
    "error": {
        "code": 24,
        "message": "Incorrect ip addresses"
    },
    "warnings": null
}
```

</details>
