---
title: "POST /projects/{project}/regions/{region}/advice/capacity"
method: POST
path: "/projects/{project}/regions/{region}/advice/capacity"
tags: ["advice"]
---

# POST /projects/{project}/regions/{region}/advice/capacity

`POST /projects/{project}/regions/{region}/advice/capacity`

## Request

- Base URL: `https://compute.googleapis.com/compute/v1`
- URL: `https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/advice/capacity`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/compute`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/compute`

Advice on making real-time decisions (such as choosing zone or
machine types) during deployment to maximize your chances of obtaining
capacity.

## Path parameters

- `project` string, required
- `region` string, required

## Request body

- CapacityAdviceRequest: A request to provide Assistant Scores. These scores determine VM obtainability and preemption likelihood.
  - `distributionPolicy` CapacityAdviceRequestDistributionPolicy: Distribution policy.
    - `targetShape` 'ANY' | 'ANY_SINGLE_ZONE' | 'BALANCED' | 'TARGET_SHAPE_UNSPECIFIED': Target distribution shape. You can specify the following values:ANY, ANY_SINGLE_ZONE, or BALANCED.
    - `zones` CapacityAdviceRequestDistributionPolicyZoneConfiguration[]: Zones where Capacity Advisor looks for capacity.
      - `zone` string: The URL of the zone. It can be a partial or full URL. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone - projects/project/zones/zone - zones/zone
  - `instanceFlexibilityPolicy` CapacityAdviceRequestInstanceFlexibilityPolicy: Specification of alternative, flexible instance configurations.
    - `instanceSelections` object: Named instance selections to configure properties. The key is an arbitrary, unique RFC1035 string that identifies the instance selection.
  - `instanceProperties` CapacityAdviceRequestInstanceProperties: Instance provisioning properties.
    - `scheduling` CapacityAdviceRequestInstancePropertiesScheduling: Defines the instance scheduling options.
      - `provisioningModel` 'FLEX_START' | 'RESERVATION_BOUND' | 'SPOT' | 'STANDARD': Specifies the provisioning model.
  - `size` integer: The number of VM instances to request.

## Response `200`

Successful response

- CapacityAdviceResponse: A response contains scoring recommendations.
  - `recommendations` CapacityAdviceResponseRecommendation[]: Initially the API will provide one recommendation which balances the individual scores according to the service provider's preference.
    - `scores` CapacityAdviceResponseRecommendationScores: Groups information about a shard of capacity.
      - `estimatedUptime` string, google-duration: The estimated run time of the majority of Spot VMs in the request before preemption. The estimate is best-effort only. It is based on historical data and current conditions.
      - `obtainability` number, double: The obtainability score indicates the likelihood of successfully obtaining (provisioning) the requested number of VMs. The score range is 0.0 through 1.0. Higher is better.
    - `shards` CapacityAdviceResponseRecommendationShard[]: Shards represent blocks of uniform capacity in recommendations.
      - `instanceCount` integer: The number of instances.
      - `machineType` string: The machine type corresponds to the instance selection in the request.
      - `provisioningModel` 'FLEX_START' | 'RESERVATION_BOUND' | 'SPOT' | 'STANDARD': The provisioning model that you want to view recommendations for.
      - `zone` string: Output only. The zone name for this shard.

## Changes

- **2026-10-30** `8b85e897d3dc`: 4 info
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/compute` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/compute` was removed from the endpoint's security scheme `Oauth2c`
- **2026-10-23** `48929bf89eeb`: 4 info
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/compute` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/compute` was removed from the endpoint's security scheme `Oauth2c`
- **2026-10-10** `aca8b5925289`: 2 breaking, 4 info
  - removed the request body
  - removed the media type `*/*` for the response with the status `200`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2c`
  - …2 more
- …earlier changes not shown

[Operation history](https://skmtc.dev/google/apis/compute/changes/projects/:project/regions/:region/advice/capacity/post.md)

---

[API](https://skmtc.dev/google/apis/compute.md) - [All operations](https://skmtc.dev/google/apis/compute/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/compute/revisions/8b85e897d3dc?raw)
