Skip to main content

datasets

Creates, updates, deletes, gets or lists a datasets resource.

Overview​

Namedatasets
TypeResource
Idcloudflare.zero_trust.datasets

Fields​

The following fields are returned by SELECT queries:

Dataset read successfully.

NameDatatypeDescription
idstring (uuid)
namestring
case_sensitiveboolean
columnsarray
created_atstring (date-time)
descriptionstringThe description of the dataset.
encoding_versioninteger (int32)
num_cellsinteger (int64)
secretboolean
statusstring (empty, uploading, pending, processing, failed, complete)
updated_atstring (date-time)Stores when the dataset was last updated. This includes name or description changes as well as uploads.
uploadsarray

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, dataset_id
listselectaccount_idLists all DLP datasets configured for the account, including custom word lists and EDM datasets.
createinsertaccount_id, nameCreates a new DLP (Data Loss Prevention) dataset for storing custom detection patterns. Datasets can contain exact match data, word lists, or EDM (Exact Data Match) configurations.
updatereplaceaccount_id, dataset_idUpdates the configuration of an existing DLP dataset, such as its name, description, or detection settings.
deletedeleteaccount_id, dataset_idThis deletes all versions of the dataset.
upload_versionexecaccount_id, dataset_idCreates a new version of a DLP dataset, allowing you to stage changes before activation. Used for single-column EDM and custom word lists.
upload_version_dataexecaccount_id, dataset_id, versionThis is used for single-column EDMv1 and Custom Word Lists. The EDM format can only be created in the Cloudflare dashboard. For other clients, this operation can only be used for non-secret Custom Word Lists. The body must be a UTF-8 encoded, newline (NL or CRNL) separated list of words to be matched.
dlp_datasets_define_columnsexecaccount_id, dataset_id, versionThis is used for multi-column EDMv2 datasets. The EDMv2 format can only be created in the Cloudflare dashboard. The columns in the response appear in the same order as in the request.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
dataset_idstringThe dataset ID.
versioninteger (int64)

SELECT examples​

Dataset read successfully.

SELECT
id,
name,
case_sensitive,
columns,
created_at,
description,
encoding_version,
num_cells,
secret,
status,
updated_at,
uploads
FROM cloudflare.zero_trust.datasets
WHERE account_id = '{{ account_id }}' -- required
AND dataset_id = '{{ dataset_id }}' -- required
;

INSERT examples​

Creates a new DLP (Data Loss Prevention) dataset for storing custom detection patterns. Datasets can contain exact match data, word lists, or EDM (Exact Data Match) configurations.

INSERT INTO cloudflare.zero_trust.datasets (
case_sensitive,
description,
encoding_version,
name,
secret,
account_id
)
SELECT
{{ case_sensitive }},
'{{ description }}',
{{ encoding_version }},
'{{ name }}' /* required */,
{{ secret }},
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples​

Updates the configuration of an existing DLP dataset, such as its name, description, or detection settings.

REPLACE cloudflare.zero_trust.datasets
SET
case_sensitive = {{ case_sensitive }},
description = '{{ description }}',
name = '{{ name }}'
WHERE
account_id = '{{ account_id }}' --required
AND dataset_id = '{{ dataset_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples​

This deletes all versions of the dataset.

DELETE FROM cloudflare.zero_trust.datasets
WHERE account_id = '{{ account_id }}' --required
AND dataset_id = '{{ dataset_id }}' --required
;

Lifecycle Methods​

Creates a new version of a DLP dataset, allowing you to stage changes before activation. Used for single-column EDM and custom word lists.

EXEC cloudflare.zero_trust.datasets.upload_version
@account_id='{{ account_id }}' --required,
@dataset_id='{{ dataset_id }}' --required
;