Skip to content
Start here

Retrieve discovered operations on a zone

client.apiGateway.discovery.operations.list(OperationListParams { zone_id, diff, direction, 8 more } params, RequestOptionsoptions?): V4PagePaginationArray<DiscoveryOperation { id, endpoint, host, 5 more } >
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
params: OperationListParams { zone_id, diff, direction, 8 more }
zone_id: string

Path param: Identifier.

maxLength32
diff?: boolean

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

direction?: "asc" | "desc"

Query param: Direction to order results.

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

Query param: Filter results to only include endpoints containing this pattern.

host?: Array<string>

Query param: Filter results to only include the specified hosts.

method?: Array<string>

Query param: Filter results to only include the specified HTTP methods.

order?: "host" | "method" | "endpoint" | 2 more

Query param: Field to order by

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

Query param: 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?: number

Query param: Page number of paginated results.

minimum1
per_page?: number

Query param: Maximum number of results per page.

maximum50
minimum5
state?: "review" | "saved" | "ignored"

Query param: 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
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" | "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: Array<"ML" | "SessionIdentifier" | "LabelDiscovery">

API discovery engine(s) that discovered this operation

One of the following:
"ML"
"SessionIdentifier"
"LabelDiscovery"
state: "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?: Features { traffic_stats }
traffic_stats?: TrafficStats { 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

Retrieve discovered operations on a zone

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const discoveryOperation of client.apiGateway.discovery.operations.list({
  zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
})) {
  console.log(discoveryOperation.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
  }
}