ResetQuota policy

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:

AttributeDescriptionDefaultPresence
name

The internal name of the policy. The value of thename attribute can contain letters, numbers, spaces, hyphens, underscores, and periods. This value cannot exceed 255 characters.

Optionally, use the<DisplayName> element to label the policy in the management UI proxy editor with a different, natural-language name.

N/ARequired
continueOnError

Set tofalse to return an error when a policy fails. This is expected behavior for most policies.

Set totrue to have flow execution continue even after a policy fails. See also:

falseOptional
enabled

Set totrue to enforce the policy.

Set tofalse toturn off the policy. The policy will not be enforced even if it remains attached to a flow.

trueOptional
async

This attribute is deprecated.

falseDeprecated

<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'sname attribute is used.

PresenceOptional
TypeString

<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

AttributeDescriptionDefaultPresence
name

Specifies the name of the target Quota policy.

N/AOptional
refA 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/AOptional

<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

AttributeDescriptionDefaultPresence
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/AOptional
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/AOptional

<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

AttributeDescriptionDefaultPresence
ref

A flow variable that contains the change to the quota count in the target Quota policy.

N/AOptional

<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

AttributeDescriptionDefaultPresence
ref

Reference to the flow variable that contains the quota class to update.

N/AOptional

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? Clickin the Fix column for detailed troubleshooting information.
Fault codeHTTP statusCauseFix
policies.resetquota.InvalidRLPolicy500TheQuota 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.
policies.resetquota.FailedToResolveAllowCountRefN/AThe 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.
policies.resetquota.FailedToResolveRLPolicy500The variable referenced by theref attribute in the<Quota> element cannot be resolved.

Deployment errors

These errors can occur when you deploy a proxy containing this policy.

Tip: Need help resolving an error? Click next to the error's cause description to visit the troubleshooting page.
Error nameCauseFix
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.

Schemas

Sample: See ourGitHub repository samples for the most recent schemas.

Related topics

Quota policy

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.