Skip to content
Start here

Retrieve discovered operations on a zone

api_gateway.discovery.operations.list(OperationListParams**kwargs) -> SyncV4PagePaginationArray[DiscoveryOperation]
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
ParametersExpand Collapse
zone_id: str

Identifier.

maxLength32
diff: Optional[bool]

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

direction: Optional[Literal["asc", "desc"]]

Direction to order results.

One of the following:
"asc"
"desc"
endpoint: Optional[str]

Filter results to only include endpoints containing this pattern.

host: Optional[SequenceNotStr[str]]

Filter results to only include the specified hosts.

method: Optional[SequenceNotStr[str]]

Filter results to only include the specified HTTP methods.

order: Optional[Literal["host", "method", "endpoint", 2 more]]

Field to order by

One of the following:
"host"
"method"
"endpoint"
"traffic_stats.requests"
"traffic_stats.last_updated"
origin: Optional[Literal["ML", "SessionIdentifier", "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[int]

Page number of paginated results.

minimum1
per_page: Optional[int]

Maximum number of results per page.

maximum50
minimum5
state: Optional[Literal["review", "saved", "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
class DiscoveryOperation:
id: str

UUID.

maxLength36
minLength36
endpoint: str

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: str

RFC3986-compliant host.

formathostname
maxLength255
last_updated: datetime
formatdate-time
method: Literal["GET", "POST", "HEAD", 6 more]

The HTTP method used to access the endpoint.

One of the following:
"GET"
"POST"
"HEAD"
"OPTIONS"
"PUT"
"DELETE"
"CONNECT"
"PATCH"
"TRACE"
origin: List[Literal["ML", "SessionIdentifier", "LabelDiscovery"]]

API discovery engine(s) that discovered this operation

One of the following:
"ML"
"SessionIdentifier"
"LabelDiscovery"
state: Literal["review", "saved", "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[Features]
traffic_stats: Optional[FeaturesTrafficStats]
last_updated: datetime
formatdate-time
period_seconds: int

The period in seconds these statistics were computed over

requests: float

The average number of requests seen during this period

formatfloat

Retrieve discovered operations on a zone

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.api_gateway.discovery.operations.list(
    zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
page = page.result[0]
print(page.id)
{
  "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
  }
}