Skip to content
Start here

Get Account Entitlements

client.Accounts.Entitlements.List(ctx, query) (*SinglePage[EntitlementListResponse], error)
GET/accounts/{account_id}/entitlements

Returns the list of entitlements (features and their allocations) for a given account. Each entitlement describes a product feature the account is permitted to use and the allocation value (boolean, count, range, enum, or string) that governs its behaviour.

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)
Account Read
ParametersExpand Collapse
query EntitlementListParams
AccountID param.Field[string]

Identifier tag.

maxLength32
minLength32
ReturnsExpand Collapse
type EntitlementListResponse struct{…}

A single entitlement record for a zone or account.

ID string

Entitlement identifier — equal to the feature key.

Allocation EntitlementListResponseAllocation

Represents the allocation value for an entitlement. The shape of value depends on type: bool uses a boolean, max_count uses an integer, enum_number uses an array of numbers, range uses an object with min and max integer fields, and string uses a string.

Type EntitlementListResponseAllocationType

Allocation type discriminator.

One of the following:
const EntitlementListResponseAllocationTypeBool EntitlementListResponseAllocationType = "bool"
const EntitlementListResponseAllocationTypeMaxCount EntitlementListResponseAllocationType = "max_count"
const EntitlementListResponseAllocationTypeEnumNumber EntitlementListResponseAllocationType = "enum_number"
const EntitlementListResponseAllocationTypeRange EntitlementListResponseAllocationType = "range"
const EntitlementListResponseAllocationTypeString EntitlementListResponseAllocationType = "string"
Value EntitlementListResponseAllocationValueUnion

Contains the allocation value whose concrete type the type field determines: bool yields a boolean, max_count yields an integer, enum_number yields an array of numbers, range yields an object with min and max, and string yields a string.

One of the following:
UnionBool
UnionInt
UnionString
type EntitlementListResponseAllocationValueArray []float64
type EntitlementListResponseAllocationValueObject struct{…}
Max int64
Min int64
CreatedDate string

ISO 8601 timestamp (microsecond precision, no timezone offset) when the entitlement was created. Format: YYYY-MM-DDTHH:MM:SS.ffffff.

DeletedDate string

ISO 8601 timestamp when the entitlement was deleted, or empty string if not deleted.

EditedDate string

ISO 8601 timestamp (microsecond precision, no timezone offset) when the entitlement was last edited.

Feature EntitlementListResponseFeature

Describes a product feature associated with an entitlement.

ID int64

Numeric identifier of the feature.

formatint64
FeatureSet string

The logical grouping (set) this feature belongs to.

Key string

Unique string key for the feature.

Name string

Human-readable name of the feature.

Get Account Entitlements

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.Accounts.Entitlements.List(context.TODO(), accounts.EntitlementListParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "errors": [],
  "messages": [],
  "result": [
    {
      "allocation": {
        "type": "string",
        "value": "default"
      },
      "created_date": "2024-01-01T00:00:00.000000",
      "deleted_date": "",
      "edited_date": "2024-01-01T00:00:01.000000",
      "feature": {
        "feature_set": "deployment",
        "id": 99,
        "key": "deployment.cohort",
        "name": "Deployment Cohort"
      },
      "id": "deployment.cohort"
    },
    {
      "allocation": {
        "type": "range",
        "value": {
          "max": 86400,
          "min": 10
        }
      },
      "created_date": "2021-09-17T21:02:02.000000",
      "deleted_date": "",
      "edited_date": "2021-09-17T21:02:10.000000",
      "feature": {
        "feature_set": "rate_limiting",
        "id": 33,
        "key": "rate_limiting.timeout_bounds",
        "name": "rate_limiting.timeout_bounds"
      },
      "id": "rate_limiting.timeout_bounds"
    }
  ],
  "success": true
}
Returns Examples
{
  "errors": [],
  "messages": [],
  "result": [
    {
      "allocation": {
        "type": "string",
        "value": "default"
      },
      "created_date": "2024-01-01T00:00:00.000000",
      "deleted_date": "",
      "edited_date": "2024-01-01T00:00:01.000000",
      "feature": {
        "feature_set": "deployment",
        "id": 99,
        "key": "deployment.cohort",
        "name": "Deployment Cohort"
      },
      "id": "deployment.cohort"
    },
    {
      "allocation": {
        "type": "range",
        "value": {
          "max": 86400,
          "min": 10
        }
      },
      "created_date": "2021-09-17T21:02:02.000000",
      "deleted_date": "",
      "edited_date": "2021-09-17T21:02:10.000000",
      "feature": {
        "feature_set": "rate_limiting",
        "id": 33,
        "key": "rate_limiting.timeout_bounds",
        "name": "rate_limiting.timeout_bounds"
      },
      "id": "rate_limiting.timeout_bounds"
    }
  ],
  "success": true
}