# API Keys

## Lists other API Keys attached to this account with their keyId

<mark style="color:blue;">`GET`</mark> `https://api.aquanow.io/users/v1/apiKey`

`keyId` can be helpful in retrieving rate limits for the api keys.

To view example requests for this endpoint, visit Aquanow's [Postman](https://developer.aquanow.io/#f24402ca-026c-4eff-a7b4-040972a2cd92) documentation.

#### Headers

| Name                                           | Type   | Description                                                                                                                                                     |
| ---------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| x-api-key<mark style="color:red;">\*</mark>    | String | <p><code>{{x-api-key}}</code></p><p>API Auth Key</p>                                                                                                            |
| x-signature<mark style="color:red;">\*</mark>  | String | <p><code>49c6260c194f4d7ed5cb917dc70b9821673246b2abc1cf28f05df6a75fd24181e00f8e57b321d15ae45db58b3bffe27a</code><br>Signature created using your API secret</p> |
| x-nonce<mark style="color:red;">\*</mark>      | Number | <p><code>1618307861949</code><br>Timestamp in millisecond</p>                                                                                                   |
| Content-Type<mark style="color:red;">\*</mark> | String | `application/json`                                                                                                                                              |

{% tabs %}
{% tab title="200: OK " %}
Returns an array of [APIKeysObject](https://docs.aquanow.io/aquanow/legacy/data-objects-and-statuses/accounts-objects#apikeysobject).

```json
[
  {
    "keyId": "0digjc6pq2",
    "updatedAt": 1554920562214,
    "userName": "helloWorld",
    "createdAt": 1554920562214,
    "key": "JzpgMkbrjx8JRxCUc6hw63W4xEhCWgN78TocdAKt",
    "type": "regular"
  }
]
```

{% endtab %}
{% endtabs %}

## An alternative way for creating an API key

<mark style="color:green;">`POST`</mark> `https://api.aquanow.io/users/v1/apiKey`

You need to have an existing API key to use this endpoint.\
Note that there's currently a limit of 5 active API keys per user.

To view example requests for this endpoint, visit Aquanow's [Postman](https://developer.aquanow.io/#7a051d52-32f8-4f7a-b750-31e71075c43f) documentation.

#### Headers

| Name                                           | Type   | Description                                                                                                                                                        |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| x-api-key<mark style="color:red;">\*</mark>    | String | <p><code>{{x-api-key}}</code></p><p>API Auth Key</p>                                                                                                               |
| x-signature<mark style="color:red;">\*</mark>  | String | <p><code>49c6260c194f4d7ed5cb917dc70b9821673246b2abc1cf28f05df6a75fd24181e00f8e57b321d15ae45db58b3bffe27a</code></p><p>Signature created using your API secret</p> |
| x-nonce<mark style="color:red;">\*</mark>      | Number | <p><code>1657731573930</code></p><p>Timestamp in millisecond</p>                                                                                                   |
| Content-Type<mark style="color:red;">\*</mark> | String | `application/json`                                                                                                                                                 |

{% tabs %}
{% tab title="200: OK " %}
Returns an array of [APIKeysObject](https://docs.aquanow.io/aquanow/legacy/data-objects-and-statuses/accounts-objects#apikeysobject).

<pre class="language-json"><code class="lang-json"><strong>[
</strong><strong> {
</strong>  "keyId": "cv1xbk2p68",
  "type": "regular",
  "createdAt": 1554920562214,
  "userName": "helloWorld",
  "key": "bF0fEYtL9S4w0xXYDkXR72O6tWXt4EM6rS84bHcj",
<strong> }
</strong><strong>]
</strong></code></pre>

{% endtab %}
{% endtabs %}

## Deletes API key by its keyId

<mark style="color:red;">`DELETE`</mark> `https://api.aquanow.io/users/v1/apiKey?key=<Key>`

To view example requests for this endpoint, visit Aquanow's [Postman](https://developer.aquanow.io/#81a815bd-2024-4fde-a69b-13cc0b56b151) documentation.

#### Query Parameters

| Name                                  | Type   | Description                                            |
| ------------------------------------- | ------ | ------------------------------------------------------ |
| key<mark style="color:red;">\*</mark> | String | <p><code>\<Key></code></p><p>API key to be deleted</p> |

#### Headers

| Name                                           | Type   | Description                                                                                                                                                        |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| x-api-key<mark style="color:red;">\*</mark>    | String | <p><code>{{x-api-key}}</code></p><p>API Auth Key</p>                                                                                                               |
| x-signature<mark style="color:red;">\*</mark>  | String | <p><code>49c6260c194f4d7ed5cb917dc70b9821673246b2abc1cf28f05df6a75fd24181e00f8e57b321d15ae45db58b3bffe27a</code></p><p>Signature created using your API secret</p> |
| x-nonce<mark style="color:red;">\*</mark>      | Number | <p><code>1657731573930</code></p><p>Timestamp in millisecond</p>                                                                                                   |
| Content-Type<mark style="color:red;">\*</mark> | String | `application/json`                                                                                                                                                 |

{% tabs %}
{% tab title="200: OK " %}
Returns an array of [APIKeysObject](https://docs.aquanow.io/aquanow/legacy/data-objects-and-statuses/accounts-objects#apikeysobject).

<pre class="language-json"><code class="lang-json"><strong>[
</strong><strong> {
</strong>  "keyId": "ou5iowf7pl",
  "updatedAt": 1673044308503,
  "userName": "helloWorld",
  "createdAt": 1673044308503,
  "key": "tuR4TrJwo94oLNHBfq99V9WaCF8tTxIS6l8Ns3Iy",
  "type": "regular"
 }
]
</code></pre>

{% endtab %}

{% tab title="500: Internal Server Error API key not specified" %}

```json
{
    "message": "Internal server error. ApiKey deletion failed."
}
```

{% endtab %}
{% endtabs %}

## Lists current usage limit for the day

<mark style="color:blue;">`GET`</mark> `https://api.aquanow.io/users/v1/apiKeyUsage`

To view example requests for this endpoint, visit Aquanow's [Postman](https://developer.aquanow.io/#193be6c6-f97e-480f-b90d-5e724da5d370) documentation.

#### Headers

| Name                                           | Type   | Description                                                                                                                                                        |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| x-api-key<mark style="color:red;">\*</mark>    | String | <p><code>{{x-api-key}}</code></p><p>API Auth Key</p>                                                                                                               |
| x-signature<mark style="color:red;">\*</mark>  | String | <p><code>49c6260c194f4d7ed5cb917dc70b9821673246b2abc1cf28f05df6a75fd24181e00f8e57b321d15ae45db58b3bffe27a</code></p><p>Signature created using your API secret</p> |
| x-nonce<mark style="color:red;">\*</mark>      | Number | <p><code>1657731573930</code></p><p>Timestamp in millisecond</p>                                                                                                   |
| Content-Type<mark style="color:red;">\*</mark> | String | `application/json`                                                                                                                                                 |

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

```json
{
    "HHhudBNd5W99Nb23FUXGV4gW3eQD7K6fGZkdcI": {
        "endDate": "2024-02-15",
        "items": {
            "l012hn9f1a": [
                [
                    0,
                    100000
                ]
            ]
        },
        "startDate": "2024-02-15",
        "usagePlanId": "fao4ht"
    },
    "Vr2TNpJqQGlpxJ6PTWL163f9yQPzCBabgblMKpc": {
        "endDate": "2024-02-15",
        "items": {},
        "startDate": "2024-02-15",
        "usagePlanId": "fao4ht"
    }
}
```

{% endtab %}
{% endtabs %}
