# Create Approval Rule

<mark style="color:blue;">**`POST`**</mark> `https://api.sfox.com/v1`**`/approval-rules`**

Add a new crypto address to your account's whitelisted withdrawal addresses.

{% hint style="info" %}
If you have an approval rule for altering SAFE settings, the new rule may not be immediately added to your account as it may require approval from other users in your account.
{% endhint %}

### Body Parameters

<table><thead><tr><th width="303">Parameter</th><th width="95">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>rule_type</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td><p>The type of approval rule to create. Possible values:</p><ul><li><code>WITHDRAW</code>: Approval rule for withdrawals.</li><li><code>ADD_ALTER_COLL</code>: Adding/editing users in your account.</li><li><code>ALTER_SAFE</code>: Adding/editing approval rules in your account.</li></ul></td></tr><tr><td><strong><code>required_approvals</code></strong> <mark style="color:red;">required</mark></td><td>int</td><td>Number of approvals needed for the action to be approved.</td></tr><tr><td><strong><code>threshold</code></strong></td><td>number</td><td>The withdrawal amount (USD) required for the action to require approvals. <strong>Required if <code>rule_type</code> = <code>WITHDRAW</code></strong></td></tr></tbody></table>

### Responses

<details>

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

```json
{
  id: 1,
  rule_type: "WITHDRAW",
  date_added: "2021-03-17T16:19:47.000Z",
  status: "Pending",
  available_approver_count: 2,
  required_approvals: 2,
  threshold: 0,
}
```

</details>

### Example Requests

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

```bash
curl -X POST \
  -H 'Content-type: application/json' \
  -H 'Authorization: Bearer <API_TOKEN>' \
  --data '{ "rule_type":  "WITHDRAW", 
            "required_approvals":  2, 
            "threshold":  100 }'  \
  'https://api.sfox.com/v1/approval-rules'
```

{% endtab %}

{% tab title="NodeJS" %}

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

axios({
  method: 'post',
  url: 'https://api.sfox.com/v1/approval-rules',
  headers: {
    'Authorization': 'Bearer <API_KEY>'
  },
  data: { 
    rule_type:  "WITHDRAW", 
    required_approvals:  2, 
    threshold:  100 
  }
}).then(response => {
  console.log(response)
}).catch(err => {
  console.error(err)
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

data = requests.post(
  "https://api.sfox.com/v1/approval-rules",
  headers={
    "Authorization": "Bearer <API_KEY>",
  },
  data={
   "rule_type": "WITHDRAW",
   "required_approvals": 2,
   "threshold": 100
  }
)
print(data)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sfox.com/rest-api/custody/create-approval-rule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
