# 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`