---
title: "POST /v1/services/{servicesId}:validate"
method: POST
path: "/v1/services/{servicesId}:validate"
tags: ["services"]
---

# POST /v1/services/{servicesId}:validate

`POST /v1/services/{servicesId}:validate`

## Request

- Base URL: `https://servicenetworking.googleapis.com`
- URL: `https://servicenetworking.googleapis.com/v1/services/{servicesId}:validate`
- 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/service.management`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/service.management`

Service producers use this method to validate if the consumer provided network, project and requested range are valid. This allows them to use a fail-fast mechanism for consumer requests, and not have to wait for AddSubnetwork operation completion to determine if user request is invalid.

## Path parameters

- `servicesId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string

## Request body

- ValidateConsumerConfigRequest
  - `checkServiceNetworkingUsePermission` boolean: Optional. The IAM permission check determines whether the consumer project has 'servicenetworking.services.use' permission or not.
  - `consumerNetwork` string: Required. The network that the consumer is using to connect with services. Must be in the form of projects/{project}/global/networks/{network} {project} is a project number, as in '12345' {network} is network name.
  - `consumerProject` ConsumerProject: Represents a consumer project.
    - `projectNum` string, int64: Required. Project number of the consumer that is launching the service instance. It can own the network that is peered with Google or, be a service project in an XPN where the host project has the network.
  - `rangeReservation` RangeReservation: Represents a range reservation.
    - `ipPrefixLength` integer: Required. The size of the desired subnet. Use usual CIDR range notation. For example, '29' to find unused x.x.x.x/29 CIDR range. The goal is to determine if one of the allocated ranges has enough free space for a subnet of the requested size. GCE disallows subnets with prefix_length > 29
    - `requestedRanges` string[]: Optional. The name of one or more allocated IP address ranges associated with this private service access connection. If no range names are provided all ranges associated with this connection will be considered. If a CIDR range with the specified IP prefix length is not available within these ranges the validation fails.
    - `secondaryRangeIpPrefixLengths` integer[]: Optional. The size of the desired secondary ranges for the subnet. Use usual CIDR range notation. For example, '29' to find unused x.x.x.x/29 CIDR range. The goal is to determine that the allocated ranges have enough free space for all the requested secondary ranges. GCE disallows subnets with prefix_length > 29
    - `subnetworkCandidates` Subnetwork[]: Optional. List of subnetwork candidates to validate. The required input fields are `name`, `network`, and `region`. Subnetworks from this list which exist will be returned in the response with the `ip_cidr_range`, `secondary_ip_cider_ranges`, and `outside_allocation` fields set.
      - `ipCidrRange` string: Subnetwork CIDR range in `10.x.x.x/y` format.
      - `name` string: Subnetwork name. See https://cloud.google.com/compute/docs/vpc/
      - `network` string: In the Shared VPC host project, the VPC network that's peered with the consumer network. For example: `projects/1234321/global/networks/host-network`
      - `outsideAllocation` boolean: This is a discovered subnet that is not within the current consumer allocated ranges.
      - `region` string: GCP region where the subnetwork is located.
      - `secondaryIpRanges` SecondaryIpRange[]: List of secondary IP ranges in this subnetwork.
        - `ipCidrRange` string: Secondary IP CIDR range in `x.x.x.x/y` format.
        - `rangeName` string: Name of the secondary IP range.
  - `validateNetwork` boolean: The validations will be performed in the order listed in the ValidationError enum. The first failure will return. If a validation is not requested, then the next one will be performed. SERVICE_NETWORKING_NOT_ENABLED and NETWORK_NOT_PEERED checks are performed for all requests where validation is requested. NETWORK_NOT_FOUND and NETWORK_DISCONNECTED checks are done for requests that have validate_network set to true.

## Response `200`

Successful response

- ValidateConsumerConfigResponse
  - `existingSubnetworkCandidates` Subnetwork[]: List of subnetwork candidates from the request which exist with the `ip_cidr_range`, `secondary_ip_cider_ranges`, and `outside_allocation` fields set.
    - `ipCidrRange` string: Subnetwork CIDR range in `10.x.x.x/y` format.
    - `name` string: Subnetwork name. See https://cloud.google.com/compute/docs/vpc/
    - `network` string: In the Shared VPC host project, the VPC network that's peered with the consumer network. For example: `projects/1234321/global/networks/host-network`
    - `outsideAllocation` boolean: This is a discovered subnet that is not within the current consumer allocated ranges.
    - `region` string: GCP region where the subnetwork is located.
    - `secondaryIpRanges` SecondaryIpRange[]: List of secondary IP ranges in this subnetwork.
      - `ipCidrRange` string: Secondary IP CIDR range in `x.x.x.x/y` format.
      - `rangeName` string: Name of the secondary IP range.
  - `isValid` boolean: Indicates whether all the requested validations passed.
  - `validationError` 'VALIDATION_ERROR_UNSPECIFIED' | 'VALIDATION_NOT_REQUESTED' | 'SERVICE_NETWORKING_NOT_ENABLED' | 'NETWORK_NOT_FOUND' | 'NETWORK_NOT_PEERED' | 'NETWORK_PEERING_DELETED' | 'NETWORK_NOT_IN_CONSUMERS_PROJECT' | 'NETWORK_NOT_IN_CONSUMERS_HOST_PROJECT' | 'HOST_PROJECT_NOT_FOUND' | 'CONSUMER_PROJECT_NOT_SERVICE_PROJECT' | 'RANGES_EXHAUSTED' | 'RANGES_NOT_RESERVED' | 'RANGES_DELETED_LATER' | 'COMPUTE_API_NOT_ENABLED' | 'USE_PERMISSION_NOT_FOUND' | 'SN_SERVICE_AGENT_PERMISSION_DENIED_ON_CONSUMER_PROJECT': The first validation which failed.

## Changes

- **2026-10-30** `fce47f09d856`: 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/service.management` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/service.management` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/servicenetworking/changes/v1/services/:servicesId:validate/post.md)

---

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