---
title: "Create Dataset Group"
method: POST
path: "/api/public/v2/dataset-groups"
tags: ["datasets"]
---

# Create Dataset Group

`POST /api/public/v2/dataset-groups`

## Request body

- CreateDatasetGroupRequest
  - `name` string, required — Name for the dataset group. Must be unique within the workspace.
  - `workspace_id` integer, nullable — Workspace ID. Defaults to the workspace associated with the API key.
  - `folder_id` integer, nullable — Folder ID to create the dataset group in. Omit to create at the workspace root.
  - `external_ids` ExternalId[] — External ID mappings to attach to the dataset group.
    - `source` string, required — The external system or namespace that owns the ID.
    - `external_id` string, required — The identifier for this entity in the external system.

## Response `201`

Dataset group created.

- CreateDatasetGroupResponse
  - `success` true, required
  - `message` string
  - `dataset_group` union, required
    - DatasetGroup
      - `id` integer, required — Dataset group ID
      - `name` string, required — Dataset group name
      - `workspace_id` integer, required — Associated workspace ID
      - `is_deleted` boolean, required — Whether the dataset group is deleted
    - object
  - `dataset` union, required — Initial draft dataset created with version_number = -1.
    - Dataset
      - `id` integer, required — Dataset ID
      - `dataset_group_id` integer, required — Associated dataset group ID
      - `version_number` integer, required — Version number of the dataset
      - `column_names` string[], required — Array of column names in the dataset
      - `filter_params` object, nullable — Filter parameters used to create the dataset
      - `is_deleted` boolean, required — Whether the dataset is deleted
      - `user_id` integer, required — ID of the user who created the dataset
      - `dataset_group` DatasetGroup
        - `id` integer, required — Dataset group ID
        - `name` string, required — Dataset group name
        - `workspace_id` integer, required — Associated workspace ID
        - `is_deleted` boolean, required — Whether the dataset group is deleted
      - `external_ids` ExternalId[] — External ID mappings attached to this dataset group.
        - `source` string, required — The external system or namespace that owns the ID.
        - `external_id` string, required — The identifier for this entity in the external system.
    - object
  - `external_ids` ExternalId[], required
    - `source` string, required — The external system or namespace that owns the ID.
    - `external_id` string, required — The identifier for this entity in the external system.

## Other responses

- `400` — Bad Request - Invalid workspace_id or dataset with this name already exists
- `401` — Unauthorized - missing or invalid API key.
- `409` — External ID conflict
- `422` — Validation error - request parameters or body are invalid.

---

[API](https://skmtc.dev/promptlayer/apis/promptlayer-api.md) · [All operations](https://skmtc.dev/promptlayer/apis/promptlayer-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/promptlayer/promptlayer-api/revisions/a23093a0a506/schema)
