# Get Monetization History

<mark style="color:blue;">**`GET`**</mark> `https://api.sfox.com/v1/enterprise/monetization/history`

This endpoint returns all records of processed fee entries from a Partner. Partners have the ability to filter by `user_id`, `currency`, `feature`, `method`, and time period. Unprocessed fees will not be included in the response.&#x20;

### Query Parameters

<table><thead><tr><th width="199">Name</th><th width="136">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>from_date</code></td><td>int</td><td>Start date of the query in UNIX timestamp to milliseconds</td></tr><tr><td><code>to_date</code></td><td>int</td><td>End date of the query in UNIX timestamp to milliseconds</td></tr><tr><td><code>feature</code></td><td>string</td><td>Filters the response by that feature i.e. <code>RFQ</code></td></tr><tr><td><code>method</code></td><td>string</td><td>Filters the response by that method i.e. <code>FEE_RATE</code></td></tr><tr><td><code>user_id</code></td><td>string</td><td>Filters the response by that user i.e. <code>ClientAccount1</code></td></tr><tr><td><code>currency</code></td><td>string</td><td>Filters the response by that currency i.e. <code>ETH</code></td></tr></tbody></table>

### Responses

{% hint style="info" %}
Responses are limited to 50,000 entries per request.&#x20;
{% endhint %}

<details>

<summary><mark style="color:green;"><strong>200 OK</strong></mark></summary>

```json
{
    "data": [
        {
            "monetization_ledger_id": 1,
            "date_added": "2023-06-23T17:11:46.000Z",
            "date_processed": "2023-06-26T21:33:04.000Z",
            "user_id": null,
            "currency_code": "usd",
            "instrument": null,
            "order_id": 123456,
            "trade_id": 987654,
            "staking_info_id": null,
            "atx_id": null,
            "monetized_feature_code": "SPOT_TRADE",
            "monetization_method_code": "FEE_RATE",
            "monetization_amount": 0.002,
            "fee_amount": 2.869906
        },
        {
            "monetization_ledger_id": 2,
            "date_added": "2023-06-23T17:11:46.000Z",
            "date_processed": "2023-06-26T21:33:04.000Z",
            "user_id": null,
            "currency_code": "usd",
            "instrument": null,
            "order_id": 637257,
            "trade_id": 938276,
            "staking_info_id": null,
            "atx_id": null,
            "monetized_feature_code": "RFQ",
            "monetization_method_code": "FEE_RATE",
            "monetization_amount": 0.0004,
            "fee_amount": 0.1026374
        },
        {
            "monetization_ledger_id": 3,
            "date_added": "2023-06-23T17:11:46.000Z",
            "date_processed": "2023-06-26T21:33:04.000Z",
            "user_id": "ClientAccount1",
            "currency_code": "btc",
            "instrument": null,
            "order_id": null,
            "trade_id": null,
            "staking_info_id": null,
            "atx_id": 827357,
            "monetized_feature_code": "WITHDRAW",
            "monetization_method_code": "FLAT_FEE",
            "monetization_amount": 0.0001,
            "fee_amount": 0.0001
        }
}
```

</details>

## Response Body

| Key                      | Description                                  |
| ------------------------ | -------------------------------------------- |
| `monetization_ledger_id` | Unique ID for this monetization ledger entry |
| `date_added`             | Date the fee was charged                     |
| `date_processed`         | Date the fee was processed/paid              |
| `user_id`                | User Id of the user that the fee was debited |
| `currency_code`          | Currency of the fee                          |
| `instrument`             | Instrument of the trade the fee applied to   |
| `order_id`               | Order ID of the order the fee is charged to  |
| `trade_id`               | Trade ID of the trade the fee is charged to  |
| `staking_info_id`        | Stake ID of the stake the fee is charged to  |
| `atx_id`                 | Transaction ID the fee is charged to         |
| `monetized_feature_code` | Feature the fee came from                    |
| `monetization_amount`    | Fee Rate                                     |
| `fee_amount`             | Fee Amount                                   |

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

```sh
curl -X GET \
-H "Authorization: Bearer ${ENTERPRISE_API_KEY}" \
'https://api.sfox.com/v1/enterprise/monetization/history?feature=SPOT_TRADE'
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

const config = {
  method: 'get',
  url: 'https://api.sfox.com/v1/enterprise/monetization/history',
  params: {
    feature: 'SPOT_TRADE',
  }
  headers: {
    'Authorization': `Bearer ${process.env.ENTERPRISE_API_KEY}`
  }
}

axios(config)
  .then((response) => {
    console.log(response.status);
    console.log(response.data);
  })
  .catch((error) => {
    console.error(error.response.status);
    console.error(error.response.data);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os

data = requests.get(
  "https://api.sfox.com/v1/enterprise/monetization/history",
  params={
    "feature": "SPOT_TRADE"
  }
  headers={
    "Authorization": f"Bearer {os.environ['ENTERPRISE_API_KEY']}"
  }
)
print(data)
```

{% endtab %}
{% endtabs %}
