Skip to content
Start here

Retrieve discovered operations on a zone

GET/zones/{zone_id}/api_gateway/discovery/operations

Retrieve the most up to date view of discovered operations

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
diff: optional boolean

When true, only return API Discovery results that are not saved into API Shield Endpoint Management

direction: optional "asc" or "desc"

Direction to order results.

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

Filter results to only include endpoints containing this pattern.

host: optional array of string

Filter results to only include the specified hosts.

method: optional array of string

Filter results to only include the specified HTTP methods.

order: optional "host" or "method" or "endpoint" or 2 more

Field to order by

One of the following:
"host"
"method"
"endpoint"
"traffic_stats.requests"
"traffic_stats.last_updated"
origin: optional "ML" or "SessionIdentifier" or "LabelDiscovery"

Filter results to only include discovery results sourced from a particular discovery engine

  • ML - Discovered operations that were sourced using ML API Discovery
  • SessionIdentifier - Discovered operations that were sourced using Session Identifier API Discovery
One of the following:
"ML"
"SessionIdentifier"
"LabelDiscovery"
page: optional number

Page number of paginated results.

minimum1
per_page: optional number

Maximum number of results per page.

maximum50
minimum5
state: optional "review" or "saved" or "ignored"

Filter results to only include discovery results in a particular state. States are as follows

  • review - Discovered operations that are not saved into API Shield Endpoint Management
  • saved - Discovered operations that are already saved into API Shield Endpoint Management
  • ignored - Discovered operations that have been marked as ignored
One of the following:
"review"
"saved"
"ignored"
ReturnsExpand Collapse
errors: Message { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional { pointer }
pointer: optional string
messages: Message { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional { pointer }
pointer: optional string
result: array of DiscoveryOperation { id, endpoint, host, 5 more }
id: string

UUID.

maxLength36
minLength36
endpoint: string

The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/.

formaturi-template
maxLength4096
host: string

RFC3986-compliant host.

formathostname
maxLength255
last_updated: string
formatdate-time
method: "GET" or "POST" or "HEAD" or 6 more

The HTTP method used to access the endpoint.

One of the following:
"GET"
"POST"
"HEAD"
"OPTIONS"
"PUT"
"DELETE"
"CONNECT"
"PATCH"
"TRACE"
origin: array of "ML" or "SessionIdentifier" or "LabelDiscovery"

API discovery engine(s) that discovered this operation

One of the following:
"ML"
"SessionIdentifier"
"LabelDiscovery"
state: "review" or "saved" or "ignored"

State of operation in API Discovery

  • review - Operation is not saved into API Shield Endpoint Management
  • saved - Operation is saved into API Shield Endpoint Management
  • ignored - Operation is marked as ignored
One of the following:
"review"
"saved"
"ignored"
features: optional { traffic_stats }
traffic_stats: optional { last_updated, period_seconds, requests }
last_updated: string
formatdate-time
period_seconds: number

The period in seconds these statistics were computed over

requests: number

The average number of requests seen during this period

formatfloat
success: true

Whether the API call was successful.

result_info: optional { 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 discovered operations on a zone

curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/api_gateway/discovery/operations \
    -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": [
    {
      "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
      "endpoint": "/api/v1/users/{var1}",
      "host": "www.example.com",
      "last_updated": "2014-01-01T05:20:00.12345Z",
      "method": "GET",
      "origin": [
        "ML"
      ],
      "state": "review",
      "features": {
        "traffic_stats": {
          "last_updated": "2014-01-01T05:20:00.12345Z",
          "period_seconds": 3600,
          "requests": 1987.06
        }
      }
    }
  ],
  "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": [
    {
      "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
      "endpoint": "/api/v1/users/{var1}",
      "host": "www.example.com",
      "last_updated": "2014-01-01T05:20:00.12345Z",
      "method": "GET",
      "origin": [
        "ML"
      ],
      "state": "review",
      "features": {
        "traffic_stats": {
          "last_updated": "2014-01-01T05:20:00.12345Z",
          "period_seconds": 3600,
          "requests": 1987.06
        }
      }
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}