# API for Querying License Rewards

{% hint style="info" %}
This feature is currently only available to premium partners, enabling efficient querying of the license rewards in bulk.
{% endhint %}

### Prerequisite

Please make sure you obtain `x-ak` & `x-sk` issued by Aethir.&#x20;

### Query License Rewards

#### **Description**

Retrieves the rewards (including bonus rewards) for the specified license IDs from the previous day

#### **URL**

<https://app.aethir.com/console-api/v2/client/query-daily-reward>

#### **Method**

POST

#### Rate Limit

Each `x-ak` can make a request every 5 seconds.&#x20;

#### **Request Headers**

<table><thead><tr><th width="136">Header</th><th width="101">Type</th><th width="119">Mandatory</th></tr></thead><tbody><tr><td>x-ak</td><td>string</td><td>Yes</td></tr><tr><td>x-op-token</td><td>string</td><td>Yes</td></tr></tbody></table>

{% hint style="info" %}
**x-ak** is a verification code issued to qualified premium partners.
{% endhint %}

{% hint style="info" %}
**x-op-token** is consists of three parts

<pre><code><strong>x-op-token = header.payload.signature
</strong></code></pre>

* **Header**

  A compact JSON string encoded with base64, representing the header.

  ```json
  {
    "alg": "HS256",  // Encryption algorithm, fixed as HS256
    "typ": "CHK_OP"  // Token type, fixed as CHK_OP
  }
  ```
* **Payload**

  A compact JSON string encoded with base64, representing the payload.

  ```json
  {
    "ak": "",       // Issued to nodeOperator's AK
    "exp": 1,       // Token expiration timestamp in ms, configured by the user
    "ip": "",       // Client IP, optional
    "nonce": 1      // Random number generated by the user
  }
  ```
* **Signature**

  <pre class="language-json"><code class="lang-json"><strong>signature = base64UrlEncode(HmacSHA256.sign(base64UrlEncode(header) + "." + base64UrlEncode(payload), sk))
  </strong></code></pre>

  where `sk`is a verification code issued to qualified premium partners.
  {% endhint %}

#### **Request Body**

```json
{
  "licenseIds": [licenseID1, licenseID2, ...] // "licenseIds": [1003, 1005]
}
```

#### **Response**

```json
{
  "code": 135000,
  "msg": "OK",
  "data": {
    "dailyReward": {
      "1003": 0,
      "1005": 0
    },
    "rewardDate": "2024-12-10"
  },
  "time": "2024-12-11 05:25:49"
}
```

| Field       | Type   | Description                                                      |
| ----------- | ------ | ---------------------------------------------------------------- |
| code        | Number | API status code. `135000` indicates a successful request.        |
| msg         | String | Message indicating the result of the request.                    |
| data        | Object | Contains the details of the reward data.                         |
| dailyReward | Object | Mapping of license IDs to their corresponding rewards.           |
| rewardDate  | String | Date for which the rewards are fetched (YYYY-MM-DD).             |
| time        | String | Timestamp when the response was generated (YYYY-MM-DD HH:MM:SS). |
