---
title: "POST /v1/{+parent}/serviceConnectionPolicies"
method: POST
path: "/v1/{+parent}/serviceConnectionPolicies"
tags: ["projects"]
---

# POST /v1/{+parent}/serviceConnectionPolicies

`POST /v1/{+parent}/serviceConnectionPolicies`

Creates a new ServiceConnectionPolicy in a given project and location.

## Path parameters

- `parent` string, required

## Query parameters

- `autoSubnetworkConfig.allocRangeSpace` string[]
- `autoSubnetworkConfig.ipStack` 'SUBNET_IP_STACK_UNSPECIFIED' | 'IPV4_ONLY' | 'IPV6_ONLY' | 'IPV4_IPV6'
- `autoSubnetworkConfig.prefixLength` integer
- `requestId` string
- `serviceConnectionPolicyId` string
- `subnetworkMode` 'SUBNETWORK_MODE_UNSPECIFIED' | 'USER_PROVIDED' | 'AUTO_CREATED'

## Request body

- ServiceConnectionPolicy — The ServiceConnectionPolicy resource.
  - `name` string — Immutable. The name of a ServiceConnectionPolicy. Format: projects/{project}/locations/{location}/serviceConnectionPolicies/{service_connection_policy} See: https://google.aip.dev/122#fields-representing-resource-names
  - `network` string — The resource path of the consumer network. Example: - projects/{projectNumOrId}/global/networks/{resourceId}.
  - `labels` object — User-defined labels.
  - `etag` string — Optional. The etag is computed by the server, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
  - `infrastructure` 'INFRASTRUCTURE_UNSPECIFIED' | 'PSC' — Output only. The type of underlying resources used to create the connection.
  - `serviceClass` string — The service class identifier for which this ServiceConnectionPolicy is for. The service class identifier is a unique, symbolic representation of a ServiceClass. It is provided by the Service Producer. Google services have a prefix of gcp or google-cloud. For example, gcp-memorystore-redis or google-cloud-sql. 3rd party services do not. For example, test-service-a3dfcx.
  - `createTime` string, google-datetime — Output only. Time when the ServiceConnectionPolicy was created.
  - `description` string — A description of this resource.
  - `pscConfig` PscConfig — Configuration used for Private Service Connect connections. Used when Infrastructure is PSC.
    - `limit` string, int64 — Optional. Max number of PSC connections for this policy.
    - `producerInstanceLocation` 'PRODUCER_INSTANCE_LOCATION_UNSPECIFIED' | 'CUSTOM_RESOURCE_HIERARCHY_LEVELS' — Optional. ProducerInstanceLocation is used to specify which authorization mechanism to use to determine which projects the Producer instance can be within.
    - `subnetworks` string[] — The resource paths of subnetworks to use for IP address management. Example: projects/{projectNumOrId}/regions/{region}/subnetworks/{resourceId}.
    - `allowedGoogleProducersResourceHierarchyLevel` string[] — Optional. List of Projects, Folders, or Organizations from where the Producer instance can be within. For example, a network administrator can provide both 'organizations/foo' and 'projects/bar' as allowed_google_producers_resource_hierarchy_levels. This allowlists this network to connect with any Producer instance within the 'foo' organization or the 'bar' project. By default, allowed_google_producers_resource_hierarchy_level is empty. The format for each allowed_google_producers_resource_hierarchy_level is / where is one of 'projects', 'folders', or 'organizations' and is either the ID or the number of the resource type. Format for each allowed_google_producers_resource_hierarchy_level value: 'projects/' or 'folders/' or 'organizations/' Eg. [projects/my-project-id, projects/567, folders/891, organizations/123]
  - `pscConnections` PscConnection[] — Output only. [Output only] Information about each Private Service Connect connection.
    - `selectedSubnetwork` string — Output only. The URI of the subnetwork selected to allocate IP address for this connection.
    - `error` GoogleRpcStatus — The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
      - `details` object[] — A list of messages that carry the error details. There is a common set of message types for APIs to use.
      - `message` string — A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
      - `code` integer — The status code, which should be an enum value of google.rpc.Code.
    - `producerInstanceId` string — Immutable. Deprecated. Use producer_instance_metadata instead. An immutable identifier for the producer instance.
    - `errorType` 'CONNECTION_ERROR_TYPE_UNSPECIFIED' | 'ERROR_INTERNAL' | 'ERROR_CONSUMER_SIDE' | 'ERROR_PRODUCER_SIDE' — The error type indicates whether the error is consumer facing, producer facing or system internal.
    - `consumerForwardingRule` string — The resource reference of the PSC Forwarding Rule within the consumer VPC.
    - `pscConnectionId` string — The PSC connection id of the PSC forwarding rule.
    - `state` 'STATE_UNSPECIFIED' | 'ACTIVE' | 'FAILED' | 'CREATING' | 'DELETING' | 'CREATE_REPAIRING' | 'DELETE_REPAIRING' — State of the PSC Connection
    - `errorInfo` GoogleRpcErrorInfo — Describes the cause of the error with structured details. Example of an error when contacting the "pubsub.googleapis.com" API when it is not enabled: { "reason": "API_DISABLED" "domain": "googleapis.com" "metadata": { "resource": "projects/123", "service": "pubsub.googleapis.com" } } This response indicates that the pubsub.googleapis.com API is not enabled. Example of an error that is returned when attempting to create a Spanner instance in a region that is out of stock: { "reason": "STOCKOUT" "domain": "spanner.googleapis.com", "metadata": { "availableRegions": "us-central1,us-east2" } }
      - `domain` string — The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com".
      - `reason` string — The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `A-Z+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.
      - `metadata` object — Additional structured details about this error. Keys must match a regular expression of `a-z+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request.
    - `consumerTargetProject` string — The project where the PSC connection is created.
    - `ipVersion` 'IP_VERSION_UNSPECIFIED' | 'IPV4' | 'IPV6' — The requested IP version for the PSC connection.
    - `gceOperation` string — The last Compute Engine operation to setup PSC connection.
    - `producerInstanceMetadata` object — Immutable. An immutable map for the producer instance metadata.
    - `serviceClass` string — Output only. [Output only] The service class associated with this PSC Connection. The value is derived from the SCPolicy and matches the service class name provided by the customer.
    - `consumerAddress` string — The resource reference of the consumer address.
  - `updateTime` string, google-datetime — Output only. Time when the ServiceConnectionPolicy was updated.
  - `autoCreatedSubnetInfo` AutoCreatedSubnetworkInfo — Information for the automatically created subnetwork and its associated IR.
    - `internalRange` string — Output only. URI of the automatically created Internal Range. Only set if the subnetwork mode is AUTO_CREATED during creation.
    - `delinked` boolean — Output only. Indicates whether the subnetwork is delinked from the Service Connection Policy. Only set if the subnetwork mode is AUTO_CREATED during creation.
    - `subnetworkRef` string — Output only. URI of the automatically created subnetwork reference. Only set if the subnetwork mode is AUTO_CREATED during creation.
    - `internalRangeRef` string — Output only. URI of the automatically created Internal Range reference. Only set if the subnetwork mode is AUTO_CREATED during creation.
    - `subnetwork` string — Output only. URI of the automatically created subnetwork. Only set if the subnetwork mode is AUTO_CREATED during creation.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/networkconnectivity.md) · [All operations](https://skmtc.net/google/apis/networkconnectivity/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/networkconnectivity/versions/778637dee420/schema)
