---
title: "Create dataset"
method: POST
path: "/workspaces/{workspace_id}/projects/{project_id}/datasets"
tags: ["Datasets"]
---

# Create dataset

`POST /workspaces/{workspace_id}/projects/{project_id}/datasets`

## Request

- Base URL: `https://app.mammoth.io/api/v2`
- URL: `https://app.mammoth.io/api/v2/workspaces/{workspace_id}/projects/{project_id}/datasets`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-KEY` and API key in header `X-API-SECRET` and API key in header `X-WORKSPACE-ID`

Create datasets

## Path parameters

- `workspace_id` integer, required: Workspace refers to a collection of projects. Workspace ID is unique identifier for workspace.
- `project_id` integer, required: Project ID of the workspace

## Request body

- DatasetCreationSpec: A task specification
  - `ds_creation_type` 'clone' | 'cloud' | 'sketch' | 'weburl', required: Dataset Creation Type
  - `folder_resource_id` integer, nullable: Folder Resource ID
  - `dataset_spec` union, required: Dataset Specification
    - CreateThirdPartyDataset
      - `connector_key` string, required: Third party connector Key
      - `connection_key` string, required: Identity Key
      - `query_properties` DsConfigForCloudTypeConnector, required: Query Properties
        - `ds_name` string, nullable: Dataset's Name
        - `data_start_date` string, date-time, nullable: Data Start Date
        - `table_name` string, nullable: Table Name
        - `query` string, nullable: Query for the dataset
        - `profile` string, nullable: Schema/Profile for the selected identity
        - `file_url` string, nullable: File URL
        - `sheet_name` string, nullable: Google Sheet Name
        - `column_types_as_text` boolean: Column Types as Text
        - `structure_map` object, nullable: Structure map produced by LLM interpretation for stacked sheets
        - `preview_columns` string[], nullable: Column names from the interpreted preview, derived from structure_map
        - `user_instruction` string, nullable: User's original interpretation instruction, for stacked sheets
        - `file_path` union: File Path (single string or list for SFTP bulk, or list of {id, path} objects for Google Drive)
          - string
          - string[]
          - object[]
        - `data_pull_file` 'Pull same file' | 'Pull next file based on name pattern' | 'null', nullable: Data Pull File
        - `folder_path` string, nullable: Folder Path
        - `name_pattern` string, nullable: Name Pattern
        - `datapull_options` union: Datapull options (alias for tables)
          - string
          - object
        - `hidden_query` string, nullable: Hidden/original query
        - `documents` union: Selected documents (strings or {id, path} objects for Google Drive)
          - string
          - string[]
          - object[]
        - `additional_config` object, nullable: Extra connector-specific config (dynamic metrics selections)
      - `schedule_properties` ScheduleProperties
        - `schedule_type` 'moment' | 'period', required: Schedule Type
        - `first_pull_at` 'now' | 'later', required: First Pull At
        - `on_refresh_action` 'replace' | 'combine' | 'append', required: On Refresh Action
        - `unique_sequence_column` UniqueSequenceColumn
          - `c_name` string, nullable: Unique Sequence Column Name
          - `c_type` 'numeric' | 'date', required: Data Type of the Unique Sequence Column
      - `recurrence_info` RecurrenceInfo
        - `interval` integer, required: Interval
        - `frequency` 'minutely' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'null', nullable: Frequency
        - `start_at` string, date-time, required: Start At
        - `until` string, date-time, nullable: Until
        - `by_month_day` integer[], nullable: By Month Day
        - `by_week_day` string[], nullable: By Week Day
      - `automation` DatasetRefreshAutomationSpec
        - `name` string, required: Name for the created Dataset Refresh automation
        - `description` string: Description for the created automation
        - `on_refresh_action` 'replace' | 'combine' | 'append': Whether each refresh replaces or appends to existing data
        - `schedule` AutomationsSchemaConditionSchema
          - `contains` string, nullable: File name contains
          - `starts_with` string, nullable: File name prefix to match (case-insensitive)
          - `ends_with` string, nullable: File name suffix to match (case-insensitive)
          - `exact_match_with` string, nullable: Match exactly as given string
          - `include_subfolders` boolean, nullable: Include subfolders
          - `all_files` boolean, nullable: All files
          - `case_sensitive` boolean, nullable: Case Sensitive
          - `interval` integer, nullable: Interval
          - `frequency` 'minutely' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'null', nullable: Frequency
          - `start_at` string, date-time, nullable: Start At
          - `until` string, date-time, nullable: Until
          - `by_month_day` integer[], nullable: By Month Day
          - `by_week_day` string[], nullable: By Week Day
          - `start_now` boolean: start now/later
          - `file_contains` string, nullable: Name Contains
          - `execution_mode` 'parallel' | 'sequential': Execution Mode for task
          - `trigger_type` 'manual' | 'schedule': Execution trigger Type for automation
          - `on_refresh_action` 'replace' | 'combine' | 'append': On Refresh Action
          - `unique_sequence_column` UniqueSequenceCol
            - `c_name` string, required: Unique Sequence Column Name
            - `c_type` 'numeric' | 'date', required: Data Type of the Unique Sequence Column
    - DuplicateDataset
      - `ds_name` string, nullable: Name of the duplicated dataset
      - `source_ds_id` integer, required: Source Dataset ID
      - `clone_dataview_ids` integer[]: List of dataview ids to clone
      - `exclude_data` boolean: Whether to exclude data or not
      - `target_project_id` integer, nullable: Project to create the copy in. Defaults to the source dataset's own project. Needs permission to create datasets there and to read the source; asking again for a source already copied there returns that copy.
    - CreateSketchDataset
      - `name` string, required: Dataset Name
      - `dataschema` Columns[], required: Dataschema of the table
        - `c_id` string, required: Column ID
        - `c_name` string, required: Column Name
        - `c_type` 'text' | 'numeric' | 'date', required: Data Type of the column
      - `display_properties` object, nullable: Display Properties for the dataset
    - CreateWeburlDataset
      - `url` string, required: URL of the dataset

## Response `201`

Document created, URL follows

- unknown

## Other responses

- `400`: Bad request syntax or unsupported method

---

[API](https://skmtc.dev/mammoth/apis/mammoth-analytics.md) · [All operations](https://skmtc.dev/mammoth/apis/mammoth-analytics/llms.txt) · [OpenAPI document](https://skmtc.dev/mammoth/apis/mammoth-analytics/revisions/fe078afe239b?raw)
