# Payloads ## List Existing Custom Scan Expressions `content_scanning.payloads.list(PayloadListParams**kwargs) -> SyncSinglePage[PayloadListResponse]` **get** `/zones/{zone_id}/content-upload-scan/payloads` Get a list of existing custom scan expressions for Content Scanning. ### Parameters - `zone_id: str` Defines an identifier. ### Returns - `class PayloadListResponse: …` Defines a custom scan expression to match Content Scanning on. - `id: Optional[str]` defines the unique ID for this custom scan expression. - `payload: Optional[str]` Defines the ruleset expression to use in matching content objects. ### 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.content_scanning.payloads.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": "a350a054caa840c9becd89c3b4f0195b", "payload": "lookup_json_string(http.request.body.raw, \"file\")" } ], "success": true } ``` ## Add Custom Scan Expressions `content_scanning.payloads.create(PayloadCreateParams**kwargs) -> SyncSinglePage[PayloadCreateResponse]` **post** `/zones/{zone_id}/content-upload-scan/payloads` Add custom scan expressions for Content Scanning. ### Parameters - `zone_id: str` Defines an identifier. - `body: Iterable[Body]` - `payload: str` Defines the ruleset expression to use in matching content objects. ### Returns - `class PayloadCreateResponse: …` Defines a custom scan expression to match Content Scanning on. - `id: Optional[str]` defines the unique ID for this custom scan expression. - `payload: Optional[str]` Defines the ruleset expression to use in matching content objects. ### 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.content_scanning.payloads.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", body=[{ "payload": "lookup_json_string(http.request.body.raw, \"file\")" }], ) 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": "a350a054caa840c9becd89c3b4f0195b", "payload": "lookup_json_string(http.request.body.raw, \"file\")" } ], "success": true } ``` ## Delete a Custom Scan Expression `content_scanning.payloads.delete(strexpression_id, PayloadDeleteParams**kwargs) -> SyncSinglePage[PayloadDeleteResponse]` **delete** `/zones/{zone_id}/content-upload-scan/payloads/{expression_id}` Delete a Content Scan Custom Expression. ### Parameters - `zone_id: str` Defines an identifier. - `expression_id: str` defines the unique ID for this custom scan expression. ### Returns - `class PayloadDeleteResponse: …` Defines a custom scan expression to match Content Scanning on. - `id: Optional[str]` defines the unique ID for this custom scan expression. - `payload: Optional[str]` Defines the ruleset expression to use in matching content objects. ### 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.content_scanning.payloads.delete( expression_id="a350a054caa840c9becd89c3b4f0195b", 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": "a350a054caa840c9becd89c3b4f0195b", "payload": "lookup_json_string(http.request.body.raw, \"file\")" } ], "success": true } ``` ## Domain Types ### Payload List Response - `class PayloadListResponse: …` Defines a custom scan expression to match Content Scanning on. - `id: Optional[str]` defines the unique ID for this custom scan expression. - `payload: Optional[str]` Defines the ruleset expression to use in matching content objects. ### Payload Create Response - `class PayloadCreateResponse: …` Defines a custom scan expression to match Content Scanning on. - `id: Optional[str]` defines the unique ID for this custom scan expression. - `payload: Optional[str]` Defines the ruleset expression to use in matching content objects. ### Payload Delete Response - `class PayloadDeleteResponse: …` Defines a custom scan expression to match Content Scanning on. - `id: Optional[str]` defines the unique ID for this custom scan expression. - `payload: Optional[str]` Defines the ruleset expression to use in matching content objects.