# Modem authorization

## Modem authorization

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

This query returns the authorization data by its ID.

**Example**

```
https://mobile.proxy-seller.com/api/v1/modemAuths/62326bcaf3904578675f9ef7
```

**Path parameters**

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

**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": "62326bcaf3904578675f9ef7",
  "authType": "LOGIN",
  "login": "jAck",
  "password": "re456pas",
  "ip": ""
}
```

{% endtab %}

{% tab title="401" %}

```
AUTHORIZATION_FAILED,
IP_AUTHORIZATION_FAILED,
HOST_USER_ID_AND_AUTH_DOES_NOT_MATCH
```

{% endtab %}

{% tab title="400" %}

```
INVALID_MODEM_AUTH_ID
```

{% endtab %}

{% tab title="404" %}

```
MODEM_AUTH_NOT_FOUND,
INVALID_MODEM
```

{% endtab %}
{% endtabs %}

## Create authorization

<mark style="color:green;">`POST`</mark> `https://mobile.proxy-seller.com/api/v1/modemAuths`

This request creates authorization on the modem (adds a user). For modems with the "BASIC" tariff, only one user can be installed

**Example**

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

**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                                                                                                      |
| ------------------------------------------ | ---------------------- | ---------------------------------------------------------------------------------------------------------------- |
| modemIds<mark style="color:red;">\*</mark> | Array of String        | Array of modem IDs on which the authorization method will be written                                             |
| authType<mark style="color:red;">\*</mark> | enum: \["LOGIN", "IP"] | Сan only be "LOGIN" or "IP"                                                                                      |
| ip<mark style="color:red;">\*</mark>       | String                 | IP  adress (must equal the empty string if  authType = "LOGIN")                                                  |
| login<mark style="color:red;">\*</mark>    | String                 | can only contain Latin letters, numbers and special characters (must equal the empty string if  authType = "IP") |
| password<mark style="color:red;">\*</mark> | String                 | can only contain Latin letters, numbers and special characters (must equal the empty string if  authType = "IP") |

**Example request body**

```json
{
    "modemIds": ["63c234098746e15666325bf9f"],
    "authType": "LOGIN",
    "ip": "",
    "login" "samuel",
    "password": "re129883pas",
}
```

**Response**

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

```json
{
  "modemAuth": {
    "id": "1237jj213cb7965413342665",
    "authType": "LOGIN",
    "login": "samuel",
    "password": "re129883pas",
    "ip": ""
  },
  "errors": {}
}
```

{% endtab %}

{% tab title="401" %}

```
AUTHORIZATION_FAILED,
IP_AUTHORIZATION_FAILED,
HOST_USER_ID_AND_AUTH_DOES_NOT_MATCH
```

{% endtab %}

{% tab title="400" %}

```
AUTH_OWNER_IS_NOT_MODEM,
INVALID_SYMBOLS_IN_INPUT,
INVALID_IP_ADDRESS
```

{% endtab %}

{% tab title="404" %}

```
INVALID_MODEM
```

{% endtab %}
{% endtabs %}

## Edit authorization

<mark style="color:purple;">`PUT`</mark> `https://mobile.proxy-seller.com/api/v1/modemAuths/{modemAuthId}`

This request edit authorization on the modem .

**Example**

```
https://mobile.proxy-seller.com/api/v1/modemAuths/1237jj213cb7965413342665
```

**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                                                                                                      |
| ------------------------------------------ | ---------------------- | ---------------------------------------------------------------------------------------------------------------- |
| authType<mark style="color:red;">\*</mark> | enum: \["LOGIN", "IP"] | Сan only be "LOGIN" or "IP"                                                                                      |
| ip<mark style="color:red;">\*</mark>       | String                 | IP  adress (must equal the empty string if  authType = "LOGIN")                                                  |
| login<mark style="color:red;">\*</mark>    | String                 | can only contain Latin letters, numbers and special characters (must equal the empty string if  authType = "IP") |
| password<mark style="color:red;">\*</mark> | String                 | can only contain Latin letters, numbers and special characters (must equal the empty string if  authType = "IP") |

**Example request body**

```json
{
    "authType": "LOGIN",
    "ip": "",
    "login" "samuel new name",
    "password": "new129883pas",
}
```

**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" %}

```
AUTH_OWNER_IS_NOT_MODEM,
INVALID_SYMBOLS_IN_INPUT,
INVALID_IP_ADDRESS
```

{% endtab %}

{% tab title="404" %}

```
MODEM_AUTH_NOT_FOUND
```

{% endtab %}
{% endtabs %}

## Delete authorization

<mark style="color:red;">`DELETE`</mark> `https://mobile.proxy-seller.com/api/v1/modemAuths/{modemAuthId}`

This request removes authorization from the modem (deletes the user)

**Example**

```
https://mobile.proxy-seller.com/api/v1/modemAuths/62326bcaf3904578675f9ef7
```

Path Parameters

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

**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
true
```

{% endtab %}

{% tab title="401" %}

```
AUTHORIZATION_FAILED,
IP_AUTHORIZATION_FAILED,
HOST_USER_ID_AND_AUTH_DOES_NOT_MATCH
```

{% endtab %}

{% tab title="400" %}

```
INVALID_MODEM_AUTH_ID
```

{% endtab %}

{% tab title="404" %}

```
MODEM_AUTH_NOT_FOUND
```

{% endtab %}
{% endtabs %}

## Limits authorization

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

This request returns the limits of the specified authorization (user) on the selected modem

**Example**

```
https://mobile.proxy-seller.com/api/v1/modemAuths/62326bcaf3904578675f9ef7/proxyLimit?modemId="63c234098746e15666325bf9f"
```

Path Parameters

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

**Query parameters**

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

**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" %}
{% code fullWidth="false" %}

```json
{
  "id": "652319f04cb7965413432168",
  "ownerId": "62326bcaf3904578675f9ef7",
  "speedLimit": 10000,
  "trafficLimit": 10000
}
```

{% endcode %}
{% endtab %}

{% tab title="401" %}

```
AUTHORIZATION_FAILED,
IP_AUTHORIZATION_FAILED,
HOST_USER_ID_AND_AUTH_DOES_NOT_MATCH
```

{% endtab %}

{% tab title="400" %}

```
GOT_INVALID_AUTHS_BY_OWNER
```

{% endtab %}

{% tab title="404" %}

```
MODEM_AUTH_NOT_FOUND,
INVALID_MODEM,
PROXY_LIMIT_NOT_FOUND
```

{% endtab %}
{% endtabs %}
