> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/xdr-5-api/cortex-platform/dataset-management.md).

# Dataset Management

APIs for managing datasets

## Add Dataset

> Add a dataset of type \`lookup\` with the specified name and schema.> \\
>
> \
> \*\*Note:\*\* Requests time out after three minutes.> \\
>
> \
> \*\*Required license:\*\* Cortex XDR.

```json
{"openapi":"3.0.0","info":{"title":"Cortex XDR Platform APIs","version":"Cortex XDR 5.2"},"tags":[{"name":"Dataset Management","description":"APIs for managing datasets"}],"servers":[{"url":"https://api-yourfqdn"}],"paths":{"/public_api/v1/xql/add_dataset":{"post":{"tags":["Dataset Management"],"summary":"Add Dataset","description":"Add a dataset of type `lookup` with the specified name and schema.\r\n\r\n**Note:** Requests time out after three minutes.\r\n\r\n**Required license:** Cortex XDR.","operationId":"post-public_api-v1-xql-add_dataset","parameters":[{"name":"Authorization","in":"header","description":"{api_key}","required":true,"schema":{"type":"string"}},{"name":"x-xdr-auth-id","in":"header","description":"{api_key_id}","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"request_data":{"type":"object","properties":{"dataset_name":{"type":"string","description":"The designated name of the dataset."},"dataset_type":{"type":"string","description":"Dataset type. Currently only `lookup` is supported."},"dataset_schema":{"type":"object","description":"The schema of the dataset in a comma-separated list of JSON pairs where the key is the field name and the value is the field type.","additionalProperties":{"type":"string","enum":["text","number","bool","datetime"]}}},"required":["dataset_name","dataset_type","dataset_schema"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"dataset_name":{"type":"string","description":"Name of the dataset added."}}}}}}}}}}}
```

## Delete a dataset

> Delete a dataset with the specified name. The following dataset types can be deleted: Lookup, Raw, User, Snapshot, and Correlation. You can only delete a dataset with dependencies by setting \`force\` to \`true\`.> \\
>
> \
> \*\*Note:\*\*&#x20;> \\
>
> \
> -The System dataset and other protected datasets cannot be deleted.&#x20;> \
> \- Requests time out after three minutes.> \\
>
> \
> \*\*Required license:\*\* Cortex XDR.

```json
{"openapi":"3.0.0","info":{"title":"Cortex XDR Platform APIs","version":"Cortex XDR 5.2"},"tags":[{"name":"Dataset Management","description":"APIs for managing datasets"}],"servers":[{"url":"https://api-yourfqdn"}],"paths":{"/public_api/v2/xql/delete_dataset":{"post":{"tags":["Dataset Management"],"summary":"Delete a dataset","description":"Delete a dataset with the specified name. The following dataset types can be deleted: Lookup, Raw, User, Snapshot, and Correlation. You can only delete a dataset with dependencies by setting `force` to `true`.\r\n\r\n**Note:** \r\n\r\n-The System dataset and other protected datasets cannot be deleted. \r\n- Requests time out after three minutes.\r\n\r\n**Required license:** Cortex XDR.","operationId":"post-public_api-v1-xql-delete_dataset","parameters":[{"name":"Authorization","in":"header","description":"{api_key}","required":true,"schema":{"type":"string"}},{"name":"x-xdr-auth-id","in":"header","description":"{api_key_id}","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"request_data":{"type":"object","properties":{"dataset_name":{"type":"string","description":"The name of the dataset to be deleted."},"force":{"type":"boolean","description":"**Warning:** Setting this to `true` forces deletion even when there are dependencies."}},"required":["dataset_name"]}}}}}},"responses":{"200":{"description":"OK"}}}}}}
```

## Get all datasets

> Retrieve a list of all the datasets and their properties.> \\
>
> \
> \*\*Note:\*\* Requests time out after three minutes.> \\
>
> \
> \*\*Required license:\*\* Cortex XDR.

```json
{"openapi":"3.0.0","info":{"title":"Cortex XDR Platform APIs","version":"Cortex XDR 5.2"},"tags":[{"name":"Dataset Management","description":"APIs for managing datasets"}],"servers":[{"url":"https://api-yourfqdn"}],"paths":{"/public_api/v1/xql/get_datasets":{"post":{"tags":["Dataset Management"],"summary":"Get all datasets","description":"Retrieve a list of all the datasets and their properties.\r\n\r\n**Note:** Requests time out after three minutes.\r\n\r\n**Required license:** Cortex XDR.","operationId":"post-public_api-v1-xql-get_datasets","parameters":[{"name":"Authorization","in":"header","description":"{api_key}","required":true,"schema":{"type":"string"}},{"name":"x-xdr-auth-id","in":"header","description":"{api_key_id}","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"request_data":{"type":"object"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"reply":{"type":"array","items":{"type":"object","properties":{"dataset_name":{"type":"string","description":"Dataset name."},"type":{"type":"string","description":"Dataset type. Can be one of the following: `System`, `Lookup`, `Raw`, `User`, `Snapshot`, `Correlation`, `System Audit`."},"log_update_type":{"type":"string","description":"Log update type. Can be one of the following: `Logs` (event logs are updated continuously), `State` (the current state is updated periodically)."},"last_updated":{"type":"integer","description":"Integer in timestamp epoch milliseconds. When the data in the dataset was last updated."},"total_days_stored":{"type":"integer","description":"Number of dats the data is stored in the tenant, which is comprised of `hot_range` + `cold_range`."},"hot_range":{"type":"object","description":"The time period of the hot storage from the start date to the end date.","properties":{"from":{"type":"integer","description":"    Integer in timestamp epoch milliseconds."},"to":{"type":"integer","description":"Integer in timestamp epoch milliseconds."}}},"cold_range":{"type":"object","description":"The time period of the cold storage from the start date to the end date.","properties":{"from":{"type":"integer","description":"Integer in timestamp epoch milliseconds."},"to":{"type":"integer","description":"Integer in timestamp epoch milliseconds."}}},"total_size_stored":{"type":"integer","description":"Actual size of the data (in bytes) that is stored in the tenant. This number is dependent on the events stored in the hot storage. For the xdr_data dataset, where the first 31 days of storage are included with your license, the first 31 days are not included in the `total_size_stored` number."},"average_daily_size":{"type":"integer","description":"Average daily amount stored (in bytes) in the tenant. This number is dependent on the events stored in the hot storage."},"total_events":{"type":"integer","description":"Number of total events/logs that are stored in the tenant. This number is dependent on the events stored in the hot storage."},"average_event_size":{"type":"integer","description":"Average size (in bytes) of a single event in the dataset (`total_size_stored` divided by the `total_events`). This number is dependent on the events stored in the hot storage."},"ttl":{"type":"integer","description":"Time to live. Defines when lookup entries expire and are removed automatically from the lookup dataset."},"default_query_target":{"type":"boolean","description":"whether the dataset is configured to use as your default query target in XQL Search, so when you write your queries you do not need to define a dataset. Can be one of the following: `True`, `False`."}}}}}}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/xdr-5-api/cortex-platform/dataset-management.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
