The Service Consumer Management API lets you view and override the quota limits enforced on individual consumers of your service. As a service producer, you can apply consumer quota overrides to allocate temporary capacity for promotional events, support custom tier agreements, or grant elevated limits for evaluation and testing.
The Service Consumer Management API displays information only about a project's quota limits, not its quota usage. To get quota usage data, use the Cloud Monitoring API instead.
Before you begin
Familiarize yourself with the Cloud Quotas overview to understand the quota concepts used in this document.
To get the permissions that you need to view quota and manage producer overrides, ask your administrator to grant you the Service Consumer Management Admin (
roles/serviceconsumermanagement.admin) IAM role on the service. This role contains theserviceconsumermanagement.quota.getandserviceconsumermanagement.quota.updatepermissions.Make sure that you have the Google Cloud CLI installed and initialized.
To program against the Service Consumer Management API, use the provided client libraries. To experiment with the API without setting up a full development environment, define a
gcurlalias that passes an authentication token:alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
Display consumer quota
To inspect consumer quota metrics and limits, follow these steps:
To see all quota limits on all metrics that apply to a particular consumer, use the following method:
gcurl https://serviceconsumermanagement.googleapis.com/v1beta1/services/SERVICE_NAME/projects/PROJECT_ID/consumerQuotaMetricsReplace the following:
SERVICE_NAME: the name of your service.PROJECT_ID: the ID of the consumer project of interest.
This call responds with a list of metrics defined by the service, each with the list of limits on those metrics that apply to this consumer, the values for those limits, and any overrides. The output is similar to the following:
{ "metrics": [ { "name": "services/myservice.appspot.com/projects/consumer-project-id/consumerQuotaMetrics/airport_requests", "metric": "airport_requests", "displayName": "Airport Requests", "consumerQuotaLimits": [ { "name": "services/myservice.appspot.com/projects/consumer-project-id/consumerQuotaMetrics/airport_requests/limits/%2Fmin%2Fproject", "metric": "airport_requests", "unit": "1/min/{project}", "quotaBuckets": [ { "effectiveLimit": "5", "defaultLimit": "5" } ] } ] } ] }Each metric in the response contains a
namefield.To inspect quota settings for a specific metric rather than for all metrics, use its name in the URL:
gcurl https://serviceconsumermanagement.googleapis.com/v1beta1/METRIC_NAMEReplace
METRIC_NAMEwith the fully qualified name of the metric. For example:services/myservice.appspot.com/projects/consumer-project-id/consumerQuotaMetrics/airport_requestsEach limit within a metric contains a
namefield.To inspect quota settings only for a specific limit on a metric rather than for all limits on a metric or all metrics, use its name in the URL:
gcurl https://serviceconsumermanagement.googleapis.com/v1beta1/LIMIT_NAMEReplace
LIMIT_NAMEwith the fully qualified name of the limit. For example:services/myservice.appspot.com/projects/consumer-project-id/consumerQuotaMetrics/airport_requests/limits/%2Fmin%2Fproject
Apply a producer override
The owner or administrator of a service can apply a producer override to a specific limit for a specific consumer, increasing or decreasing that limit.
To apply a producer override to a limit, make a
POSTrequest to the limit'sproducerOverridescollection with the override value:gcurl -X POST https://serviceconsumermanagement.googleapis.com/v1beta1/LIMIT_NAME/producerOverrides \ -d '{"overrideValue": "12345"}'This call creates a new override on the limit. If an override already exists for the specified dimensions, the call fails. To update an existing override, send a
PATCHrequest to the override resource name by using theproducerOverrides.patchmethod, or use theconsumerQuotaMetrics.importProducerOverridesmethod to apply overrides with upsert semantics. To grant unlimited quota on a limit, use-1as the override value.If the call succeeds, it returns an operation identifier, which represents ongoing work on the server as the quota change propagates to backend systems. The output is similar to the following:
{ "name": "operations/quf.92accba3-6530-4fc1-9a95-c1280d48a6b7" }To check the progress of the operation, use its name:
gcurl https://serviceconsumermanagement.googleapis.com/v1beta1/OPERATION_NAMEWhen this call responds with a message that includes
"done": true, the operation is finished. If the operation fails, the message includes error details.To verify that the change is applied, retrieve the quota settings for the specific limit by repeating the call with the limit name in the URL. For instructions, see Display service quota. A bucket in the limit's
quotaBucketslist includes an additionalproducerOverridefield.
Force large quota changes
If an override causes the enforced quota to decrease by more than 10%, the
API rejects the call as a safety measure to prevent accidentally decreasing
quota too quickly. To disregard this restriction, set the force query
parameter to true:
gcurl -X POST "https://serviceconsumermanagement.googleapis.com/v1beta1/LIMIT_NAME/producerOverrides?force=true" \
-d '{"overrideValue": "0"}'
Apply regional or zonal quota overrides
Some quota limits are enforced on a per-region or per-zone basis, indicated
by the presence of /{region} or /{zone} in the limit unit.
Applying an override to such a limit changes the base quota on every region or
zone. To change the quota for only a specific region or zone, use the
dimensions field:
gcurl -X POST https://serviceconsumermanagement.googleapis.com/v1beta1/LIMIT_NAME/producerOverrides \
-d '{"overrideValue": "135", "dimensions": {"region": "asia-south1"}}'
Delete a producer override
To remove a producer override after a temporary event or evaluation period ends,
send a DELETE request to the override resource name:
gcurl -X DELETE https://serviceconsumermanagement.googleapis.com/v1beta1/OVERRIDE_NAME
Replace OVERRIDE_NAME with the resource name of the
override. For example:
services/myservice.appspot.com/projects/consumer-project-id/consumerQuotaMetrics/airport_requests/limits/%2Fmin%2Fproject/producerOverrides/4a3f2c1d
The override name is returned in the name field of a bucket's
producerOverride object when you inspect the limit, or in the response field
of the completed operation when you create the override.
If deleting an override causes the consumer's effective quota to decrease by
more than 10%, the API rejects the deletion with the same safety check as
creating or updating an override. To disregard this restriction, append the
?force=true query parameter to the DELETE request URL.
As when creating an override, this call returns a long-running operation identifier. To check whether deletion is complete, query the operation by using the operation name.