Skip to content
Start here

Get Zone Entitlements

zones.entitlements.list(EntitlementListParams**kwargs) -> SyncSinglePage[EntitlementListResponse]
GET/zones/{zone_id}/entitlements

Returns the list of entitlements (features and their allocations) for a given zone. Each entitlement describes a product feature the zone 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)
Zone Read
ParametersExpand Collapse
zone_id: str

Identifier tag.

maxLength32
minLength32
ReturnsExpand Collapse
class EntitlementListResponse: …

A single entitlement record for a zone or account.

id: str

Entitlement identifier — equal to the feature key.

allocation: Allocation

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: Literal["bool", "max_count", "enum_number", 2 more]

Allocation type discriminator.

One of the following:
"bool"
"max_count"
"enum_number"
"range"
"string"
value: AllocationValue

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:
bool
int
str
List[float]
class AllocationValueUnionMember4: …
max: int
min: int
created_date: str

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

deleted_date: str

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

edited_date: str

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

feature: Feature

Describes a product feature associated with an entitlement.

id: int

Numeric identifier of the feature.

formatint64
feature_set: str

The logical grouping (set) this feature belongs to.

key: str

Unique string key for the feature.

name: str

Human-readable name of the feature.

Get Zone Entitlements

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
page = client.zones.entitlements.list(
    zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
page = page.result[0]
print(page.id)
{
  "errors": [],
  "messages": [],
  "result": [
    {
      "allocation": {
        "type": "max_count",
        "value": 3
      },
      "created_date": "2021-09-17T20:33:36.000000",
      "deleted_date": "",
      "edited_date": "2021-09-17T20:34:01.000000",
      "feature": {
        "feature_set": "page_rules",
        "id": 1,
        "key": "page_rules",
        "name": "Page Rules"
      },
      "id": "page_rules"
    },
    {
      "allocation": {
        "type": "bool",
        "value": true
      },
      "created_date": "2021-09-17T20:39:02.000000",
      "deleted_date": "",
      "edited_date": "2021-09-17T20:39:11.000000",
      "feature": {
        "feature_set": "argo",
        "id": 38,
        "key": "argo.allow_tiered_caching",
        "name": "Argo Tiered Cache"
      },
      "id": "argo.allow_tiered_caching"
    },
    {
      "allocation": {
        "type": "enum_number",
        "value": [
          10,
          60,
          600,
          3600
        ]
      },
      "created_date": "2021-09-17T20:47:36.000000",
      "deleted_date": "",
      "edited_date": "2021-09-17T20:47:43.000000",
      "feature": {
        "feature_set": "rate_limiting",
        "id": 32,
        "key": "rate_limiting.sampling_period_secs",
        "name": "rate_limiting.sampling_period_secs"
      },
      "id": "rate_limiting.sampling_period_secs"
    }
  ],
  "success": true
}
{
  "errors": [
    {
      "code": 2005,
      "message": "failed to fetch entitlements: invalid object type"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 2004,
      "message": "failed to fetch entitlements: unknown route"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 2001,
      "message": "failed to fetch entitlements: method not allowed"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 2000,
      "message": "failed to fetch entitlements: internal server error"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 2003,
      "message": "failed to fetch entitlements: timeout occurred"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
Returns Examples
{
  "errors": [],
  "messages": [],
  "result": [
    {
      "allocation": {
        "type": "max_count",
        "value": 3
      },
      "created_date": "2021-09-17T20:33:36.000000",
      "deleted_date": "",
      "edited_date": "2021-09-17T20:34:01.000000",
      "feature": {
        "feature_set": "page_rules",
        "id": 1,
        "key": "page_rules",
        "name": "Page Rules"
      },
      "id": "page_rules"
    },
    {
      "allocation": {
        "type": "bool",
        "value": true
      },
      "created_date": "2021-09-17T20:39:02.000000",
      "deleted_date": "",
      "edited_date": "2021-09-17T20:39:11.000000",
      "feature": {
        "feature_set": "argo",
        "id": 38,
        "key": "argo.allow_tiered_caching",
        "name": "Argo Tiered Cache"
      },
      "id": "argo.allow_tiered_caching"
    },
    {
      "allocation": {
        "type": "enum_number",
        "value": [
          10,
          60,
          600,
          3600
        ]
      },
      "created_date": "2021-09-17T20:47:36.000000",
      "deleted_date": "",
      "edited_date": "2021-09-17T20:47:43.000000",
      "feature": {
        "feature_set": "rate_limiting",
        "id": 32,
        "key": "rate_limiting.sampling_period_secs",
        "name": "rate_limiting.sampling_period_secs"
      },
      "id": "rate_limiting.sampling_period_secs"
    }
  ],
  "success": true
}
{
  "errors": [
    {
      "code": 2005,
      "message": "failed to fetch entitlements: invalid object type"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 2004,
      "message": "failed to fetch entitlements: unknown route"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 2001,
      "message": "failed to fetch entitlements: method not allowed"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 2000,
      "message": "failed to fetch entitlements: internal server error"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 2003,
      "message": "failed to fetch entitlements: timeout occurred"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}