# API Gateway # Configurations ## Retrieve information about specific configuration properties `client.apiGateway.configurations.get(ConfigurationGetParamsparams, RequestOptionsoptions?): Configuration` **get** `/zones/{zone_id}/api_gateway/configuration` Gets the current API Shield configuration settings for a zone, including validation behavior and enforcement mode. ### Parameters - `params: ConfigurationGetParams` - `zone_id: string` Path param: Identifier. - `normalize?: boolean` Query param: Ensures that the configuration is written or retrieved in normalized fashion ### Returns - `Configuration` - `auth_id_characteristics: Array` - `APIShieldAuthIDCharacteristic` Auth ID Characteristic - `name: string` The name of the characteristic field, i.e., the header or cookie name. - `type: "header" | "cookie"` The type of characteristic. - `"header"` - `"cookie"` - `APIShieldAuthIDCharacteristicJWTClaim` Auth ID Characteristic extracted from JWT Token Claims - `name: string` Claim location expressed as `$(token_config_id):$(json_path)`, where `token_config_id` is the ID of the token configuration used in validating the JWT, and `json_path` is a RFC 9535 JSONPath (https://goessner.net/articles/JsonPath/, https://www.rfc-editor.org/rfc/rfc9535.html). The JSONPath expression may be in dot or bracket notation, may only specify literal keys or array indexes, and must return a singleton value, which will be interpreted as a string. - `type: "jwt"` The type of characteristic. - `"jwt"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const configuration = await client.apiGateway.configurations.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(configuration.auth_id_characteristics); ``` #### Response ```json { "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": { "auth_id_characteristics": [ { "name": "authorization", "type": "header" } ] }, "success": true } ``` ## Update configuration properties `client.apiGateway.configurations.update(ConfigurationUpdateParamsparams, RequestOptionsoptions?): Configuration` **put** `/zones/{zone_id}/api_gateway/configuration` Updates API Shield configuration settings for a zone. Can modify validation strictness, enforcement mode, and other global settings. ### Parameters - `params: ConfigurationUpdateParams` - `zone_id: string` Path param: Identifier. - `auth_id_characteristics: Array` Body param - `APIShieldAuthIDCharacteristic` Auth ID Characteristic - `name: string` The name of the characteristic field, i.e., the header or cookie name. - `type: "header" | "cookie"` The type of characteristic. - `"header"` - `"cookie"` - `APIShieldAuthIDCharacteristicJWTClaim` Auth ID Characteristic extracted from JWT Token Claims - `name: string` Claim location expressed as `$(token_config_id):$(json_path)`, where `token_config_id` is the ID of the token configuration used in validating the JWT, and `json_path` is a RFC 9535 JSONPath (https://goessner.net/articles/JsonPath/, https://www.rfc-editor.org/rfc/rfc9535.html). The JSONPath expression may be in dot or bracket notation, may only specify literal keys or array indexes, and must return a singleton value, which will be interpreted as a string. - `type: "jwt"` The type of characteristic. - `"jwt"` - `normalize?: boolean` Query param: Ensures that the configuration is written or retrieved in normalized fashion ### Returns - `Configuration` - `auth_id_characteristics: Array` - `APIShieldAuthIDCharacteristic` Auth ID Characteristic - `name: string` The name of the characteristic field, i.e., the header or cookie name. - `type: "header" | "cookie"` The type of characteristic. - `"header"` - `"cookie"` - `APIShieldAuthIDCharacteristicJWTClaim` Auth ID Characteristic extracted from JWT Token Claims - `name: string` Claim location expressed as `$(token_config_id):$(json_path)`, where `token_config_id` is the ID of the token configuration used in validating the JWT, and `json_path` is a RFC 9535 JSONPath (https://goessner.net/articles/JsonPath/, https://www.rfc-editor.org/rfc/rfc9535.html). The JSONPath expression may be in dot or bracket notation, may only specify literal keys or array indexes, and must return a singleton value, which will be interpreted as a string. - `type: "jwt"` The type of characteristic. - `"jwt"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const configuration = await client.apiGateway.configurations.update({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', auth_id_characteristics: [{ name: 'authorization', type: 'header' }], }); console.log(configuration.auth_id_characteristics); ``` #### Response ```json { "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": { "auth_id_characteristics": [ { "name": "authorization", "type": "header" } ] }, "success": true } ``` ## Domain Types ### Configuration - `Configuration` - `auth_id_characteristics: Array` - `APIShieldAuthIDCharacteristic` Auth ID Characteristic - `name: string` The name of the characteristic field, i.e., the header or cookie name. - `type: "header" | "cookie"` The type of characteristic. - `"header"` - `"cookie"` - `APIShieldAuthIDCharacteristicJWTClaim` Auth ID Characteristic extracted from JWT Token Claims - `name: string` Claim location expressed as `$(token_config_id):$(json_path)`, where `token_config_id` is the ID of the token configuration used in validating the JWT, and `json_path` is a RFC 9535 JSONPath (https://goessner.net/articles/JsonPath/, https://www.rfc-editor.org/rfc/rfc9535.html). The JSONPath expression may be in dot or bracket notation, may only specify literal keys or array indexes, and must return a singleton value, which will be interpreted as a string. - `type: "jwt"` The type of characteristic. - `"jwt"` # Discovery ## Retrieve discovered operations on a zone rendered as OpenAPI schemas `client.apiGateway.discovery.get(DiscoveryGetParamsparams, RequestOptionsoptions?): DiscoveryGetResponse` **get** `/zones/{zone_id}/api_gateway/discovery` Retrieve the most up to date view of discovered operations, rendered as OpenAPI schemas ### Parameters - `params: DiscoveryGetParams` - `zone_id: string` Identifier. ### Returns - `DiscoveryGetResponse` - `schemas: Array` - `timestamp: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const discovery = await client.apiGateway.discovery.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(discovery.schemas); ``` #### Response ```json { "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": { "schemas": [ { "info": { "title": "OpenAPI JSON schema for www.example.com", "version": "1.0" }, "openapi": "3.0.0", "paths": { "... Further paths ...": {}, "/api/v1/users/{var1}": { "get": { "parameters": [ { "in": "path", "name": "var1", "required": true, "schema": { "type": "string" } } ] } } }, "servers": [ { "url": "www.example.com" } ] } ], "timestamp": "2014-01-01T05:20:00.12345Z" }, "success": true } ``` ## Domain Types ### Discovery Operation - `DiscoveryOperation` - `id: string` UUID. - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `origin: Array<"ML" | "SessionIdentifier" | "LabelDiscovery">` API discovery engine(s) that discovered this operation - `"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 - `"review"` - `"saved"` - `"ignored"` - `features?: Features` - `traffic_stats?: TrafficStats` - `last_updated: string` - `period_seconds: number` The period in seconds these statistics were computed over - `requests: number` The average number of requests seen during this period ### Discovery Get Response - `DiscoveryGetResponse` - `schemas: Array` - `timestamp: string` # Operations ## Retrieve discovered operations on a zone `client.apiGateway.discovery.operations.list(OperationListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/zones/{zone_id}/api_gateway/discovery/operations` Retrieve the most up to date view of discovered operations ### Parameters - `params: OperationListParams` - `zone_id: string` Path param: Identifier. - `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. - `"asc"` - `"desc"` - `endpoint?: string` Query param: Filter results to only include endpoints containing this pattern. - `host?: Array` Query param: Filter results to only include the specified hosts. - `method?: Array` Query param: Filter results to only include the specified HTTP methods. - `order?: "host" | "method" | "endpoint" | 2 more` Query param: Field to order by - `"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 - `"ML"` - `"SessionIdentifier"` - `"LabelDiscovery"` - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Maximum number of results per page. - `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 - `"review"` - `"saved"` - `"ignored"` ### Returns - `DiscoveryOperation` - `id: string` UUID. - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `origin: Array<"ML" | "SessionIdentifier" | "LabelDiscovery">` API discovery engine(s) that discovered this operation - `"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 - `"review"` - `"saved"` - `"ignored"` - `features?: Features` - `traffic_stats?: TrafficStats` - `last_updated: string` - `period_seconds: number` The period in seconds these statistics were computed over - `requests: number` The average number of requests seen during this period ### Example ```node 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); } ``` #### Response ```json { "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 } } ``` ## Patch discovered operation `client.apiGateway.discovery.operations.edit(stringoperationId, OperationEditParamsparams, RequestOptionsoptions?): OperationEditResponse` **patch** `/zones/{zone_id}/api_gateway/discovery/operations/{operation_id}` Update the `state` on a discovered operation ### Parameters - `operationId: string` UUID. - `params: OperationEditParams` - `zone_id: string` Path param: Identifier. - `state?: "review" | "ignored"` Body param: Mark state of operation in API Discovery * `review` - Mark operation as for review * `ignored` - Mark operation as ignored - `"review"` - `"ignored"` ### Returns - `OperationEditResponse` - `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 - `"review"` - `"saved"` - `"ignored"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.apiGateway.discovery.operations.edit( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(response.state); ``` #### Response ```json { "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": { "state": "review" }, "success": true } ``` ## Patch discovered operations `client.apiGateway.discovery.operations.bulkEdit(OperationBulkEditParamsparams, RequestOptionsoptions?): OperationBulkEditResponse` **patch** `/zones/{zone_id}/api_gateway/discovery/operations` Update the `state` on one or more discovered operations ### Parameters - `params: OperationBulkEditParams` - `zone_id: string` Path param: Identifier. - `body: Record` Body param - `state?: "review" | "ignored"` Mark state of operation in API Discovery * `review` - Mark operation as for review * `ignored` - Mark operation as ignored - `"review"` - `"ignored"` ### Returns - `OperationBulkEditResponse = Record` - `state?: "review" | "ignored"` Mark state of operation in API Discovery * `review` - Mark operation as for review * `ignored` - Mark operation as ignored - `"review"` - `"ignored"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.apiGateway.discovery.operations.bulkEdit({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', body: { '3818d821-5901-4147-a474-f5f5aec1d54e': {}, 'b17c8043-99a0-4202-b7d9-8f7cdbee02cd': {}, }, }); console.log(response); ``` #### Response ```json { "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": { "3818d821-5901-4147-a474-f5f5aec1d54e": { "state": "ignored" }, "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": { "state": "review" } }, "success": true } ``` ## Domain Types ### Operation Edit Response - `OperationEditResponse` - `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 - `"review"` - `"saved"` - `"ignored"` ### Operation Bulk Edit Response - `OperationBulkEditResponse = Record` - `state?: "review" | "ignored"` Mark state of operation in API Discovery * `review` - Mark operation as for review * `ignored` - Mark operation as ignored - `"review"` - `"ignored"` # Labels ## Retrieve all labels `client.apiGateway.labels.list(LabelListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/zones/{zone_id}/api_gateway/labels` Retrieve all labels ### Parameters - `params: LabelListParams` - `zone_id: string` Path param: Identifier. - `direction?: "asc" | "desc"` Query param: Direction to order results. - `"asc"` - `"desc"` - `filter?: string` Query param: Filter for labels where the name or description matches using substring match - `order?: "name" | "description" | "created_at" | 2 more` Query param: Field to order by - `"name"` - `"description"` - `"created_at"` - `"last_updated"` - `"mapped_resources.operations"` - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Maximum number of results per page. - `source?: "user" | "managed"` Query param: Filter for labels with source - `"user"` - `"managed"` - `with_mapped_resource_counts?: boolean` Query param: Include `mapped_resources` for each label ### Returns - `LabelListResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### Example ```node 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 labelListResponse of client.apiGateway.labels.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(labelListResponse.created_at); } ``` #### Response ```json { "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 } } ``` ## Domain Types ### Label List Response - `LabelListResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label # User ## Create user labels `client.apiGateway.labels.user.bulkCreate(UserBulkCreateParamsparams, RequestOptionsoptions?): SinglePage` **post** `/zones/{zone_id}/api_gateway/labels/user` Create user labels ### Parameters - `params: UserBulkCreateParams` - `zone_id: string` Path param: Identifier. - `body: Array` Body param - `name: string` The name of the label - `description?: string` The description of the label - `metadata?: unknown` Metadata for the label ### Returns - `UserBulkCreateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### Example ```node 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 userBulkCreateResponse of client.apiGateway.labels.user.bulkCreate({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', body: [{ name: 'login' }], })) { console.log(userBulkCreateResponse.created_at); } ``` #### Response ```json { "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" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Delete user labels `client.apiGateway.labels.user.bulkDelete(UserBulkDeleteParamsparams, RequestOptionsoptions?): SinglePage` **delete** `/zones/{zone_id}/api_gateway/labels/user` Delete user labels ### Parameters - `params: UserBulkDeleteParams` - `zone_id: string` Identifier. ### Returns - `UserBulkDeleteResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### Example ```node 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 userBulkDeleteResponse of client.apiGateway.labels.user.bulkDelete({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(userBulkDeleteResponse.created_at); } ``` #### Response ```json { "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" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Retrieve user label `client.apiGateway.labels.user.get(stringname, UserGetParamsparams, RequestOptionsoptions?): UserGetResponse` **get** `/zones/{zone_id}/api_gateway/labels/user/{name}` Retrieve user label ### Parameters - `name: string` The name of the label - `params: UserGetParams` - `zone_id: string` Path param: Identifier. - `with_mapped_resource_counts?: boolean` Query param: Include `mapped_resources` for each label ### Returns - `UserGetResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const user = await client.apiGateway.labels.user.get('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(user.created_at); ``` #### Response ```json { "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 } ``` ## Update user label `client.apiGateway.labels.user.update(stringname, UserUpdateParamsparams, RequestOptionsoptions?): UserUpdateResponse` **put** `/zones/{zone_id}/api_gateway/labels/user/{name}` Update all fields on a label ### Parameters - `name: string` The name of the label - `params: UserUpdateParams` - `zone_id: string` Path param: Identifier. - `description?: string` Body param: The description of the label - `metadata?: unknown` Body param: Metadata for the label ### Returns - `UserUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const user = await client.apiGateway.labels.user.update('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(user.created_at); ``` #### Response ```json { "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" }, "success": true } ``` ## Patch user label `client.apiGateway.labels.user.edit(stringname, UserEditParamsparams, RequestOptionsoptions?): UserEditResponse` **patch** `/zones/{zone_id}/api_gateway/labels/user/{name}` Update certain fields on a label ### Parameters - `name: string` The name of the label - `params: UserEditParams` - `zone_id: string` Path param: Identifier. - `description?: string` Body param: The description of the label - `metadata?: unknown` Body param: Metadata for the label ### Returns - `UserEditResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.apiGateway.labels.user.edit('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.created_at); ``` #### Response ```json { "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" }, "success": true } ``` ## Delete user label `client.apiGateway.labels.user.delete(stringname, UserDeleteParamsparams, RequestOptionsoptions?): UserDeleteResponse` **delete** `/zones/{zone_id}/api_gateway/labels/user/{name}` Delete user label ### Parameters - `name: string` The name of the label - `params: UserDeleteParams` - `zone_id: string` Identifier. ### Returns - `UserDeleteResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const user = await client.apiGateway.labels.user.delete('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(user.created_at); ``` #### Response ```json { "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" }, "success": true } ``` ## Domain Types ### User Bulk Create Response - `UserBulkCreateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### User Bulk Delete Response - `UserBulkDeleteResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### User Get Response - `UserGetResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### User Update Response - `UserUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### User Edit Response - `UserEditResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### User Delete Response - `UserDeleteResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` # Resources # Operation ## Replace operation(s) attached to a user label `client.apiGateway.labels.user.resources.operation.update(stringname, OperationUpdateParamsparams, RequestOptionsoptions?): OperationUpdateResponse` **put** `/zones/{zone_id}/api_gateway/labels/user/{name}/resources/operation` Replace all operations(s) attached to a user label ### Parameters - `name: string` The name of the label - `params: OperationUpdateParams` - `zone_id: string` Path param: Identifier. - `selector: Selector` Body param: Operation IDs selector - `include: Include` - `operation_ids: Array` ### Returns - `OperationUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const operation = await client.apiGateway.labels.user.resources.operation.update('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', selector: { include: { operation_ids: ['f174e90a-fafe-4643-bbbc-4a0ed4fc8415'] } }, }); console.log(operation.created_at); ``` #### Response ```json { "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 } ``` ## Domain Types ### Operation Update Response - `OperationUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label # Managed ## Retrieve managed label `client.apiGateway.labels.managed.get(stringname, ManagedGetParamsparams, RequestOptionsoptions?): ManagedGetResponse` **get** `/zones/{zone_id}/api_gateway/labels/managed/{name}` Retrieve managed label ### Parameters - `name: string` The name of the label - `params: ManagedGetParams` - `zone_id: string` Path param: Identifier. - `with_mapped_resource_counts?: boolean` Query param: Include `mapped_resources` for each label ### Returns - `ManagedGetResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const managed = await client.apiGateway.labels.managed.get('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(managed.created_at); ``` #### Response ```json { "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": "managed", "mapped_resources": { "operations": 29 } }, "success": true } ``` ## Domain Types ### Managed Get Response - `ManagedGetResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label # Resources # Operation ## Replace operation(s) attached to a managed label `client.apiGateway.labels.managed.resources.operation.update(stringname, OperationUpdateParamsparams, RequestOptionsoptions?): OperationUpdateResponse` **put** `/zones/{zone_id}/api_gateway/labels/managed/{name}/resources/operation` Replace all operations(s) attached to a managed label ### Parameters - `name: string` The name of the label - `params: OperationUpdateParams` - `zone_id: string` Path param: Identifier. - `selector: Selector` Body param: Operation IDs selector - `include: Include` - `operation_ids: Array` ### Returns - `OperationUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const operation = await client.apiGateway.labels.managed.resources.operation.update('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', selector: { include: { operation_ids: ['f174e90a-fafe-4643-bbbc-4a0ed4fc8415'] } }, }); console.log(operation.created_at); ``` #### Response ```json { "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": "managed", "mapped_resources": { "operations": 29 } }, "success": true } ``` ## Domain Types ### Operation Update Response - `OperationUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label # Operations ## Retrieve information about all operations on a zone `client.apiGateway.operations.list(OperationListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/zones/{zone_id}/api_gateway/operations` Lists all API operations tracked by API Shield for a zone with pagination. Returns operation details including method, path, and feature configurations. ### Parameters - `params: OperationListParams` - `zone_id: string` Path param: Identifier. - `direction?: "asc" | "desc"` Query param: Direction to order results. - `"asc"` - `"desc"` - `endpoint?: string` Query param: Filter results to only include endpoints containing this pattern. - `feature?: Array<"thresholds" | "parameter_schemas" | "schema_info">` Query param: Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning. - `"thresholds"` - `"parameter_schemas"` - `"schema_info"` - `host?: Array` Query param: Filter results to only include the specified hosts. - `method?: Array` Query param: Filter results to only include the specified HTTP methods. - `order?: "method" | "host" | "endpoint" | "thresholds.$key"` Query param: Field to order by. When requesting a feature, the feature keys are available for ordering as well, e.g., `thresholds.suggested_threshold`. - `"method"` - `"host"` - `"endpoint"` - `"thresholds.$key"` - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Maximum number of results per page. ### Returns - `OperationListResponse` - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: string` UUID. - `features?: APIShieldOperationFeatureThresholds | APIShieldOperationFeatureParameterSchemas | APIShieldOperationFeatureAPIRouting | 2 more` - `APIShieldOperationFeatureThresholds` - `thresholds?: Thresholds` - `auth_id_tokens?: number` The total number of auth-ids seen across this calculation. - `data_points?: number` The number of data points used for the threshold suggestion calculation. - `last_updated?: string` - `p50?: number` The p50 quantile of requests (in period_seconds). - `p90?: number` The p90 quantile of requests (in period_seconds). - `p99?: number` The p99 quantile of requests (in period_seconds). - `period_seconds?: number` The period over which this threshold is suggested. - `requests?: number` The estimated number of requests covered by these calculations. - `suggested_threshold?: number` The suggested threshold in requests done by the same auth_id or period_seconds. - `APIShieldOperationFeatureParameterSchemas` - `parameter_schemas: ParameterSchemas` - `last_updated?: string` - `parameter_schemas?: ParameterSchemas` An operation schema object containing a response. - `parameters?: Array` An array containing the learned parameter schemas. - `responses?: unknown` An empty response object. This field is required to yield a valid operation schema. - `APIShieldOperationFeatureAPIRouting` - `api_routing?: APIRouting` API Routing settings on endpoint. - `last_updated?: string` - `route?: string` Target route. - `APIShieldOperationFeatureConfidenceIntervals` - `confidence_intervals?: ConfidenceIntervals` - `last_updated?: string` - `suggested_threshold?: SuggestedThreshold` - `confidence_intervals?: ConfidenceIntervals` - `p90?: P90` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p95?: P95` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p99?: P99` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `mean?: number` Suggested threshold. - `APIShieldOperationFeatureSchemaInfo` - `schema_info?: SchemaInfo` - `active_schema?: ActiveSchema` Schema active on endpoint. - `id?: string` UUID. - `created_at?: string` - `is_learned?: boolean` True if schema is Cloudflare-provided. - `name?: string` Schema file name. - `learned_available?: boolean` True if a Cloudflare-provided learned schema is available for this endpoint. - `mitigation_action?: "none" | "log" | "block" | null` Action taken on requests failing validation. - `"none"` - `"log"` - `"block"` ### Example ```node 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 operationListResponse of client.apiGateway.operations.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(operationListResponse.operation_id); } ``` #### Response ```json { "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": [ { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "features": { "thresholds": { "auth_id_tokens": 0, "data_points": 0, "last_updated": "2014-01-01T05:20:00.12345Z", "p50": 0, "p90": 0, "p99": 0, "period_seconds": 0, "requests": 0, "suggested_threshold": 0 } } } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Retrieve information about an operation `client.apiGateway.operations.get(stringoperationId, OperationGetParamsparams, RequestOptionsoptions?): OperationGetResponse` **get** `/zones/{zone_id}/api_gateway/operations/{operation_id}` Gets detailed information about a specific API operation in API Shield, including its schema validation settings and traffic statistics. ### Parameters - `operationId: string` UUID. - `params: OperationGetParams` - `zone_id: string` Path param: Identifier. - `feature?: Array<"thresholds" | "parameter_schemas" | "schema_info">` Query param: Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning. - `"thresholds"` - `"parameter_schemas"` - `"schema_info"` ### Returns - `OperationGetResponse` - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: string` UUID. - `features?: APIShieldOperationFeatureThresholds | APIShieldOperationFeatureParameterSchemas | APIShieldOperationFeatureAPIRouting | 2 more` - `APIShieldOperationFeatureThresholds` - `thresholds?: Thresholds` - `auth_id_tokens?: number` The total number of auth-ids seen across this calculation. - `data_points?: number` The number of data points used for the threshold suggestion calculation. - `last_updated?: string` - `p50?: number` The p50 quantile of requests (in period_seconds). - `p90?: number` The p90 quantile of requests (in period_seconds). - `p99?: number` The p99 quantile of requests (in period_seconds). - `period_seconds?: number` The period over which this threshold is suggested. - `requests?: number` The estimated number of requests covered by these calculations. - `suggested_threshold?: number` The suggested threshold in requests done by the same auth_id or period_seconds. - `APIShieldOperationFeatureParameterSchemas` - `parameter_schemas: ParameterSchemas` - `last_updated?: string` - `parameter_schemas?: ParameterSchemas` An operation schema object containing a response. - `parameters?: Array` An array containing the learned parameter schemas. - `responses?: unknown` An empty response object. This field is required to yield a valid operation schema. - `APIShieldOperationFeatureAPIRouting` - `api_routing?: APIRouting` API Routing settings on endpoint. - `last_updated?: string` - `route?: string` Target route. - `APIShieldOperationFeatureConfidenceIntervals` - `confidence_intervals?: ConfidenceIntervals` - `last_updated?: string` - `suggested_threshold?: SuggestedThreshold` - `confidence_intervals?: ConfidenceIntervals` - `p90?: P90` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p95?: P95` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p99?: P99` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `mean?: number` Suggested threshold. - `APIShieldOperationFeatureSchemaInfo` - `schema_info?: SchemaInfo` - `active_schema?: ActiveSchema` Schema active on endpoint. - `id?: string` UUID. - `created_at?: string` - `is_learned?: boolean` True if schema is Cloudflare-provided. - `name?: string` Schema file name. - `learned_available?: boolean` True if a Cloudflare-provided learned schema is available for this endpoint. - `mitigation_action?: "none" | "log" | "block" | null` Action taken on requests failing validation. - `"none"` - `"log"` - `"block"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const operation = await client.apiGateway.operations.get('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(operation.operation_id); ``` #### Response ```json { "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": { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "features": { "thresholds": { "auth_id_tokens": 0, "data_points": 0, "last_updated": "2014-01-01T05:20:00.12345Z", "p50": 0, "p90": 0, "p99": 0, "period_seconds": 0, "requests": 0, "suggested_threshold": 0 } } }, "success": true } ``` ## Add one operation to a zone `client.apiGateway.operations.create(OperationCreateParamsparams, RequestOptionsoptions?): OperationCreateResponse` **post** `/zones/{zone_id}/api_gateway/operations/item` Add one operation to a zone. Endpoints can contain path variables. Host, method, endpoint will be normalized to a canoncial form when creating an operation and must be unique on the zone. Inserting an operation that matches an existing one will return the record of the already existing operation and update its last_updated date. ### Parameters - `params: OperationCreateParams` - `zone_id: string` Path param: Identifier. - `endpoint: string` Body param: 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/. - `host: string` Body param: RFC3986-compliant host. - `method: "GET" | "POST" | "HEAD" | 6 more` Body param: The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` ### Returns - `OperationCreateResponse` - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: string` UUID. - `features?: APIShieldOperationFeatureThresholds | APIShieldOperationFeatureParameterSchemas | APIShieldOperationFeatureAPIRouting | 2 more` - `APIShieldOperationFeatureThresholds` - `thresholds?: Thresholds` - `auth_id_tokens?: number` The total number of auth-ids seen across this calculation. - `data_points?: number` The number of data points used for the threshold suggestion calculation. - `last_updated?: string` - `p50?: number` The p50 quantile of requests (in period_seconds). - `p90?: number` The p90 quantile of requests (in period_seconds). - `p99?: number` The p99 quantile of requests (in period_seconds). - `period_seconds?: number` The period over which this threshold is suggested. - `requests?: number` The estimated number of requests covered by these calculations. - `suggested_threshold?: number` The suggested threshold in requests done by the same auth_id or period_seconds. - `APIShieldOperationFeatureParameterSchemas` - `parameter_schemas: ParameterSchemas` - `last_updated?: string` - `parameter_schemas?: ParameterSchemas` An operation schema object containing a response. - `parameters?: Array` An array containing the learned parameter schemas. - `responses?: unknown` An empty response object. This field is required to yield a valid operation schema. - `APIShieldOperationFeatureAPIRouting` - `api_routing?: APIRouting` API Routing settings on endpoint. - `last_updated?: string` - `route?: string` Target route. - `APIShieldOperationFeatureConfidenceIntervals` - `confidence_intervals?: ConfidenceIntervals` - `last_updated?: string` - `suggested_threshold?: SuggestedThreshold` - `confidence_intervals?: ConfidenceIntervals` - `p90?: P90` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p95?: P95` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p99?: P99` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `mean?: number` Suggested threshold. - `APIShieldOperationFeatureSchemaInfo` - `schema_info?: SchemaInfo` - `active_schema?: ActiveSchema` Schema active on endpoint. - `id?: string` UUID. - `created_at?: string` - `is_learned?: boolean` True if schema is Cloudflare-provided. - `name?: string` Schema file name. - `learned_available?: boolean` True if a Cloudflare-provided learned schema is available for this endpoint. - `mitigation_action?: "none" | "log" | "block" | null` Action taken on requests failing validation. - `"none"` - `"log"` - `"block"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const operation = await client.apiGateway.operations.create({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', endpoint: '/api/v1/users/{var1}', host: 'www.example.com', method: 'GET', }); console.log(operation.operation_id); ``` #### Response ```json { "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": { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "features": { "thresholds": { "auth_id_tokens": 0, "data_points": 0, "last_updated": "2014-01-01T05:20:00.12345Z", "p50": 0, "p90": 0, "p99": 0, "period_seconds": 0, "requests": 0, "suggested_threshold": 0 } } }, "success": true } ``` ## Delete an operation `client.apiGateway.operations.delete(stringoperationId, OperationDeleteParamsparams, RequestOptionsoptions?): OperationDeleteResponse` **delete** `/zones/{zone_id}/api_gateway/operations/{operation_id}` Removes a single API operation from API Shield endpoint management. The operation will no longer be tracked or protected by API Shield rules. ### Parameters - `operationId: string` UUID. - `params: OperationDeleteParams` - `zone_id: string` Identifier. ### Returns - `OperationDeleteResponse` - `errors: Message` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages: Message` - `success: true` Whether the API call was successful. - `true` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const operation = await client.apiGateway.operations.delete( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(operation.errors); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true } ``` ## Add operations to a zone `client.apiGateway.operations.bulkCreate(OperationBulkCreateParamsparams, RequestOptionsoptions?): SinglePage` **post** `/zones/{zone_id}/api_gateway/operations` Add one or more operations to a zone. Endpoints can contain path variables. Host, method, endpoint will be normalized to a canoncial form when creating an operation and must be unique on the zone. Inserting an operation that matches an existing one will return the record of the already existing operation and update its last_updated date. ### Parameters - `params: OperationBulkCreateParams` - `zone_id: string` Path param: Identifier. - `body: Array` Body param - `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/. - `host: string` RFC3986-compliant host. - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` ### Returns - `OperationBulkCreateResponse` - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: string` UUID. - `features?: APIShieldOperationFeatureThresholds | APIShieldOperationFeatureParameterSchemas | APIShieldOperationFeatureAPIRouting | 2 more` - `APIShieldOperationFeatureThresholds` - `thresholds?: Thresholds` - `auth_id_tokens?: number` The total number of auth-ids seen across this calculation. - `data_points?: number` The number of data points used for the threshold suggestion calculation. - `last_updated?: string` - `p50?: number` The p50 quantile of requests (in period_seconds). - `p90?: number` The p90 quantile of requests (in period_seconds). - `p99?: number` The p99 quantile of requests (in period_seconds). - `period_seconds?: number` The period over which this threshold is suggested. - `requests?: number` The estimated number of requests covered by these calculations. - `suggested_threshold?: number` The suggested threshold in requests done by the same auth_id or period_seconds. - `APIShieldOperationFeatureParameterSchemas` - `parameter_schemas: ParameterSchemas` - `last_updated?: string` - `parameter_schemas?: ParameterSchemas` An operation schema object containing a response. - `parameters?: Array` An array containing the learned parameter schemas. - `responses?: unknown` An empty response object. This field is required to yield a valid operation schema. - `APIShieldOperationFeatureAPIRouting` - `api_routing?: APIRouting` API Routing settings on endpoint. - `last_updated?: string` - `route?: string` Target route. - `APIShieldOperationFeatureConfidenceIntervals` - `confidence_intervals?: ConfidenceIntervals` - `last_updated?: string` - `suggested_threshold?: SuggestedThreshold` - `confidence_intervals?: ConfidenceIntervals` - `p90?: P90` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p95?: P95` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p99?: P99` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `mean?: number` Suggested threshold. - `APIShieldOperationFeatureSchemaInfo` - `schema_info?: SchemaInfo` - `active_schema?: ActiveSchema` Schema active on endpoint. - `id?: string` UUID. - `created_at?: string` - `is_learned?: boolean` True if schema is Cloudflare-provided. - `name?: string` Schema file name. - `learned_available?: boolean` True if a Cloudflare-provided learned schema is available for this endpoint. - `mitigation_action?: "none" | "log" | "block" | null` Action taken on requests failing validation. - `"none"` - `"log"` - `"block"` ### Example ```node 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 operationBulkCreateResponse of client.apiGateway.operations.bulkCreate({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', body: [ { endpoint: '/api/v1/users/{var1}', host: 'www.example.com', method: 'GET', }, ], })) { console.log(operationBulkCreateResponse.operation_id); } ``` #### Response ```json { "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": [ { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "features": { "thresholds": { "auth_id_tokens": 0, "data_points": 0, "last_updated": "2014-01-01T05:20:00.12345Z", "p50": 0, "p90": 0, "p99": 0, "period_seconds": 0, "requests": 0, "suggested_threshold": 0 } } } ], "success": true } ``` ## Delete multiple operations `client.apiGateway.operations.bulkDelete(OperationBulkDeleteParamsparams, RequestOptionsoptions?): OperationBulkDeleteResponse` **delete** `/zones/{zone_id}/api_gateway/operations` Bulk removes multiple API operations from API Shield endpoint management in a single request. Efficient for cleaning up unused endpoints. ### Parameters - `params: OperationBulkDeleteParams` - `zone_id: string` Identifier. ### Returns - `OperationBulkDeleteResponse` - `errors: Message` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages: Message` - `success: true` Whether the API call was successful. - `true` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.apiGateway.operations.bulkDelete({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.errors); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true } ``` ## Domain Types ### API Shield - `APIShield` - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: string` UUID. ### Operation List Response - `OperationListResponse` - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: string` UUID. - `features?: APIShieldOperationFeatureThresholds | APIShieldOperationFeatureParameterSchemas | APIShieldOperationFeatureAPIRouting | 2 more` - `APIShieldOperationFeatureThresholds` - `thresholds?: Thresholds` - `auth_id_tokens?: number` The total number of auth-ids seen across this calculation. - `data_points?: number` The number of data points used for the threshold suggestion calculation. - `last_updated?: string` - `p50?: number` The p50 quantile of requests (in period_seconds). - `p90?: number` The p90 quantile of requests (in period_seconds). - `p99?: number` The p99 quantile of requests (in period_seconds). - `period_seconds?: number` The period over which this threshold is suggested. - `requests?: number` The estimated number of requests covered by these calculations. - `suggested_threshold?: number` The suggested threshold in requests done by the same auth_id or period_seconds. - `APIShieldOperationFeatureParameterSchemas` - `parameter_schemas: ParameterSchemas` - `last_updated?: string` - `parameter_schemas?: ParameterSchemas` An operation schema object containing a response. - `parameters?: Array` An array containing the learned parameter schemas. - `responses?: unknown` An empty response object. This field is required to yield a valid operation schema. - `APIShieldOperationFeatureAPIRouting` - `api_routing?: APIRouting` API Routing settings on endpoint. - `last_updated?: string` - `route?: string` Target route. - `APIShieldOperationFeatureConfidenceIntervals` - `confidence_intervals?: ConfidenceIntervals` - `last_updated?: string` - `suggested_threshold?: SuggestedThreshold` - `confidence_intervals?: ConfidenceIntervals` - `p90?: P90` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p95?: P95` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p99?: P99` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `mean?: number` Suggested threshold. - `APIShieldOperationFeatureSchemaInfo` - `schema_info?: SchemaInfo` - `active_schema?: ActiveSchema` Schema active on endpoint. - `id?: string` UUID. - `created_at?: string` - `is_learned?: boolean` True if schema is Cloudflare-provided. - `name?: string` Schema file name. - `learned_available?: boolean` True if a Cloudflare-provided learned schema is available for this endpoint. - `mitigation_action?: "none" | "log" | "block" | null` Action taken on requests failing validation. - `"none"` - `"log"` - `"block"` ### Operation Get Response - `OperationGetResponse` - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: string` UUID. - `features?: APIShieldOperationFeatureThresholds | APIShieldOperationFeatureParameterSchemas | APIShieldOperationFeatureAPIRouting | 2 more` - `APIShieldOperationFeatureThresholds` - `thresholds?: Thresholds` - `auth_id_tokens?: number` The total number of auth-ids seen across this calculation. - `data_points?: number` The number of data points used for the threshold suggestion calculation. - `last_updated?: string` - `p50?: number` The p50 quantile of requests (in period_seconds). - `p90?: number` The p90 quantile of requests (in period_seconds). - `p99?: number` The p99 quantile of requests (in period_seconds). - `period_seconds?: number` The period over which this threshold is suggested. - `requests?: number` The estimated number of requests covered by these calculations. - `suggested_threshold?: number` The suggested threshold in requests done by the same auth_id or period_seconds. - `APIShieldOperationFeatureParameterSchemas` - `parameter_schemas: ParameterSchemas` - `last_updated?: string` - `parameter_schemas?: ParameterSchemas` An operation schema object containing a response. - `parameters?: Array` An array containing the learned parameter schemas. - `responses?: unknown` An empty response object. This field is required to yield a valid operation schema. - `APIShieldOperationFeatureAPIRouting` - `api_routing?: APIRouting` API Routing settings on endpoint. - `last_updated?: string` - `route?: string` Target route. - `APIShieldOperationFeatureConfidenceIntervals` - `confidence_intervals?: ConfidenceIntervals` - `last_updated?: string` - `suggested_threshold?: SuggestedThreshold` - `confidence_intervals?: ConfidenceIntervals` - `p90?: P90` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p95?: P95` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p99?: P99` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `mean?: number` Suggested threshold. - `APIShieldOperationFeatureSchemaInfo` - `schema_info?: SchemaInfo` - `active_schema?: ActiveSchema` Schema active on endpoint. - `id?: string` UUID. - `created_at?: string` - `is_learned?: boolean` True if schema is Cloudflare-provided. - `name?: string` Schema file name. - `learned_available?: boolean` True if a Cloudflare-provided learned schema is available for this endpoint. - `mitigation_action?: "none" | "log" | "block" | null` Action taken on requests failing validation. - `"none"` - `"log"` - `"block"` ### Operation Create Response - `OperationCreateResponse` - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: string` UUID. - `features?: APIShieldOperationFeatureThresholds | APIShieldOperationFeatureParameterSchemas | APIShieldOperationFeatureAPIRouting | 2 more` - `APIShieldOperationFeatureThresholds` - `thresholds?: Thresholds` - `auth_id_tokens?: number` The total number of auth-ids seen across this calculation. - `data_points?: number` The number of data points used for the threshold suggestion calculation. - `last_updated?: string` - `p50?: number` The p50 quantile of requests (in period_seconds). - `p90?: number` The p90 quantile of requests (in period_seconds). - `p99?: number` The p99 quantile of requests (in period_seconds). - `period_seconds?: number` The period over which this threshold is suggested. - `requests?: number` The estimated number of requests covered by these calculations. - `suggested_threshold?: number` The suggested threshold in requests done by the same auth_id or period_seconds. - `APIShieldOperationFeatureParameterSchemas` - `parameter_schemas: ParameterSchemas` - `last_updated?: string` - `parameter_schemas?: ParameterSchemas` An operation schema object containing a response. - `parameters?: Array` An array containing the learned parameter schemas. - `responses?: unknown` An empty response object. This field is required to yield a valid operation schema. - `APIShieldOperationFeatureAPIRouting` - `api_routing?: APIRouting` API Routing settings on endpoint. - `last_updated?: string` - `route?: string` Target route. - `APIShieldOperationFeatureConfidenceIntervals` - `confidence_intervals?: ConfidenceIntervals` - `last_updated?: string` - `suggested_threshold?: SuggestedThreshold` - `confidence_intervals?: ConfidenceIntervals` - `p90?: P90` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p95?: P95` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p99?: P99` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `mean?: number` Suggested threshold. - `APIShieldOperationFeatureSchemaInfo` - `schema_info?: SchemaInfo` - `active_schema?: ActiveSchema` Schema active on endpoint. - `id?: string` UUID. - `created_at?: string` - `is_learned?: boolean` True if schema is Cloudflare-provided. - `name?: string` Schema file name. - `learned_available?: boolean` True if a Cloudflare-provided learned schema is available for this endpoint. - `mitigation_action?: "none" | "log" | "block" | null` Action taken on requests failing validation. - `"none"` - `"log"` - `"block"` ### Operation Delete Response - `OperationDeleteResponse` - `errors: Message` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages: Message` - `success: true` Whether the API call was successful. - `true` ### Operation Bulk Create Response - `OperationBulkCreateResponse` - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: string` UUID. - `features?: APIShieldOperationFeatureThresholds | APIShieldOperationFeatureParameterSchemas | APIShieldOperationFeatureAPIRouting | 2 more` - `APIShieldOperationFeatureThresholds` - `thresholds?: Thresholds` - `auth_id_tokens?: number` The total number of auth-ids seen across this calculation. - `data_points?: number` The number of data points used for the threshold suggestion calculation. - `last_updated?: string` - `p50?: number` The p50 quantile of requests (in period_seconds). - `p90?: number` The p90 quantile of requests (in period_seconds). - `p99?: number` The p99 quantile of requests (in period_seconds). - `period_seconds?: number` The period over which this threshold is suggested. - `requests?: number` The estimated number of requests covered by these calculations. - `suggested_threshold?: number` The suggested threshold in requests done by the same auth_id or period_seconds. - `APIShieldOperationFeatureParameterSchemas` - `parameter_schemas: ParameterSchemas` - `last_updated?: string` - `parameter_schemas?: ParameterSchemas` An operation schema object containing a response. - `parameters?: Array` An array containing the learned parameter schemas. - `responses?: unknown` An empty response object. This field is required to yield a valid operation schema. - `APIShieldOperationFeatureAPIRouting` - `api_routing?: APIRouting` API Routing settings on endpoint. - `last_updated?: string` - `route?: string` Target route. - `APIShieldOperationFeatureConfidenceIntervals` - `confidence_intervals?: ConfidenceIntervals` - `last_updated?: string` - `suggested_threshold?: SuggestedThreshold` - `confidence_intervals?: ConfidenceIntervals` - `p90?: P90` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p95?: P95` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `p99?: P99` Upper and lower bound for percentile estimate - `lower?: number` Lower bound for percentile estimate - `upper?: number` Upper bound for percentile estimate - `mean?: number` Suggested threshold. - `APIShieldOperationFeatureSchemaInfo` - `schema_info?: SchemaInfo` - `active_schema?: ActiveSchema` Schema active on endpoint. - `id?: string` UUID. - `created_at?: string` - `is_learned?: boolean` True if schema is Cloudflare-provided. - `name?: string` Schema file name. - `learned_available?: boolean` True if a Cloudflare-provided learned schema is available for this endpoint. - `mitigation_action?: "none" | "log" | "block" | null` Action taken on requests failing validation. - `"none"` - `"log"` - `"block"` ### Operation Bulk Delete Response - `OperationBulkDeleteResponse` - `errors: Message` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages: Message` - `success: true` Whether the API call was successful. - `true` # Labels ## Replace label(s) on an operation in endpoint management `client.apiGateway.operations.labels.update(stringoperationId, LabelUpdateParamsparams, RequestOptionsoptions?): LabelUpdateResponse` **put** `/zones/{zone_id}/api_gateway/operations/{operation_id}/labels` Replace label(s) on an operation in endpoint management ### Parameters - `operationId: string` UUID. - `params: LabelUpdateParams` - `zone_id: string` Path param: Identifier. - `managed?: Array` Body param: List of managed label names. Omitting this property or passing an empty array will result in all managed labels being removed from the operation - `user?: Array` Body param: List of user label names. Omitting this property or passing an empty array will result in all user labels being removed from the operation ### Returns - `LabelUpdateResponse` - `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/. - `host: string` RFC3986-compliant host. - `last_updated: string` - `method: "GET" | "POST" | "HEAD" | 6 more` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: string` UUID. - `labels?: Array