# Vulnerability Scanner # Credential Sets ## List Credential Sets `client.vulnerabilityScanner.credentialSets.list(CredentialSetListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/vuln_scanner/credential_sets` Returns all credential sets for the account. ### Parameters - `params: CredentialSetListParams` - `account_id: string` Path param: Identifier. - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Number of results per page. ### Returns - `CredentialSetListResponse` - `id: string` Credential set identifier. - `name: string` Human-readable name. ### 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 credentialSetListResponse of client.vulnerabilityScanner.credentialSets.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(credentialSetListResponse.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": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "name": "Production API credentials" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Create Credential Set `client.vulnerabilityScanner.credentialSets.create(CredentialSetCreateParamsparams, RequestOptionsoptions?): CredentialSetCreateResponse` **post** `/accounts/{account_id}/vuln_scanner/credential_sets` Creates a new credential set. ### Parameters - `params: CredentialSetCreateParams` - `account_id: string` Path param: Identifier. - `name: string` Body param: Human-readable name. ### Returns - `CredentialSetCreateResponse` - `id: string` Credential set identifier. - `name: string` Human-readable name. ### 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 credentialSet = await client.vulnerabilityScanner.credentialSets.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'Production API credentials', }); console.log(credentialSet.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "name": "Production API credentials" }, "result_info": {} } ``` ## Get Credential Set `client.vulnerabilityScanner.credentialSets.get(stringcredentialSetId, CredentialSetGetParamsparams, RequestOptionsoptions?): CredentialSetGetResponse` **get** `/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}` Returns a single credential set by ID. ### Parameters - `credentialSetId: string` - `params: CredentialSetGetParams` - `account_id: string` Identifier. ### Returns - `CredentialSetGetResponse` - `id: string` Credential set identifier. - `name: string` Human-readable name. ### 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 credentialSet = await client.vulnerabilityScanner.credentialSets.get( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(credentialSet.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "name": "Production API credentials" }, "result_info": {} } ``` ## Update Credential Set `client.vulnerabilityScanner.credentialSets.update(stringcredentialSetId, CredentialSetUpdateParamsparams, RequestOptionsoptions?): CredentialSetUpdateResponse` **put** `/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}` Replaces a credential set. All fields must be provided. ### Parameters - `credentialSetId: string` - `params: CredentialSetUpdateParams` - `account_id: string` Path param: Identifier. - `name: string` Body param: Human-readable name. ### Returns - `CredentialSetUpdateResponse` - `id: string` Credential set identifier. - `name: string` Human-readable name. ### 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 credentialSet = await client.vulnerabilityScanner.credentialSets.update( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'Production API credentials' }, ); console.log(credentialSet.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "name": "Production API credentials" }, "result_info": {} } ``` ## Edit Credential Set `client.vulnerabilityScanner.credentialSets.edit(stringcredentialSetId, CredentialSetEditParamsparams, RequestOptionsoptions?): CredentialSetEditResponse` **patch** `/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}` Updates a credential set with only the provided fields; omitted fields remain unchanged. ### Parameters - `credentialSetId: string` - `params: CredentialSetEditParams` - `account_id: string` Path param: Identifier. - `name?: string` Body param: Human-readable name. ### Returns - `CredentialSetEditResponse` - `id: string` Credential set identifier. - `name: string` Human-readable name. ### 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.vulnerabilityScanner.credentialSets.edit( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(response.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "name": "Production API credentials" }, "result_info": {} } ``` ## Delete Credential Set `client.vulnerabilityScanner.credentialSets.delete(stringcredentialSetId, CredentialSetDeleteParamsparams, RequestOptionsoptions?): CredentialSetDeleteResponse | null` **delete** `/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}` Deletes a credential set and all of its credentials. ### Parameters - `credentialSetId: string` - `params: CredentialSetDeleteParams` - `account_id: string` Identifier. ### Returns - `CredentialSetDeleteResponse = 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 credentialSet = await client.vulnerabilityScanner.credentialSets.delete( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(credentialSet); ``` #### 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": {}, "result_info": {} } ``` ## Domain Types ### Credential Set List Response - `CredentialSetListResponse` - `id: string` Credential set identifier. - `name: string` Human-readable name. ### Credential Set Create Response - `CredentialSetCreateResponse` - `id: string` Credential set identifier. - `name: string` Human-readable name. ### Credential Set Get Response - `CredentialSetGetResponse` - `id: string` Credential set identifier. - `name: string` Human-readable name. ### Credential Set Update Response - `CredentialSetUpdateResponse` - `id: string` Credential set identifier. - `name: string` Human-readable name. ### Credential Set Edit Response - `CredentialSetEditResponse` - `id: string` Credential set identifier. - `name: string` Human-readable name. ### Credential Set Delete Response - `CredentialSetDeleteResponse = unknown` # Credentials ## List Credentials `client.vulnerabilityScanner.credentialSets.credentials.list(stringcredentialSetId, CredentialListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials` Returns all credentials within a credential set. ### Parameters - `credentialSetId: string` - `params: CredentialListParams` - `account_id: string` Path param: Identifier. - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Number of results per page. ### Returns - `CredentialListResponse` A credential attached to API requests during scanning. The credential `value` is write-only and never returned in responses. - `id: string` Credential identifier. - `credential_set_id: string` Parent credential set identifier. - `location: "header" | "cookie"` Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Name of the header or cookie where the credential is attached. - `name: string` Human-readable name. ### 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 credentialListResponse of client.vulnerabilityScanner.credentialSets.credentials.list( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, )) { console.log(credentialListResponse.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": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "credential_set_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "location": "header", "location_name": "Authorization", "name": "Admin API key" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Create Credential `client.vulnerabilityScanner.credentialSets.credentials.create(stringcredentialSetId, CredentialCreateParamsparams, RequestOptionsoptions?): CredentialCreateResponse` **post** `/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials` Creates a new credential within a credential set. ### Parameters - `credentialSetId: string` - `params: CredentialCreateParams` - `account_id: string` Path param: Identifier. - `location: "header" | "cookie"` Body param: Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Body param: Name of the header or cookie where the credential is attached. - `name: string` Body param: Human-readable name. - `value: string` Body param: The credential value (e.g. API key, session token). Write-only. Never returned in responses. ### Returns - `CredentialCreateResponse` A credential attached to API requests during scanning. The credential `value` is write-only and never returned in responses. - `id: string` Credential identifier. - `credential_set_id: string` Parent credential set identifier. - `location: "header" | "cookie"` Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Name of the header or cookie where the credential is attached. - `name: string` Human-readable name. ### 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 credential = await client.vulnerabilityScanner.credentialSets.credentials.create( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', location: 'header', location_name: 'Authorization', name: 'Admin API key', value: 'Bearer EXAMPLE_TOKEN', }, ); console.log(credential.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "credential_set_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "location": "header", "location_name": "Authorization", "name": "Admin API key" }, "result_info": {} } ``` ## Get Credential `client.vulnerabilityScanner.credentialSets.credentials.get(stringcredentialSetId, stringcredentialId, CredentialGetParamsparams, RequestOptionsoptions?): CredentialGetResponse` **get** `/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}` Returns a single credential by ID. ### Parameters - `credentialSetId: string` - `credentialId: string` - `params: CredentialGetParams` - `account_id: string` Identifier. ### Returns - `CredentialGetResponse` A credential attached to API requests during scanning. The credential `value` is write-only and never returned in responses. - `id: string` Credential identifier. - `credential_set_id: string` Parent credential set identifier. - `location: "header" | "cookie"` Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Name of the header or cookie where the credential is attached. - `name: string` Human-readable name. ### 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 credential = await client.vulnerabilityScanner.credentialSets.credentials.get( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(credential.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "credential_set_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "location": "header", "location_name": "Authorization", "name": "Admin API key" }, "result_info": {} } ``` ## Update Credential `client.vulnerabilityScanner.credentialSets.credentials.update(stringcredentialSetId, stringcredentialId, CredentialUpdateParamsparams, RequestOptionsoptions?): CredentialUpdateResponse` **put** `/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}` Replaces a credential. All fields must be provided. ### Parameters - `credentialSetId: string` - `credentialId: string` - `params: CredentialUpdateParams` - `account_id: string` Path param: Identifier. - `location: "header" | "cookie"` Body param: Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Body param: Name of the header or cookie where the credential is attached. - `name: string` Body param: Human-readable name. - `value: string` Body param: The credential value. Write-only. Never returned in responses. ### Returns - `CredentialUpdateResponse` A credential attached to API requests during scanning. The credential `value` is write-only and never returned in responses. - `id: string` Credential identifier. - `credential_set_id: string` Parent credential set identifier. - `location: "header" | "cookie"` Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Name of the header or cookie where the credential is attached. - `name: string` Human-readable name. ### 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 credential = await client.vulnerabilityScanner.credentialSets.credentials.update( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', location: 'header', location_name: 'Authorization', name: 'Admin API key', value: 'Bearer EXAMPLE_TOKEN', }, ); console.log(credential.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "credential_set_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "location": "header", "location_name": "Authorization", "name": "Admin API key" }, "result_info": {} } ``` ## Edit Credential `client.vulnerabilityScanner.credentialSets.credentials.edit(stringcredentialSetId, stringcredentialId, CredentialEditParamsparams, RequestOptionsoptions?): CredentialEditResponse` **patch** `/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}` Updates a credential with only the provided fields; omitted fields remain unchanged. ### Parameters - `credentialSetId: string` - `credentialId: string` - `params: CredentialEditParams` - `account_id: string` Path param: Identifier. - `location?: "header" | "cookie"` Body param: Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name?: string` Body param: Name of the header or cookie where the credential is attached. - `name?: string` Body param: Human-readable name. - `value?: string` Body param: The credential value. Write-only. Never returned in responses. ### Returns - `CredentialEditResponse` A credential attached to API requests during scanning. The credential `value` is write-only and never returned in responses. - `id: string` Credential identifier. - `credential_set_id: string` Parent credential set identifier. - `location: "header" | "cookie"` Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Name of the header or cookie where the credential is attached. - `name: string` Human-readable name. ### 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.vulnerabilityScanner.credentialSets.credentials.edit( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(response.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "credential_set_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "location": "header", "location_name": "Authorization", "name": "Admin API key" }, "result_info": {} } ``` ## Delete Credential `client.vulnerabilityScanner.credentialSets.credentials.delete(stringcredentialSetId, stringcredentialId, CredentialDeleteParamsparams, RequestOptionsoptions?): CredentialDeleteResponse | null` **delete** `/accounts/{account_id}/vuln_scanner/credential_sets/{credential_set_id}/credentials/{credential_id}` Deletes a credential. ### Parameters - `credentialSetId: string` - `credentialId: string` - `params: CredentialDeleteParams` - `account_id: string` Identifier. ### Returns - `CredentialDeleteResponse = 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 credential = await client.vulnerabilityScanner.credentialSets.credentials.delete( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(credential); ``` #### 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": {}, "result_info": {} } ``` ## Domain Types ### Credential List Response - `CredentialListResponse` A credential attached to API requests during scanning. The credential `value` is write-only and never returned in responses. - `id: string` Credential identifier. - `credential_set_id: string` Parent credential set identifier. - `location: "header" | "cookie"` Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Name of the header or cookie where the credential is attached. - `name: string` Human-readable name. ### Credential Create Response - `CredentialCreateResponse` A credential attached to API requests during scanning. The credential `value` is write-only and never returned in responses. - `id: string` Credential identifier. - `credential_set_id: string` Parent credential set identifier. - `location: "header" | "cookie"` Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Name of the header or cookie where the credential is attached. - `name: string` Human-readable name. ### Credential Get Response - `CredentialGetResponse` A credential attached to API requests during scanning. The credential `value` is write-only and never returned in responses. - `id: string` Credential identifier. - `credential_set_id: string` Parent credential set identifier. - `location: "header" | "cookie"` Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Name of the header or cookie where the credential is attached. - `name: string` Human-readable name. ### Credential Update Response - `CredentialUpdateResponse` A credential attached to API requests during scanning. The credential `value` is write-only and never returned in responses. - `id: string` Credential identifier. - `credential_set_id: string` Parent credential set identifier. - `location: "header" | "cookie"` Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Name of the header or cookie where the credential is attached. - `name: string` Human-readable name. ### Credential Edit Response - `CredentialEditResponse` A credential attached to API requests during scanning. The credential `value` is write-only and never returned in responses. - `id: string` Credential identifier. - `credential_set_id: string` Parent credential set identifier. - `location: "header" | "cookie"` Where the credential is attached in outgoing requests. - `"header"` - `"cookie"` - `location_name: string` Name of the header or cookie where the credential is attached. - `name: string` Human-readable name. ### Credential Delete Response - `CredentialDeleteResponse = unknown` # Scans ## List Scans `client.vulnerabilityScanner.scans.list(ScanListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/vuln_scanner/scans` Returns all scans for the account. ### Parameters - `params: ScanListParams` - `account_id: string` Path param: Identifier. - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Number of results per page. ### Returns - `ScanListResponse` - `id: string` Scan identifier. - `scan_type: "bola"` The type of vulnerability scan. - `"bola"` - `status: "created" | "scheduled" | "planning" | 3 more` Current lifecycle status of the scan. - `"created"` - `"scheduled"` - `"planning"` - `"running"` - `"finished"` - `"failed"` - `target_environment_id: string` The target environment this scan runs against. - `report?: Report | null` Vulnerability report produced after the scan completes. The shape depends on the scan type. Present only for finished scans. - `report: Report` Version 1 of the BOLA vulnerability scan report. - `summary: Summary` Summary of all steps and findings. - `verdict: "ok" | "warning" | "inconclusive"` Overall verdict of the vulnerability scan. - `"ok"` - `"warning"` - `"inconclusive"` - `tests: Array` List of tests that were run. - `steps: Array` Steps that were executed. - `assertions: Array` Assertions that were made against the received response. - `description: string` Human-readable description of the assertion, explaining what was checked. - `kind: Kind` Kind of assertion. - `parameters: Parameters` Range of HTTP status codes. - `max: number` Maximum (inclusive) status code of the range. - `min: number` Minimum (inclusive) status code of the range. - `type: "http_status_within_range"` - `"http_status_within_range"` - `observed: number | null` Observed value on which the assertion was made. - `outcome: "ok" | "fail" | "inconclusive"` Outcome of the assertion. - `"ok"` - `"fail"` - `"inconclusive"` - `errors?: Array` Errors the step encountered that may explain absent or incomplete fields. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `request?: Request | null` HTTP request that was made, if any. - `credential_set: CredentialSet` Credential set that was used. - `id: string` ID of the credential set. - `role: "owner" | "attacker"` Role of the credential set. - `"owner"` - `"attacker"` - `header_names: Array` Names of headers that were sent. - `method: "GET" | "DELETE" | "PATCH" | 2 more` HTTP method. - `"GET"` - `"DELETE"` - `"PATCH"` - `"POST"` - `"PUT"` - `url: string` Exact and full URL (including host, query parameters) that was requested. - `variable_captures: Array` Variable captures requested for this step. - `json_path: string` JSONPath expression used for capture, e.g. `"$.id"`. - `name: string` Variable name, e.g. `"resource_id"`. - `body?: unknown` Request body, if any. - `response?: Response | null` HTTP response that was received, if any. - `body: VulnScannerBOLABodyResponseNotFound | VulnScannerBOLABodyResponseBytes | VulnScannerBOLABodyResponseText | VulnScannerBOLABodyResponseJson` HTTP response body. - `VulnScannerBOLABodyResponseNotFound` No body was received. - `kind: "not_found"` - `"not_found"` - `VulnScannerBOLABodyResponseBytes` Body received but unable to read as UTF-8. Raw bytes, base64-encoded. - `contents: string` - `kind: "bytes"` - `"bytes"` - `truncated: boolean` - `VulnScannerBOLABodyResponseText` Body received as valid UTF-8 text but not valid JSON. - `contents: string` - `kind: "text"` - `"text"` - `truncated: boolean` - `VulnScannerBOLABodyResponseJson` Body received as valid JSON. - `contents: string` - `kind: "json"` - `"json"` - `truncated: boolean` - `header_names: Array` Names of headers that were received. - `status: number` HTTP status code. - `status_text?: string | null` HTTP status text, if available for the status code. - `verdict: "ok" | "warning" | "inconclusive"` Verdict of this single test. - `"ok"` - `"warning"` - `"inconclusive"` - `preflight_errors?: Array` Errors that prevented step execution. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `report_schema_version: "v1"` Version of the report schema. - `"v1"` ### 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 scanListResponse of client.vulnerabilityScanner.scans.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(scanListResponse.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": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "scan_type": "bola", "status": "created", "target_environment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "report": { "report": { "summary": { "verdict": "ok" }, "tests": [ { "steps": [ { "assertions": [ { "description": "description", "kind": { "parameters": { "max": 0, "min": 0 }, "type": "http_status_within_range" }, "observed": 0, "outcome": "ok" } ], "errors": [ { "description": "description", "error_code": 0 } ], "request": { "credential_set": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "role": "owner" }, "header_names": [ "string" ], "method": "GET", "url": "https://example.com", "variable_captures": [ { "json_path": "json_path", "name": "name" } ], "body": {} }, "response": { "body": { "kind": "not_found" }, "header_names": [ "string" ], "status": 0, "status_text": "status_text" } } ], "verdict": "ok", "preflight_errors": [ { "description": "description", "error_code": 0 } ] } ] }, "report_schema_version": "v1" } } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Create Scan `client.vulnerabilityScanner.scans.create(ScanCreateParamsparams, RequestOptionsoptions?): ScanCreateResponse` **post** `/accounts/{account_id}/vuln_scanner/scans` Creates and starts a new vulnerability scan. The response may include non-fatal warnings in the `messages` array. ### Parameters - `params: ScanCreateParams` - `account_id: string` Path param: Identifier. - `credential_sets: CredentialSets` Body param: Credential set references for a BOLA scan. The scanner uses the `owner` credentials for legitimate requests and the `attacker` credentials to attempt unauthorized access. - `attacker: string` Credential set ID for the attacker. - `owner: string` Credential set ID for the resource owner. - `open_api: string` Body param: OpenAPI schema definition for the API under test. The scanner uses this to discover endpoints and construct requests. - `scan_type: "bola"` Body param - `"bola"` - `target_environment_id: string` Body param: The target environment to scan. ### Returns - `ScanCreateResponse` - `id: string` Scan identifier. - `scan_type: "bola"` The type of vulnerability scan. - `"bola"` - `status: "created" | "scheduled" | "planning" | 3 more` Current lifecycle status of the scan. - `"created"` - `"scheduled"` - `"planning"` - `"running"` - `"finished"` - `"failed"` - `target_environment_id: string` The target environment this scan runs against. - `report?: Report | null` Vulnerability report produced after the scan completes. The shape depends on the scan type. Present only for finished scans. - `report: Report` Version 1 of the BOLA vulnerability scan report. - `summary: Summary` Summary of all steps and findings. - `verdict: "ok" | "warning" | "inconclusive"` Overall verdict of the vulnerability scan. - `"ok"` - `"warning"` - `"inconclusive"` - `tests: Array` List of tests that were run. - `steps: Array` Steps that were executed. - `assertions: Array` Assertions that were made against the received response. - `description: string` Human-readable description of the assertion, explaining what was checked. - `kind: Kind` Kind of assertion. - `parameters: Parameters` Range of HTTP status codes. - `max: number` Maximum (inclusive) status code of the range. - `min: number` Minimum (inclusive) status code of the range. - `type: "http_status_within_range"` - `"http_status_within_range"` - `observed: number | null` Observed value on which the assertion was made. - `outcome: "ok" | "fail" | "inconclusive"` Outcome of the assertion. - `"ok"` - `"fail"` - `"inconclusive"` - `errors?: Array` Errors the step encountered that may explain absent or incomplete fields. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `request?: Request | null` HTTP request that was made, if any. - `credential_set: CredentialSet` Credential set that was used. - `id: string` ID of the credential set. - `role: "owner" | "attacker"` Role of the credential set. - `"owner"` - `"attacker"` - `header_names: Array` Names of headers that were sent. - `method: "GET" | "DELETE" | "PATCH" | 2 more` HTTP method. - `"GET"` - `"DELETE"` - `"PATCH"` - `"POST"` - `"PUT"` - `url: string` Exact and full URL (including host, query parameters) that was requested. - `variable_captures: Array` Variable captures requested for this step. - `json_path: string` JSONPath expression used for capture, e.g. `"$.id"`. - `name: string` Variable name, e.g. `"resource_id"`. - `body?: unknown` Request body, if any. - `response?: Response | null` HTTP response that was received, if any. - `body: VulnScannerBOLABodyResponseNotFound | VulnScannerBOLABodyResponseBytes | VulnScannerBOLABodyResponseText | VulnScannerBOLABodyResponseJson` HTTP response body. - `VulnScannerBOLABodyResponseNotFound` No body was received. - `kind: "not_found"` - `"not_found"` - `VulnScannerBOLABodyResponseBytes` Body received but unable to read as UTF-8. Raw bytes, base64-encoded. - `contents: string` - `kind: "bytes"` - `"bytes"` - `truncated: boolean` - `VulnScannerBOLABodyResponseText` Body received as valid UTF-8 text but not valid JSON. - `contents: string` - `kind: "text"` - `"text"` - `truncated: boolean` - `VulnScannerBOLABodyResponseJson` Body received as valid JSON. - `contents: string` - `kind: "json"` - `"json"` - `truncated: boolean` - `header_names: Array` Names of headers that were received. - `status: number` HTTP status code. - `status_text?: string | null` HTTP status text, if available for the status code. - `verdict: "ok" | "warning" | "inconclusive"` Verdict of this single test. - `"ok"` - `"warning"` - `"inconclusive"` - `preflight_errors?: Array` Errors that prevented step execution. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `report_schema_version: "v1"` Version of the report schema. - `"v1"` ### 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 scan = await client.vulnerabilityScanner.scans.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', credential_sets: { attacker: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', owner: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }, open_api: 'open_api', scan_type: 'bola', target_environment_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); console.log(scan.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "scan_type": "bola", "status": "created", "target_environment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "report": { "report": { "summary": { "verdict": "ok" }, "tests": [ { "steps": [ { "assertions": [ { "description": "description", "kind": { "parameters": { "max": 0, "min": 0 }, "type": "http_status_within_range" }, "observed": 0, "outcome": "ok" } ], "errors": [ { "description": "description", "error_code": 0 } ], "request": { "credential_set": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "role": "owner" }, "header_names": [ "string" ], "method": "GET", "url": "https://example.com", "variable_captures": [ { "json_path": "json_path", "name": "name" } ], "body": {} }, "response": { "body": { "kind": "not_found" }, "header_names": [ "string" ], "status": 0, "status_text": "status_text" } } ], "verdict": "ok", "preflight_errors": [ { "description": "description", "error_code": 0 } ] } ] }, "report_schema_version": "v1" } }, "result_info": {} } ``` ## Get Scan `client.vulnerabilityScanner.scans.get(stringscanId, ScanGetParamsparams, RequestOptionsoptions?): ScanGetResponse` **get** `/accounts/{account_id}/vuln_scanner/scans/{scan_id}` Returns a single scan by ID. ### Parameters - `scanId: string` - `params: ScanGetParams` - `account_id: string` Identifier. ### Returns - `ScanGetResponse` - `id: string` Scan identifier. - `scan_type: "bola"` The type of vulnerability scan. - `"bola"` - `status: "created" | "scheduled" | "planning" | 3 more` Current lifecycle status of the scan. - `"created"` - `"scheduled"` - `"planning"` - `"running"` - `"finished"` - `"failed"` - `target_environment_id: string` The target environment this scan runs against. - `report?: Report | null` Vulnerability report produced after the scan completes. The shape depends on the scan type. Present only for finished scans. - `report: Report` Version 1 of the BOLA vulnerability scan report. - `summary: Summary` Summary of all steps and findings. - `verdict: "ok" | "warning" | "inconclusive"` Overall verdict of the vulnerability scan. - `"ok"` - `"warning"` - `"inconclusive"` - `tests: Array` List of tests that were run. - `steps: Array` Steps that were executed. - `assertions: Array` Assertions that were made against the received response. - `description: string` Human-readable description of the assertion, explaining what was checked. - `kind: Kind` Kind of assertion. - `parameters: Parameters` Range of HTTP status codes. - `max: number` Maximum (inclusive) status code of the range. - `min: number` Minimum (inclusive) status code of the range. - `type: "http_status_within_range"` - `"http_status_within_range"` - `observed: number | null` Observed value on which the assertion was made. - `outcome: "ok" | "fail" | "inconclusive"` Outcome of the assertion. - `"ok"` - `"fail"` - `"inconclusive"` - `errors?: Array` Errors the step encountered that may explain absent or incomplete fields. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `request?: Request | null` HTTP request that was made, if any. - `credential_set: CredentialSet` Credential set that was used. - `id: string` ID of the credential set. - `role: "owner" | "attacker"` Role of the credential set. - `"owner"` - `"attacker"` - `header_names: Array` Names of headers that were sent. - `method: "GET" | "DELETE" | "PATCH" | 2 more` HTTP method. - `"GET"` - `"DELETE"` - `"PATCH"` - `"POST"` - `"PUT"` - `url: string` Exact and full URL (including host, query parameters) that was requested. - `variable_captures: Array` Variable captures requested for this step. - `json_path: string` JSONPath expression used for capture, e.g. `"$.id"`. - `name: string` Variable name, e.g. `"resource_id"`. - `body?: unknown` Request body, if any. - `response?: Response | null` HTTP response that was received, if any. - `body: VulnScannerBOLABodyResponseNotFound | VulnScannerBOLABodyResponseBytes | VulnScannerBOLABodyResponseText | VulnScannerBOLABodyResponseJson` HTTP response body. - `VulnScannerBOLABodyResponseNotFound` No body was received. - `kind: "not_found"` - `"not_found"` - `VulnScannerBOLABodyResponseBytes` Body received but unable to read as UTF-8. Raw bytes, base64-encoded. - `contents: string` - `kind: "bytes"` - `"bytes"` - `truncated: boolean` - `VulnScannerBOLABodyResponseText` Body received as valid UTF-8 text but not valid JSON. - `contents: string` - `kind: "text"` - `"text"` - `truncated: boolean` - `VulnScannerBOLABodyResponseJson` Body received as valid JSON. - `contents: string` - `kind: "json"` - `"json"` - `truncated: boolean` - `header_names: Array` Names of headers that were received. - `status: number` HTTP status code. - `status_text?: string | null` HTTP status text, if available for the status code. - `verdict: "ok" | "warning" | "inconclusive"` Verdict of this single test. - `"ok"` - `"warning"` - `"inconclusive"` - `preflight_errors?: Array` Errors that prevented step execution. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `report_schema_version: "v1"` Version of the report schema. - `"v1"` ### 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 scan = await client.vulnerabilityScanner.scans.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(scan.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "scan_type": "bola", "status": "created", "target_environment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "report": { "report": { "summary": { "verdict": "ok" }, "tests": [ { "steps": [ { "assertions": [ { "description": "description", "kind": { "parameters": { "max": 0, "min": 0 }, "type": "http_status_within_range" }, "observed": 0, "outcome": "ok" } ], "errors": [ { "description": "description", "error_code": 0 } ], "request": { "credential_set": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "role": "owner" }, "header_names": [ "string" ], "method": "GET", "url": "https://example.com", "variable_captures": [ { "json_path": "json_path", "name": "name" } ], "body": {} }, "response": { "body": { "kind": "not_found" }, "header_names": [ "string" ], "status": 0, "status_text": "status_text" } } ], "verdict": "ok", "preflight_errors": [ { "description": "description", "error_code": 0 } ] } ] }, "report_schema_version": "v1" } }, "result_info": {} } ``` ## Domain Types ### Scan List Response - `ScanListResponse` - `id: string` Scan identifier. - `scan_type: "bola"` The type of vulnerability scan. - `"bola"` - `status: "created" | "scheduled" | "planning" | 3 more` Current lifecycle status of the scan. - `"created"` - `"scheduled"` - `"planning"` - `"running"` - `"finished"` - `"failed"` - `target_environment_id: string` The target environment this scan runs against. - `report?: Report | null` Vulnerability report produced after the scan completes. The shape depends on the scan type. Present only for finished scans. - `report: Report` Version 1 of the BOLA vulnerability scan report. - `summary: Summary` Summary of all steps and findings. - `verdict: "ok" | "warning" | "inconclusive"` Overall verdict of the vulnerability scan. - `"ok"` - `"warning"` - `"inconclusive"` - `tests: Array` List of tests that were run. - `steps: Array` Steps that were executed. - `assertions: Array` Assertions that were made against the received response. - `description: string` Human-readable description of the assertion, explaining what was checked. - `kind: Kind` Kind of assertion. - `parameters: Parameters` Range of HTTP status codes. - `max: number` Maximum (inclusive) status code of the range. - `min: number` Minimum (inclusive) status code of the range. - `type: "http_status_within_range"` - `"http_status_within_range"` - `observed: number | null` Observed value on which the assertion was made. - `outcome: "ok" | "fail" | "inconclusive"` Outcome of the assertion. - `"ok"` - `"fail"` - `"inconclusive"` - `errors?: Array` Errors the step encountered that may explain absent or incomplete fields. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `request?: Request | null` HTTP request that was made, if any. - `credential_set: CredentialSet` Credential set that was used. - `id: string` ID of the credential set. - `role: "owner" | "attacker"` Role of the credential set. - `"owner"` - `"attacker"` - `header_names: Array` Names of headers that were sent. - `method: "GET" | "DELETE" | "PATCH" | 2 more` HTTP method. - `"GET"` - `"DELETE"` - `"PATCH"` - `"POST"` - `"PUT"` - `url: string` Exact and full URL (including host, query parameters) that was requested. - `variable_captures: Array` Variable captures requested for this step. - `json_path: string` JSONPath expression used for capture, e.g. `"$.id"`. - `name: string` Variable name, e.g. `"resource_id"`. - `body?: unknown` Request body, if any. - `response?: Response | null` HTTP response that was received, if any. - `body: VulnScannerBOLABodyResponseNotFound | VulnScannerBOLABodyResponseBytes | VulnScannerBOLABodyResponseText | VulnScannerBOLABodyResponseJson` HTTP response body. - `VulnScannerBOLABodyResponseNotFound` No body was received. - `kind: "not_found"` - `"not_found"` - `VulnScannerBOLABodyResponseBytes` Body received but unable to read as UTF-8. Raw bytes, base64-encoded. - `contents: string` - `kind: "bytes"` - `"bytes"` - `truncated: boolean` - `VulnScannerBOLABodyResponseText` Body received as valid UTF-8 text but not valid JSON. - `contents: string` - `kind: "text"` - `"text"` - `truncated: boolean` - `VulnScannerBOLABodyResponseJson` Body received as valid JSON. - `contents: string` - `kind: "json"` - `"json"` - `truncated: boolean` - `header_names: Array` Names of headers that were received. - `status: number` HTTP status code. - `status_text?: string | null` HTTP status text, if available for the status code. - `verdict: "ok" | "warning" | "inconclusive"` Verdict of this single test. - `"ok"` - `"warning"` - `"inconclusive"` - `preflight_errors?: Array` Errors that prevented step execution. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `report_schema_version: "v1"` Version of the report schema. - `"v1"` ### Scan Create Response - `ScanCreateResponse` - `id: string` Scan identifier. - `scan_type: "bola"` The type of vulnerability scan. - `"bola"` - `status: "created" | "scheduled" | "planning" | 3 more` Current lifecycle status of the scan. - `"created"` - `"scheduled"` - `"planning"` - `"running"` - `"finished"` - `"failed"` - `target_environment_id: string` The target environment this scan runs against. - `report?: Report | null` Vulnerability report produced after the scan completes. The shape depends on the scan type. Present only for finished scans. - `report: Report` Version 1 of the BOLA vulnerability scan report. - `summary: Summary` Summary of all steps and findings. - `verdict: "ok" | "warning" | "inconclusive"` Overall verdict of the vulnerability scan. - `"ok"` - `"warning"` - `"inconclusive"` - `tests: Array` List of tests that were run. - `steps: Array` Steps that were executed. - `assertions: Array` Assertions that were made against the received response. - `description: string` Human-readable description of the assertion, explaining what was checked. - `kind: Kind` Kind of assertion. - `parameters: Parameters` Range of HTTP status codes. - `max: number` Maximum (inclusive) status code of the range. - `min: number` Minimum (inclusive) status code of the range. - `type: "http_status_within_range"` - `"http_status_within_range"` - `observed: number | null` Observed value on which the assertion was made. - `outcome: "ok" | "fail" | "inconclusive"` Outcome of the assertion. - `"ok"` - `"fail"` - `"inconclusive"` - `errors?: Array` Errors the step encountered that may explain absent or incomplete fields. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `request?: Request | null` HTTP request that was made, if any. - `credential_set: CredentialSet` Credential set that was used. - `id: string` ID of the credential set. - `role: "owner" | "attacker"` Role of the credential set. - `"owner"` - `"attacker"` - `header_names: Array` Names of headers that were sent. - `method: "GET" | "DELETE" | "PATCH" | 2 more` HTTP method. - `"GET"` - `"DELETE"` - `"PATCH"` - `"POST"` - `"PUT"` - `url: string` Exact and full URL (including host, query parameters) that was requested. - `variable_captures: Array` Variable captures requested for this step. - `json_path: string` JSONPath expression used for capture, e.g. `"$.id"`. - `name: string` Variable name, e.g. `"resource_id"`. - `body?: unknown` Request body, if any. - `response?: Response | null` HTTP response that was received, if any. - `body: VulnScannerBOLABodyResponseNotFound | VulnScannerBOLABodyResponseBytes | VulnScannerBOLABodyResponseText | VulnScannerBOLABodyResponseJson` HTTP response body. - `VulnScannerBOLABodyResponseNotFound` No body was received. - `kind: "not_found"` - `"not_found"` - `VulnScannerBOLABodyResponseBytes` Body received but unable to read as UTF-8. Raw bytes, base64-encoded. - `contents: string` - `kind: "bytes"` - `"bytes"` - `truncated: boolean` - `VulnScannerBOLABodyResponseText` Body received as valid UTF-8 text but not valid JSON. - `contents: string` - `kind: "text"` - `"text"` - `truncated: boolean` - `VulnScannerBOLABodyResponseJson` Body received as valid JSON. - `contents: string` - `kind: "json"` - `"json"` - `truncated: boolean` - `header_names: Array` Names of headers that were received. - `status: number` HTTP status code. - `status_text?: string | null` HTTP status text, if available for the status code. - `verdict: "ok" | "warning" | "inconclusive"` Verdict of this single test. - `"ok"` - `"warning"` - `"inconclusive"` - `preflight_errors?: Array` Errors that prevented step execution. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `report_schema_version: "v1"` Version of the report schema. - `"v1"` ### Scan Get Response - `ScanGetResponse` - `id: string` Scan identifier. - `scan_type: "bola"` The type of vulnerability scan. - `"bola"` - `status: "created" | "scheduled" | "planning" | 3 more` Current lifecycle status of the scan. - `"created"` - `"scheduled"` - `"planning"` - `"running"` - `"finished"` - `"failed"` - `target_environment_id: string` The target environment this scan runs against. - `report?: Report | null` Vulnerability report produced after the scan completes. The shape depends on the scan type. Present only for finished scans. - `report: Report` Version 1 of the BOLA vulnerability scan report. - `summary: Summary` Summary of all steps and findings. - `verdict: "ok" | "warning" | "inconclusive"` Overall verdict of the vulnerability scan. - `"ok"` - `"warning"` - `"inconclusive"` - `tests: Array` List of tests that were run. - `steps: Array` Steps that were executed. - `assertions: Array` Assertions that were made against the received response. - `description: string` Human-readable description of the assertion, explaining what was checked. - `kind: Kind` Kind of assertion. - `parameters: Parameters` Range of HTTP status codes. - `max: number` Maximum (inclusive) status code of the range. - `min: number` Minimum (inclusive) status code of the range. - `type: "http_status_within_range"` - `"http_status_within_range"` - `observed: number | null` Observed value on which the assertion was made. - `outcome: "ok" | "fail" | "inconclusive"` Outcome of the assertion. - `"ok"` - `"fail"` - `"inconclusive"` - `errors?: Array` Errors the step encountered that may explain absent or incomplete fields. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `request?: Request | null` HTTP request that was made, if any. - `credential_set: CredentialSet` Credential set that was used. - `id: string` ID of the credential set. - `role: "owner" | "attacker"` Role of the credential set. - `"owner"` - `"attacker"` - `header_names: Array` Names of headers that were sent. - `method: "GET" | "DELETE" | "PATCH" | 2 more` HTTP method. - `"GET"` - `"DELETE"` - `"PATCH"` - `"POST"` - `"PUT"` - `url: string` Exact and full URL (including host, query parameters) that was requested. - `variable_captures: Array` Variable captures requested for this step. - `json_path: string` JSONPath expression used for capture, e.g. `"$.id"`. - `name: string` Variable name, e.g. `"resource_id"`. - `body?: unknown` Request body, if any. - `response?: Response | null` HTTP response that was received, if any. - `body: VulnScannerBOLABodyResponseNotFound | VulnScannerBOLABodyResponseBytes | VulnScannerBOLABodyResponseText | VulnScannerBOLABodyResponseJson` HTTP response body. - `VulnScannerBOLABodyResponseNotFound` No body was received. - `kind: "not_found"` - `"not_found"` - `VulnScannerBOLABodyResponseBytes` Body received but unable to read as UTF-8. Raw bytes, base64-encoded. - `contents: string` - `kind: "bytes"` - `"bytes"` - `truncated: boolean` - `VulnScannerBOLABodyResponseText` Body received as valid UTF-8 text but not valid JSON. - `contents: string` - `kind: "text"` - `"text"` - `truncated: boolean` - `VulnScannerBOLABodyResponseJson` Body received as valid JSON. - `contents: string` - `kind: "json"` - `"json"` - `truncated: boolean` - `header_names: Array` Names of headers that were received. - `status: number` HTTP status code. - `status_text?: string | null` HTTP status text, if available for the status code. - `verdict: "ok" | "warning" | "inconclusive"` Verdict of this single test. - `"ok"` - `"warning"` - `"inconclusive"` - `preflight_errors?: Array` Errors that prevented step execution. - `description: string` Human-readable error description. - `error_code?: number | null` Numeric error code identifying the class of error, if available. - `report_schema_version: "v1"` Version of the report schema. - `"v1"` # Target Environments ## List Target Environments `client.vulnerabilityScanner.targetEnvironments.list(TargetEnvironmentListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/vuln_scanner/target_environments` Returns all target environments for the account. ### Parameters - `params: TargetEnvironmentListParams` - `account_id: string` Path param: Identifier. - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Number of results per page. ### Returns - `TargetEnvironmentListResponse` - `id: string` Target environment identifier. - `name: string` Human-readable name. - `target: Target` Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Optional description providing additional context. ### 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 targetEnvironmentListResponse of client.vulnerabilityScanner.targetEnvironments.list( { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, )) { console.log(targetEnvironmentListResponse.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": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "name": "Production Zone", "target": { "type": "zone", "zone_tag": "d8e8fca2dc0f896fd7cb4cb0031ba249" }, "description": "Main production environment" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Create Target Environment `client.vulnerabilityScanner.targetEnvironments.create(TargetEnvironmentCreateParamsparams, RequestOptionsoptions?): TargetEnvironmentCreateResponse` **post** `/accounts/{account_id}/vuln_scanner/target_environments` Creates a new target environment for the account. ### Parameters - `params: TargetEnvironmentCreateParams` - `account_id: string` Path param: Identifier. - `name: string` Body param: Human-readable name. - `target: Target` Body param: Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Body param: Optional description. ### Returns - `TargetEnvironmentCreateResponse` - `id: string` Target environment identifier. - `name: string` Human-readable name. - `target: Target` Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Optional description providing additional context. ### 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 targetEnvironment = await client.vulnerabilityScanner.targetEnvironments.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'Production Zone', target: { type: 'zone', zone_tag: 'd8e8fca2dc0f896fd7cb4cb0031ba249' }, }); console.log(targetEnvironment.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "name": "Production Zone", "target": { "type": "zone", "zone_tag": "d8e8fca2dc0f896fd7cb4cb0031ba249" }, "description": "Main production environment" }, "result_info": {} } ``` ## Get Target Environment `client.vulnerabilityScanner.targetEnvironments.get(stringtargetEnvironmentId, TargetEnvironmentGetParamsparams, RequestOptionsoptions?): TargetEnvironmentGetResponse` **get** `/accounts/{account_id}/vuln_scanner/target_environments/{target_environment_id}` Returns a single target environment by ID. ### Parameters - `targetEnvironmentId: string` - `params: TargetEnvironmentGetParams` - `account_id: string` Identifier. ### Returns - `TargetEnvironmentGetResponse` - `id: string` Target environment identifier. - `name: string` Human-readable name. - `target: Target` Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Optional description providing additional context. ### 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 targetEnvironment = await client.vulnerabilityScanner.targetEnvironments.get( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(targetEnvironment.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "name": "Production Zone", "target": { "type": "zone", "zone_tag": "d8e8fca2dc0f896fd7cb4cb0031ba249" }, "description": "Main production environment" }, "result_info": {} } ``` ## Update Target Environment `client.vulnerabilityScanner.targetEnvironments.update(stringtargetEnvironmentId, TargetEnvironmentUpdateParamsparams, RequestOptionsoptions?): TargetEnvironmentUpdateResponse` **put** `/accounts/{account_id}/vuln_scanner/target_environments/{target_environment_id}` Replaces a target environment. All fields must be provided. ### Parameters - `targetEnvironmentId: string` - `params: TargetEnvironmentUpdateParams` - `account_id: string` Path param: Identifier. - `name: string` Body param: Human-readable name. - `target: Target` Body param: Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Body param: Optional description. ### Returns - `TargetEnvironmentUpdateResponse` - `id: string` Target environment identifier. - `name: string` Human-readable name. - `target: Target` Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Optional description providing additional context. ### 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 targetEnvironment = await client.vulnerabilityScanner.targetEnvironments.update( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'Production Zone', target: { type: 'zone', zone_tag: 'd8e8fca2dc0f896fd7cb4cb0031ba249' }, }, ); console.log(targetEnvironment.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "name": "Production Zone", "target": { "type": "zone", "zone_tag": "d8e8fca2dc0f896fd7cb4cb0031ba249" }, "description": "Main production environment" }, "result_info": {} } ``` ## Edit Target Environment `client.vulnerabilityScanner.targetEnvironments.edit(stringtargetEnvironmentId, TargetEnvironmentEditParamsparams, RequestOptionsoptions?): TargetEnvironmentEditResponse` **patch** `/accounts/{account_id}/vuln_scanner/target_environments/{target_environment_id}` Updates a target environment with only the provided fields; omitted fields remain unchanged. ### Parameters - `targetEnvironmentId: string` - `params: TargetEnvironmentEditParams` - `account_id: string` Path param: Identifier. - `description?: string | null` Body param: Optional description. Omit to leave unchanged, set to `null` to clear, or provide a string to update. - `name?: string` Body param: Human-readable name. - `target?: Target` Body param: Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. ### Returns - `TargetEnvironmentEditResponse` - `id: string` Target environment identifier. - `name: string` Human-readable name. - `target: Target` Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Optional description providing additional context. ### 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.vulnerabilityScanner.targetEnvironments.edit( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(response.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": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "name": "Production Zone", "target": { "type": "zone", "zone_tag": "d8e8fca2dc0f896fd7cb4cb0031ba249" }, "description": "Main production environment" }, "result_info": {} } ``` ## Delete Target Environment `client.vulnerabilityScanner.targetEnvironments.delete(stringtargetEnvironmentId, TargetEnvironmentDeleteParamsparams, RequestOptionsoptions?): TargetEnvironmentDeleteResponse | null` **delete** `/accounts/{account_id}/vuln_scanner/target_environments/{target_environment_id}` Removes a target environment. ### Parameters - `targetEnvironmentId: string` - `params: TargetEnvironmentDeleteParams` - `account_id: string` Identifier. ### Returns - `TargetEnvironmentDeleteResponse = 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 targetEnvironment = await client.vulnerabilityScanner.targetEnvironments.delete( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(targetEnvironment); ``` #### 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": {}, "result_info": {} } ``` ## Domain Types ### Target Environment List Response - `TargetEnvironmentListResponse` - `id: string` Target environment identifier. - `name: string` Human-readable name. - `target: Target` Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Optional description providing additional context. ### Target Environment Create Response - `TargetEnvironmentCreateResponse` - `id: string` Target environment identifier. - `name: string` Human-readable name. - `target: Target` Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Optional description providing additional context. ### Target Environment Get Response - `TargetEnvironmentGetResponse` - `id: string` Target environment identifier. - `name: string` Human-readable name. - `target: Target` Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Optional description providing additional context. ### Target Environment Update Response - `TargetEnvironmentUpdateResponse` - `id: string` Target environment identifier. - `name: string` Human-readable name. - `target: Target` Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Optional description providing additional context. ### Target Environment Edit Response - `TargetEnvironmentEditResponse` - `id: string` Target environment identifier. - `name: string` Human-readable name. - `target: Target` Identifies the Cloudflare asset to scan. Uses a `type` discriminator. Currently the service supports only `zone` targets. - `type: "zone"` - `"zone"` - `zone_tag: string` Cloudflare zone tag. The zone must belong to the account. - `description?: string | null` Optional description providing additional context. ### Target Environment Delete Response - `TargetEnvironmentDeleteResponse = unknown`