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

# Spending Controls

Spending controls can be used to block business categories or set spending limits (e.g NGN1,000 per authorization or NGN30,000 per month). This can be applied to cards by setting the `spendingControls` object at creation or by updating it later.

If you're using spending controls with real-time authorizations, spending controls run first and decline a purchase before the `authorization.request` event is sent to you, resulting in a declined authorization request.

## Spending Control Object

| Field             | Type   | Description                                                                            |
| ----------------- | ------ | -------------------------------------------------------------------------------------- |
| channels          | Object | Channels selection where card can be used.                                             |
| allowedCategories | Array  | List of categories of authorizations to allow. All other categories will be blocked.   |
| blockedCategories | Array  | List of categories of authorizations to decline. All other categories will be allowed. |
| spendingLimits    | Array  | List of objects that specify amount-based rules.                                       |

## Channels

To limit where the card can be used, set either `true` or `false` on the following variables.

| Field  | Type    | Description                                                 |
| ------ | ------- | ----------------------------------------------------------- |
| atm    | Boolean | Automated teller machine (ATM) withdrawals and transactions |
| pos    | Boolean | Point of sales (POS) purchases                              |
| web    | Boolean | Online purchases                                            |
| mobile | Boolean | Mobile purchases                                            |

## Spending Limits

To limit the amount of money that can be spent, set `spendingLimits` within the `spendingControls` object to a list of objects with the following variables.

| Field      | Type   | Description                                                                                                                     |
| ---------- | ------ | ------------------------------------------------------------------------------------------------------------------------------- |
| amount     | Number | Maximum amount allowed to spend per interval set.                                                                               |
| interval   | Enum   | Time interval to which the amount applies. This can either be per\_authorization, daily, weekly, monthly, yearly, or all\_time. |
| categories | Array  | List of categories of authorizations to limit. Leaving this field empty will apply the limit to all categories.                 |

<Info>
  If `spendingLimits` are not set, a default spending limit is applied to all cards.

  **NGN Cards** Single Transaction Limit - NGN20,000 (ATM) | NGN500,000 (POS/WEB) Daily Limit - NGN150,000 (ATM) | NGN500,000 (POS/WEB)

  **USD Cards** Single Transaction Limit - USD0.00 (ATM) | USD0.00 (POS/WEB) Daily Limit - USD0.00 (ATM) | USD0.00 (POS/WEB)
</Info>

**Limit a card's monthly spend**

<CodeGroup>
  ```curl curl theme={null}
  curl --location --request PUT 'https://api.sandbox.sudo.africa/cards/5f45f4d018ccd82774de7d07' \
  --header 'Authorization: Bearer ••••••••••••••••••••••••••••••••••••CREE1M0EwQjgyMjI0NUE3QUM=' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "spendingControls": {
  		"channels": {
  			"atm": true,
  			"pos": true,
  			"web":  true,
        "mobile": true
  		},
  		"allowedCategories": [],
  		"blockedCategories": [],
  		"spendingLimits": [{
  			"amount": 100000,
  			"interval": "monthly"
  		}]
  	}
  }'
  ```
</CodeGroup>

**Limit a card's daily spend for specific categories**

<CodeGroup>
  ````curl curl theme={null}
  ```bash
  curl --location --request PUT 'https://api.sandbox.sudo.africa/cards/5f45f4d018ccd82774de7d07' \
  --header 'Authorization: Bearer ••••••••••••••••••••••••••••••••••••CREE1M0EwQjgyMjI0NUE3QUM=' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "spendingControls": {
  		"channels": {
  			"atm": true,
  			"pos": true,
  			"web":  true,
        "mobile": true
  		},
  		"allowedCategories": [],
  		"blockedCategories": [],
  		"spendingLimits": [{
  			"amount": 3000,
  			"interval": "daily",
  			"categories": ["6011"]
  	****	}]
  	}
  }'
  ```
  ````
</CodeGroup>
