Skip to content
Start here

Get Zero Trust Gateway location details

client.ZeroTrust.Gateway.Locations.Get(ctx, locationID, query) (*Location, error)
GET/accounts/{account_id}/gateway/locations/{location_id}

Get a single Zero Trust Gateway location.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

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

Example:X-Auth-Email: user@example.com

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

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Cloudflare Zero Trust Secure DNS Locations WriteZero Trust ReadZero Trust Write
ParametersExpand Collapse
locationID string
query GatewayLocationGetParams
AccountID param.Field[string]
ReturnsExpand Collapse
type Location struct{…}
ID stringOptional
ClientDefault boolOptional

Indicate whether this location is the default location.

CreatedAt TimeOptional
formatdate-time
DNSDestinationIPsID stringOptional

Indicate the identifier of the pair of IPv4 addresses assigned to this location.

DNSDestinationIPV6BlockID stringOptional

Specify the UUID of the IPv6 block brought to the gateway so that this location’s IPv6 address is allocated from the Bring Your Own IPv6 (BYOIPv6) block rather than the standard Cloudflare IPv6 block.

DOHSubdomain stringOptional

Specify the DNS over HTTPS domain that receives DNS requests. Gateway automatically generates this value.

ECSSupport boolOptional

Indicate whether the location must resolve EDNS queries.

Endpoints EndpointOptional

Configure the destination endpoints for this location.

Enabled boolOptional

Indicate whether the DOH endpoint is enabled for this location.

Networks []IPNetworkOptional

Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location.

Network string

Specify the IP address or IP CIDR.

RequireToken boolOptional

Specify whether the DOH endpoint requires user identity authentication.

Enabled boolOptional

Indicate whether the DOT endpoint is enabled for this location.

Networks []IPNetworkOptional

Specify the list of allowed source IP network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location.

Network string

Specify the IP address or IP CIDR.

Enabled boolOptional

Indicate whether the IPv4 endpoint is enabled for this location.

Enabled boolOptional

Indicate whether the IPV6 endpoint is enabled for this location.

Networks []IPV6NetworkOptional

Specify the list of allowed source IPv6 network ranges for this endpoint. When the list is empty, the endpoint allows all source IPs. The list takes effect only if the endpoint is enabled for this location.

Network string

Specify the IPv6 address or IPv6 CIDR.

IP stringOptional

Defines the automatically generated IPv6 destination IP assigned to this location. Gateway counts all DNS requests sent to this IP as requests under this location.

IPV4Destination stringOptional

Show the primary destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only.

IPV4DestinationBackup stringOptional

Show the backup destination IPv4 address from the pair identified dns_destination_ips_id. This field read-only.

MaxTTL LocationMaxTTLOptional

Configure DNS response TTL behavior for this Gateway location. Gateway can rewrite DNS responses to cap returned record TTLs using the account setting or a location-specific value, or leave TTLs unchanged.

Mode LocationMaxTTLMode

Specify how this location handles DNS response TTLs by using the account setting, using a location-specific value, or leaving TTLs unchanged.

One of the following:
const LocationMaxTTLModeInherit LocationMaxTTLMode = "inherit"
const LocationMaxTTLModeOverride LocationMaxTTLMode = "override"
const LocationMaxTTLModeDisabled LocationMaxTTLMode = "disabled"
TTLSecs int64Optional

Set the location-specific DNS TTL cap, in seconds. Required when mode is override. Must be omitted when mode is inherit or disabled.

maximum36000
minimum60
Name stringOptional

Specify the location name.

Networks []LocationNetworkOptional

Specify the list of network ranges from which requests at this location originate. The list takes effect only if it is non-empty and the IPv4 endpoint is enabled for this location.

Network string

Specify the IPv4 address or IPv4 CIDR. Limit IPv4 CIDRs to a maximum of /24.

UpdatedAt TimeOptional
formatdate-time

Get Zero Trust Gateway location details

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/option"
  "github.com/stainless-sdks/cloudflare-go/zero_trust"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  location, err := client.ZeroTrust.Gateway.Locations.Get(
    context.TODO(),
    "ed35569b41ce4d1facfe683550f54086",
    zero_trust.GatewayLocationGetParams{
      AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", location.ID)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "ed35569b41ce4d1facfe683550f54086",
    "client_default": false,
    "created_at": "2014-01-01T05:20:00.12345Z",
    "dns_destination_ips_id": "0e4a32c6-6fb8-4858-9296-98f51631e8e6",
    "dns_destination_ipv6_block_id": "b08f7231-d458-495c-98ef-190604c9ee83",
    "doh_subdomain": "oli3n9zkz5",
    "ecs_support": false,
    "endpoints": {
      "doh": {
        "enabled": true,
        "networks": [
          {
            "network": "2001:85a3::/64"
          }
        ],
        "require_token": true
      },
      "dot": {
        "enabled": true,
        "networks": [
          {
            "network": "2001:85a3::/64"
          }
        ]
      },
      "ipv4": {
        "enabled": true
      },
      "ipv6": {
        "enabled": true,
        "networks": [
          {
            "network": "2001:85a3::/64"
          }
        ]
      }
    },
    "ip": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
    "ipv4_destination": "172.64.36.1",
    "ipv4_destination_backup": "172.64.36.2",
    "max_ttl": {
      "mode": "override",
      "ttl_secs": 3600
    },
    "name": "Austin Office Location",
    "networks": [
      {
        "network": "192.0.2.1/32"
      }
    ],
    "updated_at": "2014-01-01T05:20:00.12345Z"
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "ed35569b41ce4d1facfe683550f54086",
    "client_default": false,
    "created_at": "2014-01-01T05:20:00.12345Z",
    "dns_destination_ips_id": "0e4a32c6-6fb8-4858-9296-98f51631e8e6",
    "dns_destination_ipv6_block_id": "b08f7231-d458-495c-98ef-190604c9ee83",
    "doh_subdomain": "oli3n9zkz5",
    "ecs_support": false,
    "endpoints": {
      "doh": {
        "enabled": true,
        "networks": [
          {
            "network": "2001:85a3::/64"
          }
        ],
        "require_token": true
      },
      "dot": {
        "enabled": true,
        "networks": [
          {
            "network": "2001:85a3::/64"
          }
        ]
      },
      "ipv4": {
        "enabled": true
      },
      "ipv6": {
        "enabled": true,
        "networks": [
          {
            "network": "2001:85a3::/64"
          }
        ]
      }
    },
    "ip": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
    "ipv4_destination": "172.64.36.1",
    "ipv4_destination_backup": "172.64.36.2",
    "max_ttl": {
      "mode": "override",
      "ttl_secs": 3600
    },
    "name": "Austin Office Location",
    "networks": [
      {
        "network": "192.0.2.1/32"
      }
    ],
    "updated_at": "2014-01-01T05:20:00.12345Z"
  }
}