# Usage Limits
source: https://developer.mastercard.com/mastercard-processing-core/documentation/guides/usage-limits/index.md

Usage limits are authorization controls that regulate how much cardholders can spend and how many transactions they can make under specific conditions. Mastercard Processing provides a flexible and powerful system of usage limits based on the following:

* Where the cardholder spends, such as merchant category or country.
* How the cardholder uses a card, such as POS, e-commerce, ATM, or online versus offline.
* Amount the cardholder spends, such as daily, monthly, during a billing cycle, or forever.
* Frequency indicates how many transactions were made during a day, month, or another period.
* Time thresholds indicate limits that can be activated or changed for a specific time, such as one day. There also are sliding limits, which count a certain number of days backward from the transaction.
* The method of setting a limit amount indicates the explicit amount of money that can be applied. However, a limited amount can also be calculated as a percentage of the total amount or average of what was spent in the past.

Mastercard Processing has well-defined industry-wide standard limits proposals for your card products. It can also tailor quite sophisticated limits to meet your needs.

Each usage limit can be defined by a few optional parameters, as follows:

* `maxSingleAmount`: the maximum amount of a single transaction for a given limit, such as time interval or merchant
* `maxAmount`: the maximum total amount of all transactions for a given limit
* `maxNumber`: the maximum number of transactions for a given limit
* `currency`: the currency related to the defined limit
* `activityPeriodStartDate`: the effective time for a given limit
* `activityPeriodEndDate`: the expiration time for a given limit

Limits are set during the onboarding process at the product or account contract level and populated to all cards issued under a specific product or account. Limits can be overwritten at any time through the API on a single card or account level.

Each type of limit is identified in the API communication by its `usageLimitCode`, for example:

* ISS_ATM_DAILY: ATM withdrawal transactions
* CL_NO_PIN: limit for all contactless transactions with no PIN
* ALL_MCSTP: block all Magnetic Stripe transactions

## Activation and Value Update {#activation-and-value-update}

During onboarding, while defining usage limits, you can set when the limit will become active:

* Immediately after card activation, or
* After separate limit activation, for example, through API.

When the second option is valid, you can use the `/contracts/{contract_id}/usage-limits/{usage_limit_code}` endpoint as an activation tool. Sending a request containing only `activityPeriodStartDate` and `activityPeriodEndDate` without other parameter values is sufficient to activate the given usage limit. Putting any other value into the request will activate the limit and change the value of the specified parameter. Therefore, the mentioned operation serves both as an activation and update tool.

Each request refers only to one usage limit, but then any number of limit parameters can be changed at once.


Note: The Mastercard Processing API does not provide an operation to create a new usage limit. You can only redefine the usage limits that were preconfigured during the onboarding process. Tip: Be aware of the following rules when setting specific values combination of three basic parameters (`maxSingleAmount`, `maxAmount`, and `maxNumber`):

* If you send the request with values for three parameters equal to zero (`maxSingleAmount` = 0; `maxAmount` = 0; `maxNumber` = 0), it will cause the situation when the limit is active but set to zero, so every transaction will be declined.
* If at least one of these three parameters has been set to a non-zero value, the limit will allow transactions up to that value (number of transactions or amount, respectively). When the other two parameter values are set to zero, they will be treated as not existing. ![Three basic parameters](https://static.developer.mastercard.com/content/mastercard-processing-core/uploads/activation-and-value-update-1.png)  
  Examples: ![Three basic parameters](https://static.developer.mastercard.com/content/mastercard-processing-core/uploads/activation-and-value-update-2.png)

<br />

## Deactivation {#deactivation}

A limit can be deactivated by sending the `PUT` request to the `/contracts/{contract_id}/usage-limits/{usage_limit_code}/status` endpoint with the value `SUSPEND` in the `status` field in the request body. After this operation, the limit status changes to `Temporarily Closed`.

## Limit Changes in Time {#limit-changes-in-time}

The limit value can be changed at any time; additionally, the change can be implemented for a defined period. When the period ends, the limit goes back to the default value. When the limit has been changed many times, after each end date, it will go to the limit value, which is still valid and set most recently. It means that it is possible to encapsulate one limit change inside another one, and changes will be made in an automated way. Changes can be set in advance with a start date in the future. Changing the limit value inside a defined period for any time does not prolong the defined 'outer' period. Period endpoints are included, meaning the limit is still valid on the end date.

For example,

1. On 1 January, a card was opened for a client with a limit of `maxAmount` €300 for operations at ATMs.
2. For one month, beginning 20 January, the client requested to increase the limit from €300 to €600.
3. Only for one day, on 15 February, the client asked to increase the limit on the card from €600 to €900.

![Deactivation](https://static.developer.mastercard.com/content/mastercard-processing-core/uploads/deactivation.png)
Therefore:  

From 1 to 19 January, the limit will be €300.  

From 20 January to 14 February, it will increase to €600.  

On 15 February, it will be €900;  

and from 16 to 20 February, the limit will be €600 again.  

From 21 February, the limit will return to €300.
Note: Changing the limit on the account contract level affects all card contracts linked to that account contract.

See the [Use Cases](https://developer.mastercard.com/mastercard-processing-core/documentation/use-cases/usage-limits-management/index.md) section to learn how to use API for various business use cases related to usage limits.

## Usage Limit Lifecycle {#usage-limit-lifecycle}

The following table describes how the status of usage limit changes over time based on the changes that are made during the card lifecycle.

| Status returned by the `getUsageLimits` |                                                                Description                                                                 |
|-----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| Active                                  | Initial status after creating card contract or after calling `restoreUsageLimitDefaultValues`.                                             |
| Expired                                 | Returned when `getUsageLimits` is called after the date that was used in the `activityPeriodEndDate` field in the `setUsageLimit` request. |
| Redefined                               | Returned when any of the limit's default parameters (excluding status) have been changed using `setUsageLimit` or `changeUsageLimit`.      |
| Service Deactivated                     | Returned after creating card contract for which on the product level usage limit is not Active by default.                                 |
| Temporarily Active                      | Returned after calling `changeUsageLimitStatus` to restore previously suspended usage limit.                                               |
| Temporarily Closed                      | Returned after suspending usage limit by calling `changeUsageLimitStatus`.                                                                 |

Note: The usage limit status is independent of the card contract status. If you close the card contract with the usage limit in `Active` state, `getUsageLimits` will return `Active` status, not `Closed`.
