Skip to content
Start here

Get tenant

client.Tenants.Get(ctx, tenantID) (*Tenant, error)
GET/tenants/{tenant_id}

Retrieves a Tenant by Tenant ID.

Security

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
ParametersExpand Collapse
tenantID string
ReturnsExpand Collapse
type Tenant struct{…}
Cdate Time
formatdate-time
Edate Time
formatdate-time
TenantContacts TenantTenantContacts
Email stringOptional
Website stringOptional
TenantLabels []string
TenantMetadata TenantTenantMetadata
DNS TenantTenantMetadataDNSOptional
NSPool TenantTenantMetadataDNSNSPool
Primary stringOptional
Secondary stringOptional
TenantName string
TenantNetwork unknown
TenantStatus string
TenantTag string
TenantType string
TenantUnits []TenantTenantUnit
UnitMemberships []unknown
UnitMetadata unknown
UnitName string
UnitStatus string
UnitTag string
CustomerID stringOptional

Get tenant

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
    option.WithAPIEmail("user@example.com"),
  )
  tenant, err := client.Tenants.Get(context.TODO(), "tenant_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", tenant.CustomerID)
}
{
  "errors": [],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "cdate": "2019-12-27T18:11:19.117Z",
    "edate": "2019-12-27T18:11:19.117Z",
    "tenant_contacts": {
      "email": "email",
      "website": "website"
    },
    "tenant_labels": [
      "string"
    ],
    "tenant_metadata": {
      "dns": {
        "ns_pool": {
          "primary": "primary",
          "secondary": "secondary"
        }
      }
    },
    "tenant_name": "tenant_name",
    "tenant_network": {},
    "tenant_status": "tenant_status",
    "tenant_tag": "tenant_tag",
    "tenant_type": "tenant_type",
    "tenant_units": [
      {
        "unit_memberships": [
          {}
        ],
        "unit_metadata": {},
        "unit_name": "unit_name",
        "unit_status": "unit_status",
        "unit_tag": "unit_tag"
      }
    ],
    "customer_id": "customer_id"
  },
  "success": true
}
Returns Examples
{
  "errors": [],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "cdate": "2019-12-27T18:11:19.117Z",
    "edate": "2019-12-27T18:11:19.117Z",
    "tenant_contacts": {
      "email": "email",
      "website": "website"
    },
    "tenant_labels": [
      "string"
    ],
    "tenant_metadata": {
      "dns": {
        "ns_pool": {
          "primary": "primary",
          "secondary": "secondary"
        }
      }
    },
    "tenant_name": "tenant_name",
    "tenant_network": {},
    "tenant_status": "tenant_status",
    "tenant_tag": "tenant_tag",
    "tenant_type": "tenant_type",
    "tenant_units": [
      {
        "unit_memberships": [
          {}
        ],
        "unit_metadata": {},
        "unit_name": "unit_name",
        "unit_status": "unit_status",
        "unit_tag": "unit_tag"
      }
    ],
    "customer_id": "customer_id"
  },
  "success": true
}