---
title: "POST /projects/{project}/global/networks/{network}/addPeering"
method: POST
path: "/projects/{project}/global/networks/{network}/addPeering"
tags: ["networks"]
---

# POST /projects/{project}/global/networks/{network}/addPeering

`POST /projects/{project}/global/networks/{network}/addPeering`

Adds a peering to the specified network.

## Path parameters

- `project` string, required
- `network` string, required

## Query parameters

- `requestId` string

## Request body

- NetworksAddPeeringRequest
  - `peerNetwork` string — URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network.
  - `networkPeering` NetworkPeering — A network peering attached to a network resource. The message includes the peering name, peer network, peering state, and a flag indicating whether Google Compute Engine should automatically create routes for the peering.
    - `updateStrategy` 'CONSENSUS' | 'INDEPENDENT' | 'UNSPECIFIED' — The update strategy determines the semantics for updates and deletes to the peering connection configuration.
    - `stackType` 'IPV4_IPV6' | 'IPV4_ONLY' — Which IP version(s) of traffic and routes are allowed to be imported or exported between peer networks. The default value is IPV4_ONLY.
    - `exchangeSubnetRoutes` boolean — Indicates whether full mesh connectivity is created and managed automatically between peered networks. Currently this field should always be true since Google Compute Engine will automatically create and manage subnetwork routes between two networks when peering state isACTIVE.
    - `connectionStatus` NetworkPeeringConnectionStatus — [Output Only] Describes the state of a peering connection, not just the local peering. This field provides information about the effective settings for the connection as a whole, including pending delete/update requests for CONSENSUS peerings.
      - `updateStrategy` 'CONSENSUS' | 'INDEPENDENT' | 'UNSPECIFIED' — The update strategy determines the update/delete semantics for this peering connection.
      - `trafficConfiguration` NetworkPeeringConnectionStatusTrafficConfiguration
        - `importSubnetRoutesWithPublicIpFromPeer` boolean — Whether subnet routes with public IP ranges are being imported from the peer network.
        - `importCustomRoutesFromPeer` boolean — Whether custom routes are being imported from the peer network.
        - `stackType` 'IPV4_IPV6' | 'IPV4_ONLY' — Which IP version(s) of traffic and routes are being imported or exported between peer networks.
        - `exportCustomRoutesToPeer` boolean — Whether custom routes are being exported to the peer network.
        - `exportSubnetRoutesWithPublicIpToPeer` boolean — Whether subnet routes with public IP ranges are being exported to the peer network.
      - `consensusState` NetworkPeeringConnectionStatusConsensusState — The status of update/delete for a consensus peering connection. Only set when connection_status.update_strategy isCONSENSUS or a network peering is proposing to update the strategy to CONSENSUS.
        - `deleteStatus` 'DELETE_ACKNOWLEDGED' | 'DELETE_STATUS_UNSPECIFIED' | 'LOCAL_CANCEL_REQUESTED' | 'LOCAL_DELETE_REQUESTED' | 'PEER_CANCEL_REQUESTED' | 'PEER_DELETE_REQUESTED' — The status of the delete request.
        - `updateStatus` 'IN_SYNC' | 'PENDING_LOCAL_ACKNOWLEDMENT' | 'PENDING_PEER_ACKNOWLEDGEMENT' | 'UPDATE_STATUS_UNSPECIFIED' — The status of the update request.
    - `exportSubnetRoutesWithPublicIp` boolean — Whether subnet routes with public IP range are exported. The default value is true, all subnet routes are exported.IPv4 special-use ranges are always exported to peers and are not controlled by this field.
    - `autoCreateRoutes` boolean — This field will be deprecated soon. Use theexchange_subnet_routes field instead. Indicates whether full mesh connectivity is created and managed automatically between peered networks. Currently this field should always be true since Google Compute Engine will automatically create and manage subnetwork routes between two networks when peering state isACTIVE.
    - `network` string — The URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network.
    - `exportCustomRoutes` boolean — Whether to export the custom routes to peer network. The default value is false.
    - `importSubnetRoutesWithPublicIp` boolean — Whether subnet routes with public IP range are imported. The default value is false.IPv4 special-use ranges are always imported from peers and are not controlled by this field.
    - `peerMtu` integer — Output only. [Output Only] Maximum Transmission Unit in bytes of the peer network.
    - `name` string — Name of this peering. Provided by the client when the peering is created. The name must comply withRFC1035. Specifically, the name must be 1-63 characters long and match regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a lowercase letter, and all the following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
    - `state` 'ACTIVE' | 'INACTIVE' — Output only. [Output Only] State for the peering.
    - `importCustomRoutes` boolean — Whether to import the custom routes from peer network. The default value is false.
    - `stateDetails` string — Output only. [Output Only] Details about the current state of the peering.
  - `name` string — Name of the peering, which should conform to RFC1035.
  - `autoCreateRoutes` boolean — This field will be deprecated soon. Useexchange_subnet_routes in network_peering instead. Indicates whether full mesh connectivity is created and managed automatically between peered networks. Currently this field should always be true since Google Compute Engine will automatically create and manage subnetwork routes between two networks when peering state isACTIVE.

## Response `200`

Successful response

---

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