# Leaked Credential Checks ## Get Leaked Credential Checks Status `leaked_credential_checks.get(LeakedCredentialCheckGetParams**kwargs) -> LeakedCredentialCheckGetResponse` **get** `/zones/{zone_id}/leaked-credential-checks` Retrieves the current status of Leaked Credential Checks. ### Parameters - `zone_id: str` Defines an identifier. ### Returns - `class LeakedCredentialCheckGetResponse: …` Defines the overall status for Leaked Credential Checks. - `enabled: Optional[bool]` Determines whether or not Leaked Credential Checks are enabled. ### 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 ) leaked_credential_check = client.leaked_credential_checks.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(leaked_credential_check.enabled) ``` #### 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": { "enabled": true }, "success": true } ``` ## Set Leaked Credential Checks Status `leaked_credential_checks.create(LeakedCredentialCheckCreateParams**kwargs) -> LeakedCredentialCheckCreateResponse` **post** `/zones/{zone_id}/leaked-credential-checks` Updates the current status of Leaked Credential Checks. ### Parameters - `zone_id: str` Defines an identifier. - `enabled: Optional[bool]` Determines whether or not Leaked Credential Checks are enabled. ### Returns - `class LeakedCredentialCheckCreateResponse: …` Defines the overall status for Leaked Credential Checks. - `enabled: Optional[bool]` Determines whether or not Leaked Credential Checks are enabled. ### 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 ) leaked_credential_check = client.leaked_credential_checks.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(leaked_credential_check.enabled) ``` #### 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": { "enabled": true }, "success": true } ``` ## Domain Types ### Leaked Credential Check Get Response - `class LeakedCredentialCheckGetResponse: …` Defines the overall status for Leaked Credential Checks. - `enabled: Optional[bool]` Determines whether or not Leaked Credential Checks are enabled. ### Leaked Credential Check Create Response - `class LeakedCredentialCheckCreateResponse: …` Defines the overall status for Leaked Credential Checks. - `enabled: Optional[bool]` Determines whether or not Leaked Credential Checks are enabled. # Detections ## List Leaked Credential Checks Custom Detections `leaked_credential_checks.detections.list(DetectionListParams**kwargs) -> SyncSinglePage[DetectionListResponse]` **get** `/zones/{zone_id}/leaked-credential-checks/detections` List user-defined detection patterns for Leaked Credential Checks. ### Parameters - `zone_id: str` Defines an identifier. ### Returns - `class DetectionListResponse: …` Defines a custom set of username/password expressions to match Leaked Credential Checks on. - `id: Optional[str]` Defines the unique ID for this custom detection. - `password: Optional[str]` Defines ehe ruleset expression to use in matching the password in a request. - `username: Optional[str]` Defines the ruleset expression to use in matching the username in a request. ### 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.leaked_credential_checks.detections.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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": "18a14bafaa8eb1df04ce683ec18c765e", "password": "lookup_json_string(http.request.body.raw, \"secret\")", "username": "lookup_json_string(http.request.body.raw, \"user\")" } ], "success": true } ``` ## Create Leaked Credential Checks Custom Detection `leaked_credential_checks.detections.create(DetectionCreateParams**kwargs) -> DetectionCreateResponse` **post** `/zones/{zone_id}/leaked-credential-checks/detections` Create user-defined detection pattern for Leaked Credential Checks. ### Parameters - `zone_id: str` Defines an identifier. - `password: Optional[str]` Defines ehe ruleset expression to use in matching the password in a request. - `username: Optional[str]` Defines the ruleset expression to use in matching the username in a request. ### Returns - `class DetectionCreateResponse: …` Defines a custom set of username/password expressions to match Leaked Credential Checks on. - `id: Optional[str]` Defines the unique ID for this custom detection. - `password: Optional[str]` Defines ehe ruleset expression to use in matching the password in a request. - `username: Optional[str]` Defines the ruleset expression to use in matching the username in a request. ### 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 ) detection = client.leaked_credential_checks.detections.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(detection.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": "18a14bafaa8eb1df04ce683ec18c765e", "password": "lookup_json_string(http.request.body.raw, \"secret\")", "username": "lookup_json_string(http.request.body.raw, \"user\")" }, "success": true } ``` ## Get Leaked Credential Checks Custom Detection `leaked_credential_checks.detections.get(strdetection_id, DetectionGetParams**kwargs) -> DetectionGetResponse` **get** `/zones/{zone_id}/leaked-credential-checks/detections/{detection_id}` Get user-defined detection pattern for Leaked Credential Checks. ### Parameters - `zone_id: str` Defines an identifier. - `detection_id: str` Defines the unique ID for this custom detection. ### Returns - `class DetectionGetResponse: …` Defines a custom set of username/password expressions to match Leaked Credential Checks on. - `id: Optional[str]` Defines the unique ID for this custom detection. - `password: Optional[str]` Defines ehe ruleset expression to use in matching the password in a request. - `username: Optional[str]` Defines the ruleset expression to use in matching the username in a request. ### 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 ) detection = client.leaked_credential_checks.detections.get( detection_id="18a14bafaa8eb1df04ce683ec18c765e", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(detection.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": "18a14bafaa8eb1df04ce683ec18c765e", "password": "lookup_json_string(http.request.body.raw, \"secret\")", "username": "lookup_json_string(http.request.body.raw, \"user\")" }, "success": true } ``` ## Update Leaked Credential Checks Custom Detection `leaked_credential_checks.detections.update(strdetection_id, DetectionUpdateParams**kwargs) -> DetectionUpdateResponse` **put** `/zones/{zone_id}/leaked-credential-checks/detections/{detection_id}` Update user-defined detection pattern for Leaked Credential Checks. ### Parameters - `zone_id: str` Defines an identifier. - `detection_id: str` Defines the unique ID for this custom detection. - `password: Optional[str]` Defines ehe ruleset expression to use in matching the password in a request. - `username: Optional[str]` Defines the ruleset expression to use in matching the username in a request. ### Returns - `class DetectionUpdateResponse: …` Defines a custom set of username/password expressions to match Leaked Credential Checks on. - `id: Optional[str]` Defines the unique ID for this custom detection. - `password: Optional[str]` Defines ehe ruleset expression to use in matching the password in a request. - `username: Optional[str]` Defines the ruleset expression to use in matching the username in a request. ### 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 ) detection = client.leaked_credential_checks.detections.update( detection_id="18a14bafaa8eb1df04ce683ec18c765e", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(detection.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": "18a14bafaa8eb1df04ce683ec18c765e", "password": "lookup_json_string(http.request.body.raw, \"secret\")", "username": "lookup_json_string(http.request.body.raw, \"user\")" }, "success": true } ``` ## Delete Leaked Credential Checks Custom Detection `leaked_credential_checks.detections.delete(strdetection_id, DetectionDeleteParams**kwargs) -> object` **delete** `/zones/{zone_id}/leaked-credential-checks/detections/{detection_id}` Remove user-defined detection pattern for Leaked Credential Checks. ### Parameters - `zone_id: str` Defines an identifier. - `detection_id: str` Defines the unique ID for this custom detection. ### Returns - `object` ### 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 ) detection = client.leaked_credential_checks.detections.delete( detection_id="18a14bafaa8eb1df04ce683ec18c765e", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(detection) ``` #### 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": {}, "success": true } ``` ## Domain Types ### Detection List Response - `class DetectionListResponse: …` Defines a custom set of username/password expressions to match Leaked Credential Checks on. - `id: Optional[str]` Defines the unique ID for this custom detection. - `password: Optional[str]` Defines ehe ruleset expression to use in matching the password in a request. - `username: Optional[str]` Defines the ruleset expression to use in matching the username in a request. ### Detection Create Response - `class DetectionCreateResponse: …` Defines a custom set of username/password expressions to match Leaked Credential Checks on. - `id: Optional[str]` Defines the unique ID for this custom detection. - `password: Optional[str]` Defines ehe ruleset expression to use in matching the password in a request. - `username: Optional[str]` Defines the ruleset expression to use in matching the username in a request. ### Detection Get Response - `class DetectionGetResponse: …` Defines a custom set of username/password expressions to match Leaked Credential Checks on. - `id: Optional[str]` Defines the unique ID for this custom detection. - `password: Optional[str]` Defines ehe ruleset expression to use in matching the password in a request. - `username: Optional[str]` Defines the ruleset expression to use in matching the username in a request. ### Detection Update Response - `class DetectionUpdateResponse: …` Defines a custom set of username/password expressions to match Leaked Credential Checks on. - `id: Optional[str]` Defines the unique ID for this custom detection. - `password: Optional[str]` Defines ehe ruleset expression to use in matching the password in a request. - `username: Optional[str]` Defines the ruleset expression to use in matching the username in a request.