# Create Setting

<table data-header-hidden><thead><tr><th width="82.40625">HTTP Method</th><th>URL</th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>POST</strong></mark></td><td>https://api.sfox.com/v1/enterprise/monetization/settings</td></tr></tbody></table>

Create a monetization setting.

***

The first step to monetizing your user's activity is to create monetization settings. Using this endpoint, Partners can specify the `feature`,  `method`, `currency`, and `user` they would like the fee to be applied to.&#x20;

### Monetization Configuration Combinations

The following combinations of Feature and Method are supported

<table><thead><tr><th width="197.625">Monetization Feature</th><th>Monetization Method(s)</th></tr></thead><tbody><tr><td><code>RFQ</code></td><td><code>FEE_RATE</code> , <code>SPREAD_ADJUSTMENT</code></td></tr><tr><td><code>SPOT_TRADE</code></td><td><code>FEE_RATE</code></td></tr></tbody></table>

## Request

### Body Parameters

<table><thead><tr><th width="175.53515625">Parameter</th><th width="112">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>feature</code> <mark style="color:red;">required</mark></td><td>string</td><td><ul><li><code>RFQ</code></li><li><code>SPOT_TRADE</code></li><li><code>WITHDRAW</code></li></ul></td></tr><tr><td><code>method</code> <mark style="color:red;">required</mark></td><td>string</td><td><ul><li><code>FEE_RATE</code></li><li><code>FEE_FLAT</code></li><li><code>SPREAD_ADJUSTMENT</code></li></ul></td></tr><tr><td><code>user_id</code></td><td>string</td><td>The Connect user ID this fee is specified for. If no <code>user_id</code> is specified, the fee is applied to all users.</td></tr><tr><td><code>amount</code> <mark style="color:red;">required</mark></td><td>number</td><td>The monetization amount in decimal format i.e. <code>0.01</code> (1%)</td></tr><tr><td><code>security_pair</code></td><td>string</td><td>Used when applying a <code>FEE_RATE</code> or <code>SPREAD_ADJUSTMENT</code> to a specific instrument, such as <code>btcusd</code></td></tr></tbody></table>

### Example Requests

{% tabs %}
{% tab title="Shell" %}
{% code overflow="wrap" lineNumbers="true" expandable="true" %}

```sh
curl -X POST \
 -H 'Content-type: application/json' \
 -H "Authorization: Bearer ${ENTERPRISE_API_KEY}" \
 --data '{ "feature": "SPOT_TRADE",
          "method": "FEE_RATE",
          "amount": 0.01,
          "user_id": "client25" }'  \
 'https://api.sfox.com/v1/enterprise/monetization/settings'
```

{% endcode %}
{% endtab %}

{% tab title="NodeJS" %}
{% code overflow="wrap" lineNumbers="true" expandable="true" %}

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

const config = {
  method: 'post',
  url: 'https://api.sfox.com/v1/enterprise/monetization/settings',
  headers: {
    "Content-Type": "application/json",
    'Authorization': `Bearer ${process.env.ENTERPRISE_API_KEY}`
  },
  data: {
    feature: 'SPOT_TRADE',
    method: 'FEE_RATE',
    amount: 0.01,
    user_id: 'client25'
  }
}

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

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" lineNumbers="true" expandable="true" %}

```python
import requests
import os

data = requests.post(
  "https://api.sfox.com/v1/enterprise/monetization/settings",
  headers={
    "Authorization": f"Bearer {os.environ['ENTERPRISE_API_KEY']}"
  },
  json={
    "feature": "SPOT_TRADE",
    "method": "FEE_RATE",
    "amount": 0.01,
    "user_id": "client25"
  }
)
print(data.status_code)
print(data.json())
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Response

### Response Body&#x20;

<table><thead><tr><th width="262.71875">Field</th><th valign="top">Description</th></tr></thead><tbody><tr><td><code>monetization_id</code> <br>int</td><td valign="top">Unique ID for this monetization setting.</td></tr><tr><td><code>monetization_feature</code> <br>string</td><td valign="top">Feature this setting applies to.</td></tr><tr><td><code>monetization_feature_code</code> <br>string</td><td valign="top">API readable code for the feature.</td></tr><tr><td><code>monetization_method</code> <br>string</td><td valign="top">Monetization method of the setting.</td></tr><tr><td><code>monetization_method_code</code> <br>string</td><td valign="top">API readable code for the monetization method.</td></tr><tr><td><code>monetization_amount</code> <br>number</td><td valign="top">Monetization amount in decimal format.</td></tr><tr><td><code>user_id</code> <br>string</td><td valign="top">User ID of the end user that the setting is applied to, if applicable. <code>null</code> if the setting applies to all end users.</td></tr><tr><td><code>currency_code</code> <br>string</td><td valign="top">Currency that the setting is applied to, if applicable. <code>null</code> if the setting applies to all currencies or is not applicable to currencies.</td></tr><tr><td><code>currency_pair</code> <br>string</td><td valign="top">Currency pair that the setting is applied to, if applicable. <code>null</code> if the setting applies to all pairs or is not applicable to currency pairs.</td></tr><tr><td><code>date_updated</code> <br>datetime</td><td valign="top">Date and time the setting was most recently updated or created.</td></tr></tbody></table>

### Responses

<details>

<summary><mark style="color:green;"><strong>201 Created</strong></mark></summary>

{% code overflow="wrap" lineNumbers="true" expandable="true" %}

```json
{
    "data": {
        "monetization_id": 1310717,
        "monetization_feature": "Spot Trading",
        "monetization_feature_code": "SPOT_TRADE",
        "monetization_method": "Fee Rate",
        "monetization_method_code": "FEE_RATE",
        "monetization_amount": 0.01,
        "user_id": "client25",
        "currency_code": null,
        "currency_pair": null,
        "date_updated": "2023-06-07T21:49:22.000Z"
    }
}
```

{% endcode %}

</details>

<details>

<summary><mark style="color:red;"><strong>422 Unprocessable Content</strong></mark></summary>

{% code title="Duplicate Setting" overflow="wrap" lineNumbers="true" expandable="true" %}

```json
{
    "error": "Monetization setting already exists"
}
```

{% endcode %}

</details>

<details>

<summary><mark style="color:red;"><strong>403 Forbidden</strong></mark></summary>

{% code title="No Feature Permission" overflow="wrap" lineNumbers="true" expandable="true" %}

```json
{
    "error": "You do not have RFQ monetization permission"
}
```

{% endcode %}

{% code title="No Method Permission" overflow="wrap" lineNumbers="true" expandable="true" %}

```json
{
    "error": "You do not have FEE_RATE monetization permission for RFQ"
}
```

{% endcode %}

</details>
