---
title: Create or replace an origin cloud region mapping
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/go)

[Cache](https://developers.cloudflare.com/api/go/resources/cache)

[Origin Cloud Regions](https://developers.cloudflare.com/api/go/resources/cache/subresources/origin_cloud_regions)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Create or replace an origin cloud region mapping

client.Cache.OriginCloudRegions.Update(ctx, originIP, params) (\*[OriginCloudRegionUpdateResponse](<https://developers.cloudflare.com/api/go/resources/cache#(resource)%20cache.origin_cloud_regions%20%3E%20(model)%20OriginCloudRegionUpdateResponse%20%3E%20(schema)>), error)

PUT/zones/{zone\_id}/origin/cloud\_regions/{origin\_ip}

Creates a new IP-to-cloud-region mapping or replaces the existing mapping for the specified IP. PUT is idempotent — calling it repeatedly with the same body produces the same result. The IP path parameter is normalized to canonical form (RFC 5952 for IPv6) before storage. The vendor and region are validated against the list from `GET /zones/{zone_id}/origin/cloud_regions/supported_regions`. Returns 400 if the `origin_ip` in the body does not match the URL path parameter. Returns 403 (code 1164) when the zone has reached the limit of 3,500 IP mappings.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**<code>X-Auth-Email: user@example.com</code>

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### ParametersExpand Collapse

originIP string

[Link to this property](<#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20origin_ip%20%3E%20(schema)>)

<details>

<summary>

params OriginCloudRegionUpdateParams

</summary>

ZoneID param.Field\[string]

Path param: Identifier.

maxLength32

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20zone_id">Link to this property</a>

OriginIP param.Field\[string]

Body param: Origin IP address (IPv4 or IPv6). For the single PUT endpoint (<code>PUT /origin/cloud_regions/{origin_ip}</code>), this field must match the path parameter or the request will be rejected with a 400 error. For the batch PUT endpoint, this field identifies which mapping to upsert.

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20origin_ip">Link to this property</a>

Region param.Field\[string]

Body param: Cloud vendor region identifier. Must be a valid region for the specified vendor as returned by the supported\_regions endpoint.

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20region">Link to this property</a>

<details>

<summary>

Vendor param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/cache/subresources/origin_cloud_regions/methods/update#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20vendor%20%3E%20(schema)">OriginCloudRegionUpdateParamsVendor</a>]

Body param: Cloud vendor hosting the origin. Must be one of the supported vendors.

</summary>

const OriginCloudRegionUpdateParamsVendorAws <a href="https://developers.cloudflare.com/api/go/resources/cache/subresources/origin_cloud_regions/methods/update#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20vendor%20%3E%20(schema)">OriginCloudRegionUpdateParamsVendor</a> = "aws"

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20vendor%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

const OriginCloudRegionUpdateParamsVendorAzure <a href="https://developers.cloudflare.com/api/go/resources/cache/subresources/origin_cloud_regions/methods/update#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20vendor%20%3E%20(schema)">OriginCloudRegionUpdateParamsVendor</a> = "azure"

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20vendor%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

const OriginCloudRegionUpdateParamsVendorGcp <a href="https://developers.cloudflare.com/api/go/resources/cache/subresources/origin_cloud_regions/methods/update#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20vendor%20%3E%20(schema)">OriginCloudRegionUpdateParamsVendor</a> = "gcp"

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20vendor%20%3E%20(schema)%20%3E%20(member)%202">Link to this property</a>

const OriginCloudRegionUpdateParamsVendorOci <a href="https://developers.cloudflare.com/api/go/resources/cache/subresources/origin_cloud_regions/methods/update#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20vendor%20%3E%20(schema)">OriginCloudRegionUpdateParamsVendor</a> = "oci"

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20vendor%20%3E%20(schema)%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20vendor">Link to this property</a>

</details>

[Link to this property](<#(resource)%20cache.origin_cloud_regions%20%3E%20(method)%20update%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type OriginCloudRegionUpdateResponse struct{…}

A single origin IP-to-cloud-region mapping.

</summary>

OriginIP string

The origin IP address (IPv4 or IPv6). Normalized to canonical form (RFC 5952 for IPv6).

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(model)%20OriginCloudRegionUpdateResponse%20%3E%20(schema)%20%3E%20(property)%20origin_ip">Link to this property</a>

Region string

Cloud vendor region identifier.

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(model)%20OriginCloudRegionUpdateResponse%20%3E%20(schema)%20%3E%20(property)%20region">Link to this property</a>

<details>

<summary>

Vendor OriginCloudRegionUpdateResponseVendor

Cloud vendor hosting the origin.

</summary>

One of the following:

const OriginCloudRegionUpdateResponseVendorAws OriginCloudRegionUpdateResponseVendor = "aws"

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(model)%20OriginCloudRegionUpdateResponse%20%3E%20(schema)%20%3E%20(property)%20vendor%20%3E%20(member)%200">Link to this property</a>

const OriginCloudRegionUpdateResponseVendorAzure OriginCloudRegionUpdateResponseVendor = "azure"

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(model)%20OriginCloudRegionUpdateResponse%20%3E%20(schema)%20%3E%20(property)%20vendor%20%3E%20(member)%201">Link to this property</a>

const OriginCloudRegionUpdateResponseVendorGcp OriginCloudRegionUpdateResponseVendor = "gcp"

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(model)%20OriginCloudRegionUpdateResponse%20%3E%20(schema)%20%3E%20(property)%20vendor%20%3E%20(member)%202">Link to this property</a>

const OriginCloudRegionUpdateResponseVendorOci OriginCloudRegionUpdateResponseVendor = "oci"

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(model)%20OriginCloudRegionUpdateResponse%20%3E%20(schema)%20%3E%20(property)%20vendor%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(model)%20OriginCloudRegionUpdateResponse%20%3E%20(schema)%20%3E%20(property)%20vendor">Link to this property</a>

ModifiedOn TimeOptional

Time this mapping was last modified.

formatdate-time

<a href="#(resource)%20cache.origin_cloud_regions%20%3E%20(model)%20OriginCloudRegionUpdateResponse%20%3E%20(schema)%20%3E%20(property)%20modified_on">Link to this property</a>

</details>

[Link to this property](<#(resource)%20cache.origin_cloud_regions%20%3E%20(model)%20OriginCloudRegionUpdateResponse%20%3E%20(schema)>)

### Create or replace an origin cloud region mapping

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/cache"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  originCloudRegion, err := client.Cache.OriginCloudRegions.Update(
    context.TODO(),
    "192.0.2.1",
    cache.OriginCloudRegionUpdateParams{
      ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
      OriginIP: cloudflare.F("192.0.2.1"),
      Region: cloudflare.F("us-east-1"),
      Vendor: cloudflare.F(cache.OriginCloudRegionUpdateParamsVendorAws),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", originCloudRegion.OriginIP)
}
```

200 example

4XX example

4XX example

4XX example

```
{
  "errors": [],
  "messages": [],
  "result": {
    "modified_on": "2026-03-01T12:00:00Z",
    "origin_ip": "192.0.2.1",
    "region": "us-east-1",
    "vendor": "aws"
  },
  "success": true
}
```

```
{
  "errors": [
    {
      "code": 1157,
      "message": "The vendor provided doesn't exist or the region provided does not exist for the specified cloud vendor"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
```

```
{
  "errors": [
    {
      "code": 1146,
      "message": "body origin_ip does not match URL"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
```

```
{
  "errors": [
    {
      "code": 1164,
      "message": "Maximum number of IP mappings configured for zone."
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
```

##### Returns Examples

200 example

4XX example

4XX example

4XX example

```
{
  "errors": [],
  "messages": [],
  "result": {
    "modified_on": "2026-03-01T12:00:00Z",
    "origin_ip": "192.0.2.1",
    "region": "us-east-1",
    "vendor": "aws"
  },
  "success": true
}
```

```
{
  "errors": [
    {
      "code": 1157,
      "message": "The vendor provided doesn't exist or the region provided does not exist for the specified cloud vendor"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
```

```
{
  "errors": [
    {
      "code": 1146,
      "message": "body origin_ip does not match URL"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
```

```
{
  "errors": [
    {
      "code": 1164,
      "message": "Maximum number of IP mappings configured for zone."
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
```