# User Schemas ## Retrieve information about all schemas on a zone `api_gateway.user_schemas.list(UserSchemaListParams**kwargs) -> SyncV4PagePaginationArray[OldPublicSchema]` **get** `/zones/{zone_id}/api_gateway/user_schemas` Lists all OpenAPI schemas uploaded to API Shield for the zone, including their validation status and associated operations. ### Parameters - `zone_id: str` Identifier. - `omit_source: Optional[bool]` Omit the source-files of schemas and only retrieve their meta-data. - `page: Optional[int]` Page number of paginated results. - `per_page: Optional[int]` Maximum number of results per page. - `validation_enabled: Optional[bool]` Flag whether schema is enabled for validation. ### Returns - `class OldPublicSchema: …` - `created_at: datetime` - `kind: Literal["openapi_v3"]` Kind of schema - `"openapi_v3"` - `name: str` Name of the schema - `schema_id: str` UUID. - `source: Optional[str]` Source of the schema - `validation_enabled: Optional[bool]` Flag whether schema is enabled for validation. ### Example ```python 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.user_schemas.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.schema_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": [ { "created_at": "2014-01-01T05:20:00.12345Z", "kind": "openapi_v3", "name": "petstore schema", "schema_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "source": "", "validation_enabled": true } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Retrieve information about a specific schema on a zone `api_gateway.user_schemas.get(strschema_id, UserSchemaGetParams**kwargs) -> OldPublicSchema` **get** `/zones/{zone_id}/api_gateway/user_schemas/{schema_id}` Gets detailed information about a specific uploaded OpenAPI schema, including its contents and validation configuration. ### Parameters - `zone_id: str` Identifier. - `schema_id: str` - `omit_source: Optional[bool]` Omit the source-files of schemas and only retrieve their meta-data. ### Returns - `class OldPublicSchema: …` - `created_at: datetime` - `kind: Literal["openapi_v3"]` Kind of schema - `"openapi_v3"` - `name: str` Name of the schema - `schema_id: str` UUID. - `source: Optional[str]` Source of the schema - `validation_enabled: Optional[bool]` Flag whether schema is enabled for validation. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) old_public_schema = client.api_gateway.user_schemas.get( schema_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(old_public_schema.schema_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": { "created_at": "2014-01-01T05:20:00.12345Z", "kind": "openapi_v3", "name": "petstore schema", "schema_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "source": "", "validation_enabled": true }, "success": true } ``` ## Upload a schema to a zone `api_gateway.user_schemas.create(UserSchemaCreateParams**kwargs) -> UserSchemaCreateResponse` **post** `/zones/{zone_id}/api_gateway/user_schemas` Upload a schema to a zone ### Parameters - `zone_id: str` Identifier. - `file: FileTypes` Schema file bytes - `kind: Literal["openapi_v3"]` Kind of schema - `"openapi_v3"` - `name: Optional[str]` Name of the schema - `validation_enabled: Optional[Literal["true", "false"]]` Flag whether schema is enabled for validation. - `"true"` - `"false"` ### Returns - `class UserSchemaCreateResponse: …` - `schema: OldPublicSchema` - `created_at: datetime` - `kind: Literal["openapi_v3"]` Kind of schema - `"openapi_v3"` - `name: str` Name of the schema - `schema_id: str` UUID. - `source: Optional[str]` Source of the schema - `validation_enabled: Optional[bool]` Flag whether schema is enabled for validation. - `upload_details: Optional[UploadDetails]` - `warnings: Optional[List[UploadDetailsWarning]]` Diagnostic warning events that occurred during processing. These events are non-critical errors found within the schema. - `code: int` Code that identifies the event that occurred. - `locations: Optional[List[str]]` JSONPath location(s) in the schema where these events were encountered. See for JSONPath specification. - `message: Optional[str]` Diagnostic message that describes the event. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) user_schema = client.api_gateway.user_schemas.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", file=b"Example data", kind="openapi_v3", ) print(user_schema.schema) ``` #### 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": { "schema": { "created_at": "2014-01-01T05:20:00.12345Z", "kind": "openapi_v3", "name": "petstore schema", "schema_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "source": "", "validation_enabled": true }, "upload_details": { "warnings": [ { "code": 28, "locations": [ ".paths[\"/user/{username}\"].put" ], "message": "unsupported media type: application/octet-stream" } ] } }, "success": true } ``` ## Enable validation for a schema `api_gateway.user_schemas.edit(strschema_id, UserSchemaEditParams**kwargs) -> OldPublicSchema` **patch** `/zones/{zone_id}/api_gateway/user_schemas/{schema_id}` Activates schema validation for an uploaded OpenAPI schema. Requests to matching endpoints will be validated against the schema definitions. ### Parameters - `zone_id: str` Identifier. - `schema_id: str` - `validation_enabled: Optional[Literal[true]]` Flag whether schema is enabled for validation. - `true` ### Returns - `class OldPublicSchema: …` - `created_at: datetime` - `kind: Literal["openapi_v3"]` Kind of schema - `"openapi_v3"` - `name: str` Name of the schema - `schema_id: str` UUID. - `source: Optional[str]` Source of the schema - `validation_enabled: Optional[bool]` Flag whether schema is enabled for validation. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) old_public_schema = client.api_gateway.user_schemas.edit( schema_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(old_public_schema.schema_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": { "created_at": "2014-01-01T05:20:00.12345Z", "kind": "openapi_v3", "name": "petstore schema", "schema_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "source": "", "validation_enabled": true }, "success": true } ``` ## Delete a schema `api_gateway.user_schemas.delete(strschema_id, UserSchemaDeleteParams**kwargs) -> UserSchemaDeleteResponse` **delete** `/zones/{zone_id}/api_gateway/user_schemas/{schema_id}` Permanently removes an uploaded OpenAPI schema from API Shield schema validation. Operations using this schema will lose their validation rules. ### Parameters - `zone_id: str` Identifier. - `schema_id: str` ### Returns - `class UserSchemaDeleteResponse: …` - `errors: Message` - `code: int` - `message: str` - `documentation_url: Optional[str]` - `source: Optional[MessageItemSource]` - `pointer: Optional[str]` - `messages: Message` - `success: Literal[true]` Whether the API call was successful. - `true` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) user_schema = client.api_gateway.user_schemas.delete( schema_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(user_schema.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 ### Message - `List[MessageItem]` - `code: int` - `message: str` - `documentation_url: Optional[str]` - `source: Optional[MessageItemSource]` - `pointer: Optional[str]` ### Old Public Schema - `class OldPublicSchema: …` - `created_at: datetime` - `kind: Literal["openapi_v3"]` Kind of schema - `"openapi_v3"` - `name: str` Name of the schema - `schema_id: str` UUID. - `source: Optional[str]` Source of the schema - `validation_enabled: Optional[bool]` Flag whether schema is enabled for validation. ### User Schema Create Response - `class UserSchemaCreateResponse: …` - `schema: OldPublicSchema` - `created_at: datetime` - `kind: Literal["openapi_v3"]` Kind of schema - `"openapi_v3"` - `name: str` Name of the schema - `schema_id: str` UUID. - `source: Optional[str]` Source of the schema - `validation_enabled: Optional[bool]` Flag whether schema is enabled for validation. - `upload_details: Optional[UploadDetails]` - `warnings: Optional[List[UploadDetailsWarning]]` Diagnostic warning events that occurred during processing. These events are non-critical errors found within the schema. - `code: int` Code that identifies the event that occurred. - `locations: Optional[List[str]]` JSONPath location(s) in the schema where these events were encountered. See for JSONPath specification. - `message: Optional[str]` Diagnostic message that describes the event. ### User Schema Delete Response - `class UserSchemaDeleteResponse: …` - `errors: Message` - `code: int` - `message: str` - `documentation_url: Optional[str]` - `source: Optional[MessageItemSource]` - `pointer: Optional[str]` - `messages: Message` - `success: Literal[true]` Whether the API call was successful. - `true` # Operations ## Retrieve all operations from a schema. `api_gateway.user_schemas.operations.list(strschema_id, OperationListParams**kwargs) -> SyncV4PagePaginationArray[OperationListResponse]` **get** `/zones/{zone_id}/api_gateway/user_schemas/{schema_id}/operations` Retrieves all operations from the schema. Operations that already exist in API Shield Endpoint Management will be returned as full operations. ### Parameters - `zone_id: str` Identifier. - `schema_id: str` - `endpoint: Optional[str]` Filter results to only include endpoints containing this pattern. - `feature: Optional[List[Literal["thresholds", "parameter_schemas", "schema_info"]]]` 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: Optional[SequenceNotStr[str]]` Filter results to only include the specified hosts. - `method: Optional[SequenceNotStr[str]]` Filter results to only include the specified HTTP methods. - `operation_status: Optional[Literal["new", "existing"]]` Filter results by whether operations exist in API Shield Endpoint Management or not. `new` will just return operations from the schema that do not exist in API Shield Endpoint Management. `existing` will just return operations from the schema that already exist in API Shield Endpoint Management. - `"new"` - `"existing"` - `page: Optional[int]` Page number of paginated results. - `per_page: Optional[int]` Maximum number of results per page. ### Returns - `OperationListResponse` - `class APIShieldOperation: …` - `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/. - `host: str` RFC3986-compliant host. - `last_updated: datetime` - `method: Literal["GET", "POST", "HEAD", 6 more]` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: str` UUID. - `features: Optional[APIShieldOperationFeatures]` - `class APIShieldOperationFeaturesAPIShieldOperationFeatureThresholds: …` - `thresholds: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureThresholdsThresholds]` - `auth_id_tokens: Optional[int]` The total number of auth-ids seen across this calculation. - `data_points: Optional[int]` The number of data points used for the threshold suggestion calculation. - `last_updated: Optional[datetime]` - `p50: Optional[int]` The p50 quantile of requests (in period_seconds). - `p90: Optional[int]` The p90 quantile of requests (in period_seconds). - `p99: Optional[int]` The p99 quantile of requests (in period_seconds). - `period_seconds: Optional[int]` The period over which this threshold is suggested. - `requests: Optional[int]` The estimated number of requests covered by these calculations. - `suggested_threshold: Optional[int]` The suggested threshold in requests done by the same auth_id or period_seconds. - `class APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemas: …` - `parameter_schemas: APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas` - `last_updated: Optional[datetime]` - `parameter_schemas: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas]` An operation schema object containing a response. - `parameters: Optional[List[object]]` An array containing the learned parameter schemas. - `responses: Optional[object]` An empty response object. This field is required to yield a valid operation schema. - `class APIShieldOperationFeaturesAPIShieldOperationFeatureAPIRouting: …` - `api_routing: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting]` API Routing settings on endpoint. - `last_updated: Optional[datetime]` - `route: Optional[str]` Target route. - `class APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervals: …` - `confidence_intervals: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals]` - `last_updated: Optional[datetime]` - `suggested_threshold: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold]` - `confidence_intervals: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals]` - `p90: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90]` Upper and lower bound for percentile estimate - `lower: Optional[float]` Lower bound for percentile estimate - `upper: Optional[float]` Upper bound for percentile estimate - `p95: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95]` Upper and lower bound for percentile estimate - `lower: Optional[float]` Lower bound for percentile estimate - `upper: Optional[float]` Upper bound for percentile estimate - `p99: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99]` Upper and lower bound for percentile estimate - `lower: Optional[float]` Lower bound for percentile estimate - `upper: Optional[float]` Upper bound for percentile estimate - `mean: Optional[float]` Suggested threshold. - `class APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfo: …` - `schema_info: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo]` - `active_schema: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema]` Schema active on endpoint. - `id: Optional[str]` UUID. - `created_at: Optional[datetime]` - `is_learned: Optional[bool]` True if schema is Cloudflare-provided. - `name: Optional[str]` Schema file name. - `learned_available: Optional[bool]` True if a Cloudflare-provided learned schema is available for this endpoint. - `mitigation_action: Optional[Literal["none", "log", "block"]]` Action taken on requests failing validation. - `"none"` - `"log"` - `"block"` - `class APIShieldBasicOperation: …` - `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/. - `host: str` RFC3986-compliant host. - `method: Literal["GET", "POST", "HEAD", 6 more]` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` ### Example ```python 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.user_schemas.operations.list( schema_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page) ``` #### 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 } } ``` ## Domain Types ### Operation List Response - `OperationListResponse` - `class APIShieldOperation: …` - `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/. - `host: str` RFC3986-compliant host. - `last_updated: datetime` - `method: Literal["GET", "POST", "HEAD", 6 more]` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` - `operation_id: str` UUID. - `features: Optional[APIShieldOperationFeatures]` - `class APIShieldOperationFeaturesAPIShieldOperationFeatureThresholds: …` - `thresholds: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureThresholdsThresholds]` - `auth_id_tokens: Optional[int]` The total number of auth-ids seen across this calculation. - `data_points: Optional[int]` The number of data points used for the threshold suggestion calculation. - `last_updated: Optional[datetime]` - `p50: Optional[int]` The p50 quantile of requests (in period_seconds). - `p90: Optional[int]` The p90 quantile of requests (in period_seconds). - `p99: Optional[int]` The p99 quantile of requests (in period_seconds). - `period_seconds: Optional[int]` The period over which this threshold is suggested. - `requests: Optional[int]` The estimated number of requests covered by these calculations. - `suggested_threshold: Optional[int]` The suggested threshold in requests done by the same auth_id or period_seconds. - `class APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemas: …` - `parameter_schemas: APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas` - `last_updated: Optional[datetime]` - `parameter_schemas: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas]` An operation schema object containing a response. - `parameters: Optional[List[object]]` An array containing the learned parameter schemas. - `responses: Optional[object]` An empty response object. This field is required to yield a valid operation schema. - `class APIShieldOperationFeaturesAPIShieldOperationFeatureAPIRouting: …` - `api_routing: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting]` API Routing settings on endpoint. - `last_updated: Optional[datetime]` - `route: Optional[str]` Target route. - `class APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervals: …` - `confidence_intervals: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals]` - `last_updated: Optional[datetime]` - `suggested_threshold: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold]` - `confidence_intervals: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals]` - `p90: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90]` Upper and lower bound for percentile estimate - `lower: Optional[float]` Lower bound for percentile estimate - `upper: Optional[float]` Upper bound for percentile estimate - `p95: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95]` Upper and lower bound for percentile estimate - `lower: Optional[float]` Lower bound for percentile estimate - `upper: Optional[float]` Upper bound for percentile estimate - `p99: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99]` Upper and lower bound for percentile estimate - `lower: Optional[float]` Lower bound for percentile estimate - `upper: Optional[float]` Upper bound for percentile estimate - `mean: Optional[float]` Suggested threshold. - `class APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfo: …` - `schema_info: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo]` - `active_schema: Optional[APIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema]` Schema active on endpoint. - `id: Optional[str]` UUID. - `created_at: Optional[datetime]` - `is_learned: Optional[bool]` True if schema is Cloudflare-provided. - `name: Optional[str]` Schema file name. - `learned_available: Optional[bool]` True if a Cloudflare-provided learned schema is available for this endpoint. - `mitigation_action: Optional[Literal["none", "log", "block"]]` Action taken on requests failing validation. - `"none"` - `"log"` - `"block"` - `class APIShieldBasicOperation: …` - `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/. - `host: str` RFC3986-compliant host. - `method: Literal["GET", "POST", "HEAD", 6 more]` The HTTP method used to access the endpoint. - `"GET"` - `"POST"` - `"HEAD"` - `"OPTIONS"` - `"PUT"` - `"DELETE"` - `"CONNECT"` - `"PATCH"` - `"TRACE"` # Hosts ## Retrieve schema hosts in a zone `api_gateway.user_schemas.hosts.list(HostListParams**kwargs) -> SyncV4PagePaginationArray[HostListResponse]` **get** `/zones/{zone_id}/api_gateway/user_schemas/hosts` Lists all unique hosts found in uploaded OpenAPI schemas for the zone. Useful for understanding which domains have schema coverage. ### Parameters - `zone_id: str` Identifier. - `page: Optional[int]` Page number of paginated results. - `per_page: Optional[int]` Maximum number of results per page. ### Returns - `class HostListResponse: …` - `created_at: datetime` - `hosts: List[str]` Hosts serving the schema, e.g zone.host.com - `name: str` Name of the schema - `schema_id: str` UUID. ### Example ```python 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.user_schemas.hosts.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.schema_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" } } ], "success": true, "result": [ { "created_at": "2014-01-01T05:20:00.12345Z", "hosts": [ "string" ], "name": "petstore schema", "schema_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### Host List Response - `class HostListResponse: …` - `created_at: datetime` - `hosts: List[str]` Hosts serving the schema, e.g zone.host.com - `name: str` Name of the schema - `schema_id: str` UUID.