> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.finrock.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Spending Rule

> Add a spending rule that allows outgoing transactions up to a limit, or requires approval for them.

**[MCP scope](https://apidocs.finrock.io/api-reference/mcp-scopes.md):** `dac.write`

Use this endpoint to add a spending rule to your sub-account. A new rule starts as `UnApproved` and takes effect once the owner, or at least 2 admins, approve it in the dashboard. Check its status with [List Spending Rules](https://apidocs.finrock.io/api-reference/spending-rules/list-spending-rules.md).

## Body Parameters

**rule\_title** `string` *required*

A name for the rule.

**amount** `number` *required*

The maximum amount the rule allows in the time period.

**initiated\_by** `string` *required*

Who the rule applies to. See [initiated\_by values](https://apidocs.finrock.io/reference/spending-rule-values.md#initiated_by).

**sr\_action** `string` *required*

What happens to a matching transaction. See [sr\_action values](https://apidocs.finrock.io/reference/spending-rule-values.md#sr_action).

**minimum\_approvals** `integer`

How many approvals a matching transaction needs. Use with `sr_action: NeedsApproval`.

**destination\_type** `string` *required*

Where funds are going. See [destination\_type values](https://apidocs.finrock.io/reference/transaction-types.md#destination_type).

**destination\_id** `string` *required*

For `External` destinations, the kind of address. See [destination\_id values](https://apidocs.finrock.io/reference/spending-rule-values.md#destination_id).

**external\_address** `string`

Depends on `destination_id`:

* `WhitelistedAddress`: the ID of the [whitelist](https://apidocs.finrock.io/guides/whitelist-addresses.md) the rule applies to. The rule then covers every active address on that whitelist.
* `AdhocAddress`: a specific address outside Finrock, not one of your Finrock wallets, for example your cold wallet.

For `SubAccount` destinations, the ID of the sub-account the rule allows transfers to.

**rule\_type** `string` *required*

The period the amount applies to. See [rule\_type values](https://apidocs.finrock.io/reference/spending-rule-values.md#rule_type).

**time\_period\_frequency** `integer`

The length of the period, in units of `rule_type`. For example, `Hourly` with `24` means any 24-hour window.

```bash cURL theme={null}
curl --request POST \
     --url https://api.finrock.io/dac/v1/spending-rule \
     --header 'Authorization: Bearer {JWT}' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-api-key: YOUR_API_KEY' \
     --data '{
       "rule_title": "Spending Rule 1",
       "amount": 500,
       "initiated_by": "Anyone",
       "sr_action": "NeedsApproval",
       "minimum_approvals": 2,
       "destination_type": "External",
       "destination_id": "AdhocAddress",
       "external_address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
       "rule_type": "Hourly",
       "time_period_frequency": 24
     }'
```

## Response

**code** `integer`

`1000` when the rule was created.

**error** `string | null`

`null` on success.

**info** `string | null`

Additional information, if any. `null` on success.

```json 200 theme={null}
{
  "code": 1000,
  "error": null,
  "info": null
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.