# Corporate Rule

The Corporate Rule resource displays the spending rules of the Corporate Cards and Corporate Holders created in your Workspace.

Each rule sets the maximum amount that can be spent in an interval and may also restrict the merchant categories, the countries, the card purchase methods and the purposes that are accepted, as well as the days and hours in which the card can be used.

Corporate Rules are not created on their own. You inform them in the rules parameter when you create or update a [Corporate Holder](https://docs.starkbank.com/api/v2/corporate-holder.md) and when you update a Corporate Card: rules informed on a holder apply to every card bound to it, rules informed on a card apply to that card only, and both are verified on every purchase.

**NOTE:**Inform "expand=rules" when you read a card or a holder to also receive the amount already spent in the current interval and the full currency, category, country and method data of each rule.

### The Corporate Rule object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique id for the corporate rule, returned when the rule is created and used to update it later. Example: "6539357404889088". |
| `name` | STRING | Rule name. Example: "General BRL". |
| `interval` | STRING | Interval after which the rule amount counter is reset to 0. Options: "instant", "day", "week", "month", "year", "lifetime". Example: "day". |
| `amount` | INTEGER | Maximum amount in cents that can be spent in the informed interval. 0 sets no amount limit. Example: 200000 (R$2000.00). |
| `currencyCode` | STRING | Code of the currency the rule amount refers to. Example: "BRL". |
| `schedule` | STRING | Days and hours in which the rule is active. Empty when the rule is always active. Example: "every monday, wednesday from 00:00 to 23:59 in America/Sao_Paulo". |
| `purposes` | LIST OF STRINGS | Purchase purposes accepted by the rule. Use it to restrict ATM withdrawals. An empty list accepts every purpose. Options: "purchase", "withdrawal", "verification". Example: ["purchase", "withdrawal"]. |
| `categories` | LIST OF OBJECTS | Merchant categories accepted by the rule, each with a code or a type. An empty list accepts every category. See the [Merchant Category resource](https://docs.starkbank.com/api/v2/merchant-category.md) for the available codes and types. Example: [{"code": "fastFoodRestaurants"}]. |
| `countries` | LIST OF OBJECTS | Merchant countries accepted by the rule, each with a code. An empty list accepts every country. See the [Merchant Country resource](https://docs.starkbank.com/api/v2/merchant-country.md) for the available codes. Example: [{"code": "BRA"}]. |
| `methods` | LIST OF OBJECTS | Card purchase methods accepted by the rule, each with a code. An empty list accepts every method. See the [Card Method resource](https://docs.starkbank.com/api/v2/card-method.md) for the available codes. Example: [{"code": "token"}]. |
| `merchants` | LIST OF OBJECTS | Merchants accepted by the rule, each with an id. An empty list accepts every merchant. Not available in the SDKs. |
| `counterAmount` | INTEGER | Amount in cents already spent in the current interval. Returned only when you inform "expand=rules". Example: 1000 (R$10.00). |
| `currencyName` | STRING | Name of the rule currency. Returned only when you inform "expand=rules". Example: "Brazilian Real". |
| `currencySymbol` | STRING | Symbol of the rule currency. Returned only when you inform "expand=rules". Example: "R$". |

## Available Languages

Code samples on this page are in Python. The same content is available with samples in:

- [Python](https://docs.starkbank.com/api/v2/corporate-rule-python.md)
- [Node.js](https://docs.starkbank.com/api/v2/corporate-rule-node.md)
- [PHP](https://docs.starkbank.com/api/v2/corporate-rule-php.md)
- [Java](https://docs.starkbank.com/api/v2/corporate-rule-java.md)
- [Ruby](https://docs.starkbank.com/api/v2/corporate-rule-ruby.md)
- [Elixir](https://docs.starkbank.com/api/v2/corporate-rule-elixir.md)
- [.NET](https://docs.starkbank.com/api/v2/corporate-rule-dotnet.md)
- [Go](https://docs.starkbank.com/api/v2/corporate-rule-go.md)
- [Clojure](https://docs.starkbank.com/api/v2/corporate-rule-clojure.md)
- [cURL](https://docs.starkbank.com/api/v2/corporate-rule-curl.md)
