Skip to content

Add Datasets API to Open API Spec #2992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-07-10 21:04:05.996363",
"spec_repo_commit": "fe6b4ea7"
"regenerated": "2025-07-11 19:02:39.937733",
"spec_repo_commit": "b659902a"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-07-10 21:04:06.013870",
"spec_repo_commit": "fe6b4ea7"
"regenerated": "2025-07-11 19:02:39.953572",
"spec_repo_commit": "b659902a"
}
}
}
256 changes: 256 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,14 @@ components:
required: true
schema:
type: string
DatasetID:
description: The ID of a defined dataset.
example: 0879ce27-29a1-481f-a12e-bc2a48ec9ae1
in: path
name: dataset_id
required: true
schema:
type: string
EntityID:
description: UUID or Entity Ref.
in: path
Expand Down Expand Up @@ -12178,6 +12186,85 @@ components:
required:
- databaseMonitoringTrigger
type: object
Dataset:
description: Dataset object.
properties:
attributes:
$ref: '#/components/schemas/DatasetAttributes'
id:
description: Unique identifier for the dataset.
example: 123e4567-e89b-12d3-a456-426614174000
type: string
type:
description: Resource type, always "dataset".
example: dataset
type: string
required:
- type
- attributes
type: object
DatasetAttributes:
description: Dataset metadata and configuration(s).
properties:
created_at:
description: Timestamp when the dataset was created.
format: date-time
nullable: true
type: string
created_by:
description: Unique ID of the user who created the dataset.
format: uuid
type: string
name:
description: Name of the dataset.
example: Security Audit Dataset
type: string
principals:
description: List of access principals, formatted as `principal_type:id`.
Principal can be 'team' or 'role'.
example:
- role:86245fce-0a4e-11f0-92bd-da7ad0900002
items:
example: role:86245fce-0a4e-11f0-92bd-da7ad0900002
type: string
type: array
product_filters:
description: List of product-specific filters.
items:
$ref: '#/components/schemas/FiltersPerProduct'
type: array
required:
- name
- product_filters
- principals
type: object
DatasetCreateRequest:
description: Create request for a dataset.
properties:
data:
$ref: '#/components/schemas/Dataset'
required:
- data
type: object
DatasetResponseMulti:
description: Response containing a list of datasets.
properties:
data:
description: The list of datasets returned in response.
items:
$ref: '#/components/schemas/Dataset'
type: array
required:
- data
type: object
DatasetResponseSingle:
description: Response containing a single dataset object.
properties:
data:
$ref: '#/components/schemas/Dataset'
required:
- data
type: object
Date:
description: Date as Unix timestamp in milliseconds.
example: 1722439510282
Expand Down Expand Up @@ -15636,6 +15723,38 @@ components:
$ref: '#/components/schemas/FastlyServiceData'
type: array
type: object
FiltersPerProduct:
description: Product-specific filters for the dataset.
properties:
filters:
description: 'Defines the list of tag-based filters used to restrict access
to telemetry data for a specific product.

These filters act as access control rules. Each filter must follow the
tag query syntax used by

Datadog (such as `@tag.key:value`), and only one tag or attribute may
be used to define the access strategy

per telemetry type.'
example:
- '@application.id:ABCD'
items:
example: '@application.id:ABCD'
type: string
type: array
product:
description: 'Name of the product the dataset is for. Possible values are
''apm'', ''rum'', ''synthetics'',

''metrics'', ''logs'', ''sd_repoinfo'', ''error_tracking'', ''cloud_cost'',
and ''ml_obs''.'
example: logs
type: string
required:
- product
- filters
type: object
Finding:
description: A single finding without the message and resource configuration.
properties:
Expand Down Expand Up @@ -47544,6 +47663,135 @@ paths:
tags:
- Dashboard Lists
x-codegen-request-body-name: body
/api/v2/datasets:
get:
description: Get all datasets that have been configured for an organization.
operationId: GetAllDatasets
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/DatasetResponseMulti'
description: OK
'403':
$ref: '#/components/responses/NotAuthorizedResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ: []
summary: Get all datasets
tags:
- Datasets
x-permission:
operator: OPEN
permissions: []
post:
description: Create a dataset with the configurations in the request.
operationId: CreateDataset
requestBody:
content:
application/json:
example:
data:
attributes:
name: Test RUM Dataset
principals:
- role:23bacb30-1c59-11f0-a596-da7ad0900002
product_filters:
- filters:
- '@application.id:application_123'
product: rum
type: dataset
schema:
$ref: '#/components/schemas/DatasetCreateRequest'
description: Dataset payload
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/DatasetResponseSingle'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/NotAuthorizedResponse'
'409':
$ref: '#/components/responses/ConflictResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ: []
summary: Create a dataset
tags:
- Datasets
x-codegen-request-body-name: body
x-permission:
operator: OPEN
permissions: []
/api/v2/datasets/{dataset_id}:
delete:
description: Deletes the dataset associated with the ID.
operationId: DeleteDataset
parameters:
- $ref: '#/components/parameters/DatasetID'
responses:
'204':
description: No Content
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/NotAuthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ: []
summary: Delete a dataset
tags:
- Datasets
x-permission:
operator: OPEN
permissions: []
get:
description: Retrieves the dataset associated with the ID.
operationId: GetDataset
parameters:
- $ref: '#/components/parameters/DatasetID'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/DatasetResponseSingle'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/NotAuthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ: []
summary: Get a single dataset by ID
tags:
- Datasets
x-permission:
operator: OPEN
permissions: []
/api/v2/deletion/data/{product}:
post:
description: Creates a data deletion request by providing a query and a timeframe
Expand Down Expand Up @@ -65102,6 +65350,14 @@ tags:
the allowed products. It's currently enabled for Logs and RUM and depends on `logs_delete_data`
and `rum_delete_data` permissions respectively.
name: Data Deletion
- description: 'Data Access Controls in Datadog is a feature that allows administrators
and access managers to regulate

access to sensitive data. By defining Restricted Datasets, you can ensure that
only specific teams or roles can

view certain types of telemetry (for example, logs, traces, metrics, and RUM data).'
name: Datasets
- description: 'Configure your Datadog Email Domain Allowlist directly through the
Datadog API.

Expand Down
48 changes: 48 additions & 0 deletions examples/v2/datasets/CreateDataset.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Create a dataset returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.DatasetsApi;
import com.datadog.api.client.v2.model.Dataset;
import com.datadog.api.client.v2.model.DatasetAttributes;
import com.datadog.api.client.v2.model.DatasetCreateRequest;
import com.datadog.api.client.v2.model.DatasetResponseSingle;
import com.datadog.api.client.v2.model.FiltersPerProduct;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
DatasetsApi apiInstance = new DatasetsApi(defaultClient);

DatasetCreateRequest body =
new DatasetCreateRequest()
.data(
new Dataset()
.attributes(
new DatasetAttributes()
.createdAt(null)
.name("Security Audit Dataset")
.principals(
Collections.singletonList(
"role:86245fce-0a4e-11f0-92bd-da7ad0900002"))
.productFilters(
Collections.singletonList(
new FiltersPerProduct()
.filters(Collections.singletonList("@application.id:ABCD"))
.product("logs"))))
.id("123e4567-e89b-12d3-a456-426614174000")
.type("dataset"));

try {
DatasetResponseSingle result = apiInstance.createDataset(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DatasetsApi#createDataset");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
22 changes: 22 additions & 0 deletions examples/v2/datasets/DeleteDataset.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Delete a dataset returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.DatasetsApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
DatasetsApi apiInstance = new DatasetsApi(defaultClient);

try {
apiInstance.deleteDataset("dataset_id");
} catch (ApiException e) {
System.err.println("Exception when calling DatasetsApi#deleteDataset");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Loading