[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-03。"],[[["\u003cp\u003eThe Reset Quota policy in Apigee dynamically modifies the remaining request count allowed by a target Quota policy, allowing for adjustments without waiting for the quota's natural reset.\u003c/p\u003e\n"],["\u003cp\u003eThis policy is used to decrease the current quota count, such as subtracting from a developer's weekly limit to grant additional requests before the end of the quota period.\u003c/p\u003e\n"],["\u003cp\u003eThe policy targets a specific Quota policy and counter using the \u003ccode\u003e<Quota>\u003c/code\u003e and \u003ccode\u003e<Identifier>\u003c/code\u003e tags, where \u003ccode\u003e<Allow>\u003c/code\u003e specifies the amount to decrease the counter by.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify the target Quota policy and the change to its quota count by using flow variable references, making the policy flexible to runtime adjustments.\u003c/p\u003e\n"],["\u003cp\u003eThe Reset Quota policy, an Extensible policy, comes with potential cost or utilization impacts depending on your Apigee license and if errors occur, they can be addressed using fault handling mechanisms.\u003c/p\u003e\n"]]],[],null,["# ResetQuota policy\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\n### What\n\nUse to dynamically modify the remaining number of requests allowed by the target Quota policy.\nYou typically use this policy to decrease the current quota count of the target Quota policy\nrather than waiting for the quota count to reset.\n\nFor example, the target Quota policy limits a developer to 1000 requests per week. By the\nsecond day of the week, the developer has already reached this limit. Use the Reset Quota policy\nto subtract 500 from their quota counter to allow an additional 500 requests for the remainder of\nthe week. At the end of the week, the Quota policy resets, and the developer is back to 1000\nrequests for the week.\n\nThis policy is an *Extensible policy* and use of this policy might have cost or\nutilization implications, depending on your Apigee license. For information on policy types\nand usage implications, see\n[Policy types](/apigee/docs/api-platform/reference/policies/reference-overview-policy#policy-types).\n\nSee [Quota policy](/apigee/docs/api-platform/reference/policies/quota-policy) for more on\nthe Quota policy. Also see [this\ncommunity post](https://community.apigee.com/questions/27507/how-to-use-reset-quota-correctly.html) on using the Reset Quota policy.\n\n### Samples\n\nThese policy code samples illustrate how to reset quota counters: \n\n### Reset Default Counter\n\n```scdoc\n\u003cResetQuota name=\"resetQuota\"\u003e\n \u003cQuota name=\"MyQuotaPolicy\"\u003e\n \u003cIdentifier name=\"_default\"\u003e\n \u003cAllow\u003e100\u003c/Allow\u003e\n \u003c/Identifier\u003e\n \u003c/Quota\u003e\n\u003c/ResetQuota\u003e\n```\n\nThe Reset Quota policy specifies the target Quota policy by using the name attribute of the \\\u003cQuota\\\u003e tag. In the example above,\nthe MyQuotaPolicy policy is the target.\n\nAll Reset Quota policies require the \\\u003cIdentifier\\\u003e tag to specify the\ncounter in the Quota policy to update. By default, a Quota policy has a single counter,\nunless the Quota policy also includes the \\\u003cIdentifier\\\u003e tag. In this example,\nthe target Quota policy does not use the \\\u003cIdentifier\\\u003e tag, so you specify\nthe name attribute as\n_default.\n\nThe \\\u003cAllow\\\u003e element\nspecifies the value used to decrease the current quota count on the target policy. In this\nexample, the quota count is decreased by 100, to allow 100 more requests to the target Quota\npolicy. When the target Quota policy resets, this change is discarded.\n\nShown below is the definition of the target Quota policy: \n\n```text\n\u003cQuota name=\"MyQuotaPolicy\"\u003e\n \u003cInterval\u003e5\u003c/Interval\u003e\n \u003cTimeUnit\u003ehour\u003c/TimeUnit\u003e\n \u003cAllow count=\"100\"/\u003e\n\u003c/Quota\u003e\n```\n\n### Use a Reference\n\n```scdoc\n\u003cResetQuota name=\"resetQuota\"\u003e\n \u003cQuota ref=\"request.header.quotapolicy\"\u003e\n \u003cIdentifier name=\"_default\"\u003e\n \u003cAllow ref=\"request.header.allowquota\" /\u003e\n \u003c/Identifier\u003e\n \u003c/Quota\u003e\n\u003c/ResetQuota\u003e\n```\n\nIn this example, you pass the name of the target Quota policy, and the change to its quota\ncount, as headers in the request. You can then reference the flow variables containing these\nvalues in the Reset Quota policy.\n\n### Specify the Identifier\n\n```text\n\u003cResetQuota name=\"resetQuota\"\u003e\n \u003cQuota name=\"QuotaPolicy\"\u003e\n \u003cIdentifier ref=\"request.header.clientId\"\u003e\n \u003cAllow\u003e100\u003c/Allow\u003e\n \u003c/Identifier\u003e\n \u003c/Quota\u003e\n\u003c/ResetQuota\u003e\n```\n\nIf the target Quota policy specifies the \\\u003cIdentifier\\\u003e tag, then you can\nspecify the same value to the \\\u003cIdentifier\\\u003e tag of the Reset Quota\npolicy to update a specific quota count. Notice how the \\\u003cIdentifier\\\u003e tag in the target\nQuota policy below matches the value specified to the Reset Quota policy: \n\n```text\n\u003cQuota name=\"QuotaPolicy\"\u003e\n \u003cIdentifier ref=\"request.header.clientId\"/\u003e \n \u003cInterval\u003e5\u003c/Interval\u003e\n \u003cTimeUnit\u003ehour\u003c/TimeUnit\u003e\n \u003cAllow count=\"100\"/\u003e\n\u003c/Quota\u003e\n```\n\n*** ** * ** ***\n\nElement reference\n-----------------\n\nThe element reference describes the elements and attributes of the Reset Quota policy. \n\n```text\n\u003cResetQuota async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"Reset-Quota-1\"\u003e\n \u003cDisplayName\u003eReset Quota 1\u003c/DisplayName\u003e\n \u003cQuota name=\"quotaName\" ref=\"request.header.quotapolicy\"\u003e\n \u003cIdentifier name=\"identifierName\" ref=\"request.header.identifier\"\u003e\n \u003cClass ref=\"request.header.classIdentifier\" /\u003e\n \u003cAllow\u003e100\u003c/Allow\u003e\n \u003c/Identifier\u003e\n \u003c/Quota\u003e\n\u003c/ResetQuota\u003e\n```\n\n\\\u003cResetQuota\\\u003e attributes\n-------------------------\n\n```text\n\u003cResetQuota async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"Reset-Quota-1\"\u003e \n```\n\n\nThe following table describes attributes that are common to all policy parent elements:\n\n\\\u003cDisplayName\\\u003e element\n-----------------------\n\nUse in addition to the `name` attribute to label the policy in the\nmanagement UI proxy editor with a different, natural-language name. \n\n```text\n\u003cDisplayName\u003ePolicy Display Name\u003c/DisplayName\u003e\n```\n\n\u003cbr /\u003e\n\n\\\u003cQuota\\\u003e element\n-----------------\n\nIdentifies the target Quota policy whose counter should be updated. \n\n```text\n\u003cQuota name=\"quotaName\" ref=\"request.header.quotapolicy\"\u003e\n \u003cIdentifier name=\"identifierName\" ref=\"request.header.identifier\"\u003e\n \u003cAllow\u003e100\u003c/Allow\u003e\n \u003c/Identifier\u003e\n\u003c/Quota\u003e\n```\n\n### Attributes\n\n\\\u003cQuota\\\u003e/\\\u003cIdentifier\\\u003e element\n--------------------------------\n\nVariable used to uniquely identify the counter if the target Quota policy specifies\nthe \\\u003cIdentifier\\\u003e tag. \n\n```text\n\u003cQuota name=\"quotaName\"\u003e\n \u003cIdentifier name=\"identifierName\" ref=\"request.header.identifier\"\u003e\n \u003cAllow\u003e100\u003c/Allow\u003e\n \u003c/Identifier\u003e\n\u003c/Quota\u003e\n```\n\n### Attributes\n\n\\\u003cQuota\\\u003e/\\\u003cIdentifier\\\u003e/\\\u003cAllow\\\u003e element\n------------------------------------------\n\nSpecifies the amount to decrease the quota counter. You must specify \\\u003cAllow\\\u003e, otherwise, the policy does not\nmodify the quota. \n\n```text\n\u003cIdentifier name=\"identifierName\" ref=\"request.header.identifier\"\u003e\n \u003cAllow ref=\"request.header.allowquota\"\u003e100\u003c/Allow\u003e\n\u003c/Identifier\u003e\n```\n\n### Attributes\n\n\\\u003cQuota\\\u003e/\\\u003cIdentifier\\\u003e/\\\u003cClass\\\u003e element\n------------------------------------------\n\nSpecifies the class for which the Quota counter is updated. For more on using class with the\nQuota policy, see [Quota\npolicy](/apigee/docs/api-platform/reference/policies/quota-policy). \n\n```scdoc\n\u003cIdentifier name=\"_default\"\u003e\n \u003cClass ref=\"request.header.classIdentifier\"\u003e\n \u003cAllow\u003e200\u003c/Allow\u003e\n \u003c/Class\u003e\n\u003c/Identifier\u003e\n```\n\n### Attributes\n\nError reference\n---------------\n\n\nThis 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.\nThis information is important to know if you are developing fault rules to\nhandle faults. To learn more, see [What you need to know\nabout policy errors](/apigee/docs/api-platform/fundamentals/what-you-need-know-about-policy-errors) and [Handling\nfaults](/apigee/docs/api-platform/fundamentals/fault-handling).\n\n### Runtime errors\n\nThese errors can occur when the policy executes.\n| **Tip:** Need help resolving an error? Click *build* in the Fix column for detailed troubleshooting information.\n\n### Deployment errors\n\nThese errors can occur when you deploy a proxy containing this policy.\n| **Tip:** Need help resolving an error? Click *build* next to the error's cause description to visit the troubleshooting page.\n\n\u003cbr /\u003e\n\nSchemas\n-------\n\n| **Sample:** See our [GitHub\n| repository](https://github.com/apigee/api-platform-samples/tree/master/schemas/policy) samples for the most recent schemas.\n\nRelated topics\n--------------\n\n[Quota policy](/apigee/docs/api-platform/reference/policies/quota-policy)"]]