Skip to content
Start here

Retrieve all labels

GET/zones/{zone_id}/api_gateway/labels

Retrieve all labels

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 API GatewayAccount API Gateway ReadDomain API GatewayDomain API Gateway Read
Path ParametersExpand Collapse
zone_id: string

Identifier.

maxLength32
Query ParametersExpand Collapse
direction: optional "asc" or "desc"

Direction to order results.

One of the following:
"asc"
"desc"
filter: optional string

Filter for labels where the name or description matches using substring match

order: optional "name" or "description" or "created_at" or 2 more

Field to order by

One of the following:
"name"
"description"
"created_at"
"last_updated"
"mapped_resources.operations"
page: optional number

Page number of paginated results.

minimum1
per_page: optional number

Maximum number of results per page.

maximum50
minimum5
source: optional "user" or "managed"

Filter for labels with source

One of the following:
"user"
"managed"
with_mapped_resource_counts: optional boolean

Include mapped_resources for each label

ReturnsExpand Collapse
errors: Message { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
messages: Message { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
result: array of object { created_at, description, last_updated, 4 more }
created_at: string
formatdate-time
description: string

The description of the label

last_updated: string
formatdate-time
metadata: unknown

Metadata for the label

name: string

The name of the label

source: "user" or "managed"
  • user - label is owned by the user
  • managed - label is owned by cloudflare
One of the following:
"user"
"managed"
mapped_resources: optional unknown

Provides counts of what resources are linked to this label

success: true

Whether the API call was successful.

result_info: optional object { count, page, per_page, 2 more }
count: optional number

Total number of results for the requested service.

page: optional number

Current page within paginated list of results.

per_page: optional number

Number of results per page of results.

total_count: optional number

Total results available without any search parameters.

total_pages: optional number

The number of total pages in the entire result set.

Retrieve all labels

curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/api_gateway/labels \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "created_at": "2014-01-01T05:20:00.12345Z",
      "description": "All endpoints that deal with logins",
      "last_updated": "2014-01-01T05:20:00.12345Z",
      "metadata": {
        "foo": "bar"
      },
      "name": "login",
      "source": "user",
      "mapped_resources": {
        "operations": 29
      }
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}
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"
      }
    }
  ],
  "result": [
    {
      "created_at": "2014-01-01T05:20:00.12345Z",
      "description": "All endpoints that deal with logins",
      "last_updated": "2014-01-01T05:20:00.12345Z",
      "metadata": {
        "foo": "bar"
      },
      "name": "login",
      "source": "user",
      "mapped_resources": {
        "operations": 29
      }
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}