# Hosts

## Get  all hosts

This request will return all hosts to which you are connected.

<mark style="color:blue;">`GET`</mark> `https://mobile.proxy-seller.com/api/v1/hosts`

**Exalpme**

```
https://mobile.proxy-seller.com/api/v1/hosts
```

**Headers**

<table><thead><tr><th width="371">Name</th><th>Value</th></tr></thead><tbody><tr><td>Content-Type</td><td><code>application/json</code></td></tr><tr><td>Authorization<mark style="color:red;">*</mark></td><td><code>&#x3C;YOUR_API_TOKEN></code></td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
[
  {
    "id": "21vjv1224n45v7457mvcas",
    "name": "Host Number 1",
    "number": "101"
  }
]
```

{% endtab %}

{% tab title="401" %}

```
AUTHORIZATION_FAILED,
IP_AUTHORIZATION_FAILED
```

{% endtab %}
{% endtabs %}

## Get modems

<mark style="color:blue;">`GET`</mark> `https://mobile.proxy-seller.com/api/v1/hosts/{hostId}/modems`

This query will return all your modems that are connected to the specified host ID

**Example**

```
https://mobile.proxy-seller.com/api/v1/hosts/21vjv1224n45v7457mvcas/modems
```

**Path Parameters**

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| hostId<mark style="color:red;">\*</mark> | String | Id of host  |

**Headers**

<table><thead><tr><th width="371">Name</th><th>Value</th></tr></thead><tbody><tr><td>Content-Type</td><td><code>application/json</code></td></tr><tr><td>Authorization<mark style="color:red;">*</mark></td><td><code>&#x3C;YOUR_API_TOKEN></code></td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
[
  {
    "id": "63c234098746e15666325bf9f",
    "ip": "",
    "use": false,
    "status": "DOWN",
    "ipProxy": "101.111.44.191",
    "portHttp": "40303",
    "portSocks": "50303",
    "simProvider": "MTS UKR",
    "simNumber": null,
    "hostId": "21vjv1224n45v7457mvcas"
  }
]
```

{% endtab %}

{% tab title="401" %}

```
AUTHORIZATION_FAILED,
IP_AUTHORIZATION_FAILED,
HOST_USER_ID_AND_AUTH_DOES_NOT_MATCH
```

{% endtab %}

{% tab title="400" %}

```
INVALID_HOST_ID
```

{% endtab %}

{% tab title="404" %}

```
INVALID_HOST
```

{% endtab %}
{% endtabs %}

## Change host name

<mark style="color:purple;">`PATCH`</mark> `https://mobile.proxy-seller.com/api/v1/hosts/{hostId}/changeName`

This request change the name of  host.

**Example**

```
https://mobile.proxy-seller.com/api/v1/hosts/21vjv1224n45v7457mvcas/changeName
```

**Path parameters**

| Name                                     | Type   | Description  |
| ---------------------------------------- | ------ | ------------ |
| hostId<mark style="color:red;">\*</mark> | String | id  of  host |

**Headers**

<table><thead><tr><th width="371">Name</th><th>Value</th></tr></thead><tbody><tr><td>Content-Type</td><td><code>application/json</code></td></tr><tr><td>Authorization<mark style="color:red;">*</mark></td><td><code>&#x3C;YOUR_API_TOKEN></code></td></tr></tbody></table>

**Request body**

| Name                                   | Type   | Description   |
| -------------------------------------- | ------ | ------------- |
| name<mark style="color:red;">\*</mark> | String | new host name |

**Example request body**

```json
{
    "name": "Host new name"
}
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "id": "21vjv1224n45v7457mvcas",
    "name": "Host new name",
    "number": "101"
}
```

{% endtab %}

{% tab title="401" %}

```
AUTHORIZATION_FAILED,
IP_AUTHORIZATION_FAILED,
HOST_USER_ID_AND_AUTH_DOES_NOT_MATCH
```

{% endtab %}

{% tab title="400" %}

```
INVALID_HOST_ID,
```

{% endtab %}

{% tab title="404" %}

```
HOST_NOT_FOUND
```

{% endtab %}
{% endtabs %}

## Reboot all modems

Reboot all modems within the host.

<mark style="color:purple;">`PATCH`</mark> `https://mobile.proxy-seller.com/api/v1/hosts/{hostId}/reboot`

This request reboot all modems on the selected host.

Example:&#x20;

```
https://mobile.proxy-seller.com/api/v1/hosts/21vjv1224n45v7457mvcas/reboot
```

**Headers**

<table><thead><tr><th width="371">Name</th><th>Value</th></tr></thead><tbody><tr><td>Content-Type</td><td><code>application/json</code></td></tr><tr><td>Authorization<mark style="color:red;">*</mark></td><td><code>&#x3C;YOUR_API_TOKEN></code></td></tr></tbody></table>

Path Parameters

| Name                                     | Type   | Description  |
| ---------------------------------------- | ------ | ------------ |
| hostId<mark style="color:red;">\*</mark> | String | id  of  host |

**Response**

{% tabs %}
{% tab title="200" %}
successful answer has no body, the success state is determined by the status 200
{% endtab %}

{% tab title="401" %}

```
AUTHORIZATION_FAILED,
IP_AUTHORIZATION_FAILED,
HOST_USER_ID_AND_AUTH_DOES_NOT_MATCH
```

{% endtab %}

{% tab title="400" %}

```
INVALID_HOST_ID,
```

{% endtab %}
{% endtabs %}

## Export info all modems

Downloading information from all modems within the host.

<mark style="color:green;">`POST`</mark> `https://mobile.proxy-seller.com/api/v1/hosts/{hostId}/export`

This request return file with modems info  form one selected host

Example:&#x20;

```
https://mobile.proxy-seller.com/api/v1/hosts/21vjv1224n45v7457mvcas/export
```

**Headers**

<table><thead><tr><th width="371">Name</th><th>Value</th></tr></thead><tbody><tr><td>Content-Type</td><td><code>application/json</code></td></tr><tr><td>Authorization<mark style="color:red;">*</mark></td><td><code>&#x3C;YOUR_API_TOKEN></code></td></tr></tbody></table>

Path Parameters

| Name                                     | Type   | Description  |
| ---------------------------------------- | ------ | ------------ |
| hostId<mark style="color:red;">\*</mark> | String | id  of  host |

**Body**

| Name                                        | Type                          | Description                                         |
| ------------------------------------------- | ----------------------------- | --------------------------------------------------- |
| extension<mark style="color:red;">\*</mark> | enum: \["txt", "csv", "xlsx"] | file extension for which the data will be formatted |
| fileName                                    | String                        | name of file                                        |
| format                                      | String                        | the column order of the source file                 |

{% hint style="warning" %}
format can consist of the values: "%number%, %ip%, %use%". The values should be specified in any order you like, comma-separated, without spaces. in case of absence of format, the default format is used.
{% endhint %}

**Example request body:**

```json
{
    "extension": "txt",
    "format": "%number%,%ip%,%use%",
    "fileName": "test"
}
```

**Response**

{% tabs %}
{% tab title="200" %}

```
%number%,%ip%,%use%
101,101.111.44.191,false

```

{% endtab %}

{% tab title="401" %}

```
AUTHORIZATION_FAILED,
IP_AUTHORIZATION_FAILED,
HOST_USER_ID_AND_AUTH_DOES_NOT_MATCH
```

{% endtab %}

{% tab title="400" %}

```
INVALID_HOST_ID,
```

{% endtab %}
{% endtabs %}
