# Content Scanning ## Enable Content Scanning `client.contentScanning.enable(ContentScanningEnableParamsparams, RequestOptionsoptions?): ContentScanningEnableResponse` **post** `/zones/{zone_id}/content-upload-scan/enable` Enable Content Scanning. ### Parameters - `params: ContentScanningEnableParams` - `zone_id: string` Defines an identifier. ### Returns - `ContentScanningEnableResponse = unknown` ### 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.contentScanning.enable({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); 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": {}, "success": true } ``` ## Disable Content Scanning `client.contentScanning.disable(ContentScanningDisableParamsparams, RequestOptionsoptions?): ContentScanningDisableResponse` **post** `/zones/{zone_id}/content-upload-scan/disable` Disable Content Scanning. ### Parameters - `params: ContentScanningDisableParams` - `zone_id: string` Defines an identifier. ### Returns - `ContentScanningDisableResponse = unknown` ### 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.contentScanning.disable({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); 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": {}, "success": true } ``` ## Update Content Scanning Status `client.contentScanning.create(ContentScanningCreateParamsparams, RequestOptionsoptions?): ContentScanningCreateResponse` **put** `/zones/{zone_id}/content-upload-scan/settings` Update the Content Scanning status. ### Parameters - `params: ContentScanningCreateParams` - `zone_id: string` Path param: Defines an identifier. - `value: "enabled" | "disabled"` Body param: The status value for Content Scanning. - `"enabled"` - `"disabled"` ### Returns - `ContentScanningCreateResponse` Defines the status for Content Scanning. - `modified?: string` Defines the last modification date (ISO 8601) of the Content Scanning status. - `value?: string` Defines the status of Content Scanning. ### 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 contentScanning = await client.contentScanning.create({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', value: 'enabled', }); console.log(contentScanning.modified); ``` #### 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": { "modified": "2024-12-02T09:57:23.150259Z", "value": "enabled" }, "success": true } ``` ## Update Content Scanning Status `client.contentScanning.update(ContentScanningUpdateParamsparams, RequestOptionsoptions?): ContentScanningUpdateResponse` **put** `/zones/{zone_id}/content-upload-scan/settings` Update the Content Scanning status. ### Parameters - `params: ContentScanningUpdateParams` - `zone_id: string` Path param: Defines an identifier. - `value: "enabled" | "disabled"` Body param: The status value for Content Scanning. - `"enabled"` - `"disabled"` ### Returns - `ContentScanningUpdateResponse` Defines the status for Content Scanning. - `modified?: string` Defines the last modification date (ISO 8601) of the Content Scanning status. - `value?: string` Defines the status of Content Scanning. ### 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 contentScanning = await client.contentScanning.update({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', value: 'enabled', }); console.log(contentScanning.modified); ``` #### 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": { "modified": "2024-12-02T09:57:23.150259Z", "value": "enabled" }, "success": true } ``` ## Get Content Scanning Status `client.contentScanning.get(ContentScanningGetParamsparams, RequestOptionsoptions?): ContentScanningGetResponse` **get** `/zones/{zone_id}/content-upload-scan/settings` Retrieve the current status of Content Scanning. ### Parameters - `params: ContentScanningGetParams` - `zone_id: string` Defines an identifier. ### Returns - `ContentScanningGetResponse` Defines the status for Content Scanning. - `modified?: string` Defines the last modification date (ISO 8601) of the Content Scanning status. - `value?: string` Defines the status of Content Scanning. ### 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 contentScanning = await client.contentScanning.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(contentScanning.modified); ``` #### 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": { "modified": "2024-12-02T09:57:23.150259Z", "value": "enabled" }, "success": true } ``` ## Domain Types ### Content Scanning Enable Response - `ContentScanningEnableResponse = unknown` ### Content Scanning Disable Response - `ContentScanningDisableResponse = unknown` ### Content Scanning Create Response - `ContentScanningCreateResponse` Defines the status for Content Scanning. - `modified?: string` Defines the last modification date (ISO 8601) of the Content Scanning status. - `value?: string` Defines the status of Content Scanning. ### Content Scanning Update Response - `ContentScanningUpdateResponse` Defines the status for Content Scanning. - `modified?: string` Defines the last modification date (ISO 8601) of the Content Scanning status. - `value?: string` Defines the status of Content Scanning. ### Content Scanning Get Response - `ContentScanningGetResponse` Defines the status for Content Scanning. - `modified?: string` Defines the last modification date (ISO 8601) of the Content Scanning status. - `value?: string` Defines the status of Content Scanning. # Payloads ## List Existing Custom Scan Expressions `client.contentScanning.payloads.list(PayloadListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/zones/{zone_id}/content-upload-scan/payloads` Get a list of existing custom scan expressions for Content Scanning. ### Parameters - `params: PayloadListParams` - `zone_id: string` Defines an identifier. ### Returns - `PayloadListResponse` Defines a custom scan expression to match Content Scanning on. - `id?: string` defines the unique ID for this custom scan expression. - `payload?: string` Defines the ruleset expression to use in matching content objects. ### 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 payloadListResponse of client.contentScanning.payloads.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(payloadListResponse.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 `client.contentScanning.payloads.create(PayloadCreateParamsparams, RequestOptionsoptions?): SinglePage` **post** `/zones/{zone_id}/content-upload-scan/payloads` Add custom scan expressions for Content Scanning. ### Parameters - `params: PayloadCreateParams` - `zone_id: string` Path param: Defines an identifier. - `body: Array` Body param - `payload: string` Defines the ruleset expression to use in matching content objects. ### Returns - `PayloadCreateResponse` Defines a custom scan expression to match Content Scanning on. - `id?: string` defines the unique ID for this custom scan expression. - `payload?: string` Defines the ruleset expression to use in matching content objects. ### 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 payloadCreateResponse of client.contentScanning.payloads.create({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', body: [{ payload: 'lookup_json_string(http.request.body.raw, "file")' }], })) { console.log(payloadCreateResponse.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 `client.contentScanning.payloads.delete(stringexpressionId, PayloadDeleteParamsparams, RequestOptionsoptions?): SinglePage` **delete** `/zones/{zone_id}/content-upload-scan/payloads/{expression_id}` Delete a Content Scan Custom Expression. ### Parameters - `expressionId: string` defines the unique ID for this custom scan expression. - `params: PayloadDeleteParams` - `zone_id: string` Defines an identifier. ### Returns - `PayloadDeleteResponse` Defines a custom scan expression to match Content Scanning on. - `id?: string` defines the unique ID for this custom scan expression. - `payload?: string` Defines the ruleset expression to use in matching content objects. ### 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 payloadDeleteResponse of client.contentScanning.payloads.delete( 'a350a054caa840c9becd89c3b4f0195b', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, )) { console.log(payloadDeleteResponse.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 - `PayloadListResponse` Defines a custom scan expression to match Content Scanning on. - `id?: string` defines the unique ID for this custom scan expression. - `payload?: string` Defines the ruleset expression to use in matching content objects. ### Payload Create Response - `PayloadCreateResponse` Defines a custom scan expression to match Content Scanning on. - `id?: string` defines the unique ID for this custom scan expression. - `payload?: string` Defines the ruleset expression to use in matching content objects. ### Payload Delete Response - `PayloadDeleteResponse` Defines a custom scan expression to match Content Scanning on. - `id?: string` defines the unique ID for this custom scan expression. - `payload?: string` Defines the ruleset expression to use in matching content objects. # Settings ## Get Content Scanning Status `client.contentScanning.settings.get(SettingGetParamsparams, RequestOptionsoptions?): SettingGetResponse` **get** `/zones/{zone_id}/content-upload-scan/settings` Retrieve the current status of Content Scanning. ### Parameters - `params: SettingGetParams` - `zone_id: string` Defines an identifier. ### Returns - `SettingGetResponse` Defines the status for Content Scanning. - `modified?: string` Defines the last modification date (ISO 8601) of the Content Scanning status. - `value?: string` Defines the status of Content Scanning. ### 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 setting = await client.contentScanning.settings.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(setting.modified); ``` #### 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": { "modified": "2024-12-02T09:57:23.150259Z", "value": "enabled" }, "success": true } ``` ## Domain Types ### Setting Get Response - `SettingGetResponse` Defines the status for Content Scanning. - `modified?: string` Defines the last modification date (ISO 8601) of the Content Scanning status. - `value?: string` Defines the status of Content Scanning.