ResetQuota policy Stay organized with collections Save and categorize content based on your preferences.
This pageapplies toApigee andApigee hybrid.
View Apigee Edge documentation.![]()
Use the ResetQuota policy to dynamically modify the remaining number of requests allowed by the target Quota policy. You typically use this policy to decrease the current quota count of the target Quota policy rather than waiting for the quota count to reset.
For example, the target Quota policy limits a developer to 1000 requests per week. By the second day of the week, the developer has already reached this limit. Use the Reset Quota policy to subtract 500 from their quota counter to allow an additional 500 requests for the remainder of the week. At the end of the week, the Quota policy resets, and the developer is back to 1000 requests for the week.
This policy is anExtensible policy and use of this policy might have cost or utilization implications, depending on your Apigee license. For information on policy types and usage implications, seePolicy types.
SeeQuota policy for more on the Quota policy. Also seethis community post on using the Reset Quota policy.
Samples
These policy code samples illustrate how to reset quota counters:
Reset Default Counter
<ResetQuota name="resetQuota"> <Quota name="MyQuotaPolicy"> <Identifier name="_default"> <Allow>100</Allow> </Identifier> </Quota></ResetQuota>
The Reset Quota policy specifies the target Quota policy by using thename attribute of the<Quota> tag. In the example above, the MyQuotaPolicy policy is the target.
All Reset Quota policies require the<Identifier> tag to specify the counter in the Quota policy to update. By default, a Quota policy has a single counter, unless the Quota policy also includes the<Identifier> tag. In this example, the target Quota policy does not use the<Identifier> tag, so you specify thename attribute as_default.
The<Allow> element specifies the value used to decrease the current quota count on the target policy. In this example, the quota count is decreased by 100, to allow 100 more requests to the target Quota policy. When the target Quota policy resets, this change is discarded.
Shown below is the definition of the target Quota policy:
<Quota name="MyQuotaPolicy"> <Interval>5</Interval> <TimeUnit>hour</TimeUnit> <Allow count="100"/></Quota>
Use a Reference
<ResetQuota name="resetQuota"> <Quota ref="request.header.quotapolicy"> <Identifier name="_default"> <Allow ref="request.header.allowquota" /> </Identifier> </Quota></ResetQuota>
In this example, you pass the name of the target Quota policy, and the change to its quota count, as headers in the request. You can then reference the flow variables containing these values in the Reset Quota policy.
Specify the Identifier
<ResetQuota name="resetQuota"> <Quota name="QuotaPolicy"> <Identifier ref="request.header.clientId"> <Allow>100</Allow> </Identifier> </Quota></ResetQuota>
If the target Quota policy specifies the<Identifier> tag, then you can specify the same value to the<Identifier> tag of the Reset Quota policy to update a specific quota count. Notice how the<Identifier> tag in the target Quota policy below matches the value specified to the Reset Quota policy:
<Quota name="QuotaPolicy"> <Identifier ref="request.header.clientId"/> <Interval>5</Interval> <TimeUnit>hour</TimeUnit> <Allow count="100"/></Quota>
Element reference
The element reference describes the elements and attributes of the Reset Quota policy.
<ResetQuota async="false" continueOnError="false" enabled="true" name="Reset-Quota-1"> <DisplayName>Reset Quota 1</DisplayName> <Quota name="quotaName" ref="request.header.quotapolicy"> <Identifier name="identifierName" ref="request.header.identifier"> <Class ref="request.header.classIdentifier" /> <Allow>100</Allow> </Identifier> </Quota></ResetQuota>
<ResetQuota> attributes
<ResetQuota async="false" continueOnError="false" enabled="true" name="Reset-Quota-1">
The following table describes attributes that are common to all policy parent elements:
| Attribute | Description | Default | Presence |
|---|---|---|---|
name | The internal name of the policy. The value of the Optionally, use the | N/A | Required |
continueOnError | Set to Set to | false | Optional |
enabled | Set to Set to | true | Optional |
async | This attribute is deprecated. | false | Deprecated |
<DisplayName> element
Use in addition to thename attribute to label the policy in the management UI proxy editor with a different, natural-language name.
<DisplayName>Policy Display Name</DisplayName>
| Default | N/A If you omit this element, the value of the policy's |
|---|---|
| Presence | Optional |
| Type | String |
<Quota> element
Identifies the target Quota policy whose counter should be updated.
<Quota name="quotaName" ref="request.header.quotapolicy"> <Identifier name="identifierName" ref="request.header.identifier"> <Allow>100</Allow> </Identifier></Quota>
| Default: | N/A |
| Presence: | Required |
| Type: | N/A |
Attributes
| Attribute | Description | Default | Presence |
|---|---|---|---|
| name | Specifies the name of the target Quota policy. | N/A | Optional |
| ref | A flow variable that contains the name of the target Quota policy. If bothref andname are specified, thenref gets priority. Ifref does not resolve at runtime, thenname is used. | N/A | Optional |
<Quota>/<Identifier> element
Variable used to uniquely identify the counter if the target Quota policy specifies the<Identifier> tag.
<Quota name="quotaName"> <Identifier name="identifierName" ref="request.header.identifier"> <Allow>100</Allow> </Identifier></Quota>
| Default: | N/A |
| Presence: | Required |
| Type: | String |
Attributes
| Attribute | Description | Default | Presence |
|---|---|---|---|
| name | Specifies the name of the count identifier in the target Quota policy. For a Quota policy that does not use the<Identifier> tag, specify_default. | N/A | Optional |
| ref | A flow variable that contains the name of the count identifier in the target Quota policy. If bothref andname are specified, thenref gets priority. Ifref does not resolve at runtime, thenname is used. | N/A | Optional |
<Quota>/<Identifier>/<Allow> element
Specifies the amount to decrease the quota counter. You must specify<Allow>, otherwise, the policy does not modify the quota.
<Identifier name="identifierName" ref="request.header.identifier"> <Allow ref="request.header.allowquota">100</Allow></Identifier>
| Default: | N/A |
| Presence: | Required |
| Type: | Integer |
Attributes
| Attribute | Description | Default | Presence |
|---|---|---|---|
| ref | A flow variable that contains the change to the quota count in the target Quota policy. | N/A | Optional |
<Quota>/<Identifier>/<Class> element
Specifies the class for which the Quota counter is updated. For more on using class with the Quota policy, seeQuota policy.
<Identifier name="_default"> <Class ref="request.header.classIdentifier"> <Allow>200</Allow> </Class></Identifier>
| Default: | N/A |
| Presence: | Optional |
| Type: | N/A |
Attributes
| Attribute | Description | Default | Presence |
|---|---|---|---|
| ref | Reference to the flow variable that contains the quota class to update. | N/A | Optional |
Error reference
This section describes the fault codes and error messages that are returned and fault variables that are set by Apigee when this policy triggers an error. This information is important to know if you are developing fault rules to handle faults. To learn more, seeWhat you need to know about policy errors andHandling faults.
Runtime errors
These errors can occur when the policy executes.
Tip: Need help resolving an error? Clickbuildin the Fix column for detailed troubleshooting information.| Fault code | HTTP status | Cause | Fix |
|---|---|---|---|
policies.resetquota.InvalidRLPolicy | 500 | TheQuota policy specified in the<Quota> element of theResetQuota policy is not defined in the API proxy and thus is not available during the flow. The<Quota> element is mandatory and identifies the targetQuota policy whose counter should be updated through theResetQuota policy. | build |
policies.resetquota.FailedToResolveAllowCountRef | N/A | The reference to the variable containing the allow count in the<Allow> element of the policy cannot be resolved to a value. This element is mandatory and specifies the amount to decrease the quota counter. | build |
policies.resetquota.FailedToResolveRLPolicy | 500 | The variable referenced by theref attribute in the<Quota> element cannot be resolved. | build |
Deployment errors
These errors can occur when you deploy a proxy containing this policy.
Tip: Need help resolving an error? Clickbuild next to the error's cause description to visit the troubleshooting page.| Error name | Cause | Fix |
|---|---|---|
InvalidCount | If the count value specified in the<Allow> element of theResetQuota Policy is not an integer, then the deployment of the API proxy fails. | build |
Schemas
Sample: See ourGitHub repository samples for the most recent schemas.Related topics
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-17 UTC.