# Extend proxies

{% hint style="info" %}
This document provides a detailed guide on how to set up automatic renewal for your IP addresses of various types. Please note that IP addresses must be renewed on time to maintain the same addresses.
{% endhint %}

### Calculate extension

This endpoint helps you calculate the cost. Discounts for volume and rental periods are similar to those offered by our service.

### **Endpoint:**

<mark style="color:green;">`POST`</mark> `https://proxy-seller.com/personal/api/v1/`**`{YourApiKey}`**`/prolong/calc/`**`{type}`**

#### **Example** (e.g. ipv4)**:**

```
https://proxy-seller.com/personal/api/v1/fj4948ffhg58gh843gh/prolong/calc/ipv4
```

### **Response:**

{% tabs %}
{% tab title="200: OK Success response " %}

```json
{
  "status": "success",
  "data": {
    "warning": "",
    "balance": 40.4,
    "total": 35.1,
    "quantity": 5,
    "currency": "USD",
    "discount": 0.22,
    "items": [
      {
        "id": 10,
        "order_id": 1000000,
        "order_number": "1000000_57471911",
        "base_order_number": "1000000_57471911",
        "ip": "127.0.0.1",
        "port_http": 80,
        "port_socks": 443,
        "login": "login",
        "password": "password",
        "auth_ip": "127.0.0.2",
        "country": "USA",
        "date_start": "d.m.Y H:i:s",
        "date_end": "d.m.Y H:i:s",
        "comment": "d.m.Y H:i:s",
        "status": "ACTIVE",
        "rotation": "5",
        "link_reboot": "https://proxy-seller.com/api/proxy/reboot?token=12345",
        "can_prolong": true
      }
    ],
    "orders": 2
  },
  "errors": []
}
```

{% endtab %}

{% tab title="200: OK Error response Insufficient fund on balance" %}

```json
{
  "status": "error",
  "data": {
    "warning": "Insufficient funds. Total $2. Not enough $33.10",
    "balance": 2,
    "total": 35.1,
    "quantity": 5,
    "currency": "USD",
    "discount": 0.22,
    "items": [
      {
        "id": 10,
        "order_id": 1000000,
        "ip": "127.0.0.1",
        "port_http": 80,
        "port_socks": 443,
        "login": "login",
        "password": "password",
        "auth_ip": "127.0.0.2",
        "country": "USA",
        "date_start": "d.m.Y H:i:s",
        "date_end": "d.m.Y H:i:s",
        "comment": "d.m.Y H:i:s",
        "status": "ACTIVE",
        "rotation": "5",
        "link_reboot": "https://proxy-seller.com/api/proxy/reboot?token=12345",
        "can_prolong": true
      }
    ],
    "orders": 2
  },
  "errors": []
}
```

{% endtab %}

{% tab title="200: OK Error response Wrong periodId" %}

```json
{
    "status": "error",
    "data": null,
    "errors": [
        {
            "message": "Set existed [periodId] from reference",
            "code": 0,
            "customData": null
        }
    ]
}
```

{% endtab %}

{% tab title="200: OK Error response Wrong ids" %}

```json
{
    "status": "error",
    "data": null,
    "errors": [
        {
            "message": "IP not found",
            "code": 0,
            "customData": null
        }
    ]
}
```

{% endtab %}
{% endtabs %}

### Path parameters:

<table data-full-width="false"><thead><tr><th width="149">Name</th><th width="300">Value</th><th>Description</th><th data-hidden></th></tr></thead><tbody><tr><td>Authorization</td><td><code>&#x3C;Your_API_Key></code></td><td>Your personal API key (<a href="../../authorization#get-your-api-keys">how to get</a>)</td><td></td></tr><tr><td>Proxy type</td><td><p><code>ipv4</code></p><p><code>ipv6</code></p><p><code>mobile</code></p><p><code>isp</code></p><p><code>mix</code></p><p><code>mix_isp</code></p></td><td>The proxy type you want to extend</td><td></td></tr></tbody></table>

### **Request body:**

<table><thead><tr><th width="129">Name</th><th width="97">Type</th><th>Description</th></tr></thead><tbody><tr><td>ids</td><td>Number</td><td>A single ID or an array of IDs in '[ ]', separated by commas (<a href="retrieve-active-proxy">how to get</a>)</td></tr><tr><td>coupon</td><td>String</td><td>The comment you want to add</td></tr><tr><td>periodId</td><td>String</td><td>ID of the period you selected in the <a href="../order-actions/complete-information">/reference/list/{type}</a>  request</td></tr><tr><td>paymentId</td><td>String</td><td>The ID of the payment system. '1' for balance, '43' for the card added to your account.</td></tr></tbody></table>

### Create a renewal order

In this section you  will learn how to create renewal order.

### **Endpoint:**

<mark style="color:green;">`POST`</mark> `https://proxy-seller.com/personal/api/v1/`**`{YourApiKey}`**`/prolong/make/{type}`

#### **Example** (e.g. ipv4)**:**

```
https://proxy-seller.com/personal/api/v1/fj4948ffhg58gh843gh/prolong/make/ipv4
```

### **Response:**

{% tabs %}
{% tab title="200: OK Success response " %}

```json
{
  "status": "success",
  "data": {
        "orderId": 3388536,
        "total": 35.1,
        "listBaseOrderNumbers": [
            "1000000_57471911"
        ],
        "balance": 40.4,
  },
  "errors": []
}
```

{% endtab %}

{% tab title="200: OK Error response Insufficient fund on balance" %}

```json
{
  "status": "error",
  "data": {
    "warning": "Insufficient funds. Total $2. Not enough $33.10",
    "balance": 2,
    "total": 35.1,
    "quantity": 5,
    "currency": "USD",
    "discount": 0.22,
    "items": [
      {
        "id": 10,
        "order_id": 1000000,
        "ip": "127.0.0.1",
        "port_http": 80,
        "port_socks": 443,
        "login": "login",
        "password": "password",
        "auth_ip": "127.0.0.2",
        "country": "USA",
        "date_start": "d.m.Y H:i:s",
        "date_end": "d.m.Y H:i:s",
        "comment": "d.m.Y H:i:s",
        "status": "ACTIVE",
        "rotation": "5",
        "link_reboot": "https://proxy-seller.com/api/proxy/reboot?token=12345",
        "can_prolong": true
      }
    ],
    "orders": 2
  },
  "errors": []
}
```

{% endtab %}

{% tab title="200: OK Error response Wrong periodId" %}

```json
{
    "status": "error",
    "data": null,
    "errors": [
        {
            "message": "Set existed [periodId] from reference",
            "code": 0,
            "customData": null
        }
    ]
}
```

{% endtab %}

{% tab title="200: OK Error response Wrong ids" %}

```json
{
    "status": "error",
    "data": null,
    "errors": [
        {
            "message": "IP not found",
            "code": 0,
            "customData": null
        }
    ]
}
```

{% endtab %}
{% endtabs %}

### **Path parametrs:**

<table data-full-width="false"><thead><tr><th width="149">Name</th><th width="300">Value</th><th>Description</th><th data-hidden></th></tr></thead><tbody><tr><td>Authorization</td><td><code>&#x3C;Your_API_Key></code></td><td>Your personal API key (<a href="../../authorization#get-your-api-keys">how to get</a>)</td><td></td></tr><tr><td>Proxy type</td><td><p><code>ipv4</code></p><p><code>ipv6</code></p><p><code>mobile</code></p><p><code>isp</code></p><p><code>mix</code></p><p><code>mix_isp</code></p></td><td>Proxy type that you want to prolong</td><td></td></tr></tbody></table>

### **Request body:**

<table><thead><tr><th width="129">Name</th><th width="97">Type</th><th>Description</th></tr></thead><tbody><tr><td>ids</td><td>Number</td><td>One or array in ids of "[ ]", separated by commas</td></tr><tr><td>coupon</td><td>String</td><td>Comment which you want to add</td></tr><tr><td>periodId</td><td>String</td><td>ID of the period you selected in the <a href="../order-actions/complete-information">/reference/list/{type}</a>  request</td></tr><tr><td>paymentId</td><td>String</td><td>Id's of payments system "1" - balance, "43" - card that you added in your cabinet</td></tr></tbody></table>
