Skip to content
Start here

Zone Details

client.Zones.Get(ctx, query) (*Zone, error)
GET/zones/{zone_id}

Zone Details

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)
Trust and Safety WriteTrust and Safety ReadZero Trust: PII ReadZaraz EditZaraz ReadZaraz AdminAccess: Apps and Policies RevokeAccess: Apps and Policies WriteAccess: Apps and Policies ReadAccess: Apps and Policies RevokeAccess: Mutual TLS Certificates WriteAccess: Organizations, Identity Providers, and Groups WriteZone Settings WriteZone Settings ReadZone ReadDNS ReadWorkers Scripts WriteWorkers Scripts ReadZone WriteWorkers Routes WriteWorkers Routes ReadStream WriteStream ReadSSL and Certificates WriteSSL and Certificates ReadLogs WriteLogs ReadCache PurgePage Rules WritePage Rules ReadLoad Balancers WriteLoad Balancers ReadFirewall Services WriteFirewall Services ReadDNS WriteApps WriteAnalytics ReadAccess: Apps and Policies WriteAccess: Apps and Policies Read
ParametersExpand Collapse
query ZoneGetParams
ZoneID param.Field[string]

Identifier

maxLength32
ReturnsExpand Collapse
type Zone struct{…}
ID string

Identifier

maxLength32
Account ZoneAccount

The account the zone belongs to.

ID stringoptional

Identifier

maxLength32
Name stringoptional

The name of the account.

ActivatedOn Time

The last time proof of ownership was detected and the zone was made active.

formatdate-time
CreatedOn Time

When the zone was created.

formatdate-time
DevelopmentMode float64

The interval (in seconds) from when development mode expires (positive integer) or last expired (negative integer) for the domain. If development mode has never been enabled, this value is 0.

Meta ZoneMeta

Metadata about the zone.

CDNOnly booloptional

The zone is only configured for CDN.

CustomCertificateQuota int64optional

Number of Custom Certificates the zone can have.

DNSOnly booloptional

The zone is only configured for DNS.

FoundationDNS booloptional

The zone is setup with Foundation DNS.

PageRuleQuota int64optional

Number of Page Rules a zone can have.

PhishingDetected booloptional

The zone has been flagged for phishing.

Step int64optional
ModifiedOn Time

When the zone was last modified.

formatdate-time
Name string

The domain name. Per RFC 1035 the overall zone name can be up to 253 characters, with each segment ("label") not exceeding 63 characters.

maxLength253
NameServers []string

The name servers Cloudflare assigns to a zone.

OriginalDnshost string

DNS host at the time of switching to Cloudflare.

maxLength50
OriginalNameServers []string

Original name servers before moving to Cloudflare.

OriginalRegistrar string

Registrar for the domain at the time of switching to Cloudflare.

Owner ZoneOwner

The owner of the zone.

ID stringoptional

Identifier

maxLength32
Name stringoptional

Name of the owner.

Type stringoptional

The type of owner.

DeprecatedPlan ZonePlan
Please use the `/zones/{zone_id}/subscription` API to update a zone's plan. Changing this value will create/cancel associated subscriptions. To view available plans for this zone, see [Zone Plans](https://developers.cloudflare.com/api/resources/zones/subresources/plans/).

A Zones subscription information.

ID stringoptional

Identifier

maxLength32
CanSubscribe booloptional

States if the subscription can be activated.

Currency stringoptional

The denomination of the customer.

ExternallyManaged booloptional

If this Zone is managed by another company.

Frequency stringoptional

How often the customer is billed.

IsSubscribed booloptional

States if the subscription active.

LegacyDiscount booloptional

If the legacy discount applies to this Zone.

LegacyID stringoptional

The legacy name of the plan.

Name stringoptional

Name of the owner.

Price float64optional

How much the customer is paying.

CNAMESuffix stringoptional

Allows the customer to use a custom apex. Tenants Only Configuration.

Paused booloptional

Indicates whether the zone is only using Cloudflare DNS services. A true value means the zone will not receive security or performance benefits.

DeprecatedPermissions []stringoptional
This has been replaced by Account memberships.

Legacy permissions based on legacy user membership information.

Status ZoneStatusoptional

The zone status on Cloudflare.

One of the following:
const ZoneStatusInitializing ZoneStatus = "initializing"
const ZoneStatusPending ZoneStatus = "pending"
const ZoneStatusActive ZoneStatus = "active"
const ZoneStatusMoved ZoneStatus = "moved"
Tenant ZoneTenantoptional

The root organizational unit that this zone belongs to (such as a tenant or organization).

ID stringoptional

Identifier

maxLength32
Name stringoptional

The name of the Tenant account.

TenantUnit ZoneTenantUnitoptional

The immediate parent organizational unit that this zone belongs to (such as under a tenant or sub-organization).

ID stringoptional

Identifier

maxLength32
Type Typeoptional

A full zone implies that DNS is hosted with Cloudflare. A partial zone is typically a partner-hosted zone or a CNAME setup.

One of the following:
const TypeFull Type = "full"
const TypePartial Type = "partial"
const TypeSecondary Type = "secondary"
const TypeInternal Type = "internal"
VanityNameServers []stringoptional

An array of domains used for custom name servers. This is only available for Business and Enterprise plans.

VerificationKey stringoptional

Verification key for partial zone setup.

Zone Details

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  zone, err := client.Zones.Get(context.TODO(), zones.ZoneGetParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", zone.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": "023e105f4ecef8ad9ca31a8372d0c353",
    "account": {
      "id": "023e105f4ecef8ad9ca31a8372d0c353",
      "name": "Example Account Name"
    },
    "activated_on": "2014-01-02T00:01:00.12345Z",
    "created_on": "2014-01-01T05:20:00.12345Z",
    "development_mode": 7200,
    "meta": {
      "cdn_only": true,
      "custom_certificate_quota": 1,
      "dns_only": true,
      "foundation_dns": true,
      "page_rule_quota": 100,
      "phishing_detected": false,
      "step": 2
    },
    "modified_on": "2014-01-01T05:20:00.12345Z",
    "name": "example.com",
    "name_servers": [
      "bob.ns.cloudflare.com",
      "lola.ns.cloudflare.com"
    ],
    "original_dnshost": "NameCheap",
    "original_name_servers": [
      "ns1.originaldnshost.com",
      "ns2.originaldnshost.com"
    ],
    "original_registrar": "GoDaddy",
    "owner": {
      "id": "023e105f4ecef8ad9ca31a8372d0c353",
      "name": "Example Org",
      "type": "organization"
    },
    "plan": {
      "id": "023e105f4ecef8ad9ca31a8372d0c353",
      "can_subscribe": false,
      "currency": "USD",
      "externally_managed": false,
      "frequency": "monthly",
      "is_subscribed": false,
      "legacy_discount": false,
      "legacy_id": "free",
      "name": "Example Org",
      "price": 10.99
    },
    "cname_suffix": "cdn.cloudflare.com",
    "paused": true,
    "permissions": [
      "#worker:read"
    ],
    "status": "active",
    "tenant": {
      "id": "023e105f4ecef8ad9ca31a8372d0c353",
      "name": "Example Account Name"
    },
    "tenant_unit": {
      "id": "023e105f4ecef8ad9ca31a8372d0c353"
    },
    "type": "full",
    "vanity_name_servers": [
      "ns1.example.com",
      "ns2.example.com"
    ],
    "verification_key": "284344499-1084221259"
  }
}
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": "023e105f4ecef8ad9ca31a8372d0c353",
    "account": {
      "id": "023e105f4ecef8ad9ca31a8372d0c353",
      "name": "Example Account Name"
    },
    "activated_on": "2014-01-02T00:01:00.12345Z",
    "created_on": "2014-01-01T05:20:00.12345Z",
    "development_mode": 7200,
    "meta": {
      "cdn_only": true,
      "custom_certificate_quota": 1,
      "dns_only": true,
      "foundation_dns": true,
      "page_rule_quota": 100,
      "phishing_detected": false,
      "step": 2
    },
    "modified_on": "2014-01-01T05:20:00.12345Z",
    "name": "example.com",
    "name_servers": [
      "bob.ns.cloudflare.com",
      "lola.ns.cloudflare.com"
    ],
    "original_dnshost": "NameCheap",
    "original_name_servers": [
      "ns1.originaldnshost.com",
      "ns2.originaldnshost.com"
    ],
    "original_registrar": "GoDaddy",
    "owner": {
      "id": "023e105f4ecef8ad9ca31a8372d0c353",
      "name": "Example Org",
      "type": "organization"
    },
    "plan": {
      "id": "023e105f4ecef8ad9ca31a8372d0c353",
      "can_subscribe": false,
      "currency": "USD",
      "externally_managed": false,
      "frequency": "monthly",
      "is_subscribed": false,
      "legacy_discount": false,
      "legacy_id": "free",
      "name": "Example Org",
      "price": 10.99
    },
    "cname_suffix": "cdn.cloudflare.com",
    "paused": true,
    "permissions": [
      "#worker:read"
    ],
    "status": "active",
    "tenant": {
      "id": "023e105f4ecef8ad9ca31a8372d0c353",
      "name": "Example Account Name"
    },
    "tenant_unit": {
      "id": "023e105f4ecef8ad9ca31a8372d0c353"
    },
    "type": "full",
    "vanity_name_servers": [
      "ns1.example.com",
      "ns2.example.com"
    ],
    "verification_key": "284344499-1084221259"
  }
}