> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chartbrew.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a dataset

> Create a new dataset

<Note>
  To start fetching data in a dataset, you need to create a data request.
  A data request is responsible with using your connections to fetch data from your data sources.
  You can create a data request by using the [Create a Data Request](/api-reference/endpoint/datasets/create-data-request) endpoint.
</Note>


## OpenAPI

````yaml POST /team/{team_id}/datasets
openapi: 3.0.1
info:
  title: Chartbrew API reference
  description: The OpenAPI specification for Chartbrew
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.chartbrew.com
security:
  - bearerAuth: []
paths:
  /team/{team_id}/datasets:
    post:
      description: Create a new dataset
      parameters:
        - name: team_id
          in: path
          description: ID of the team
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewDataset'
      responses:
        '200':
          description: Created dataset
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dataset'
        '400':
          description: Error response
        '401':
          description: Not authorized
      security:
        - bearerAuth: []
components:
  schemas:
    NewDataset:
      type: object
      required:
        - team_id
      properties:
        team_id:
          type: integer
        project_ids:
          type: array
          items:
            type: integer
        name:
          type: string
        connection_id:
          type: integer
        type:
          type: string
        query:
          type: string
        datasetColor:
          type: string
        dateField:
          type: string
        dateFormat:
          type: string
        legend:
          type: string
          description: >-
            [Legacy compatibility] Previous dataset name field. Prefer name for
            reusable dataset naming.
        configuration:
          type: object
    Dataset:
      type: object
      properties:
        id:
          type: integer
        team_id:
          type: integer
        project_ids:
          type: array
          items:
            type: integer
        chart_id:
          type: integer
        connection_id:
          type: integer
        draft:
          type: boolean
          default: true
        name:
          type: string
          description: >-
            Canonical dataset name. Prefer this over legend when referring to
            the reusable dataset itself.
        query:
          type: string
        xAxis:
          type: string
          description: >-
            [Legacy compatibility] Dataset-level binding fallback. New chart
            bindings should be stored on ChartDatasetConfig.
        xAxisOperation:
          type: string
          description: >-
            [Legacy compatibility] Dataset-level binding fallback. New chart
            bindings should be stored on ChartDatasetConfig.
        yAxis:
          type: string
          description: >-
            [Legacy compatibility] Dataset-level binding fallback. New chart
            bindings should be stored on ChartDatasetConfig.
        yAxisOperation:
          type: string
          default: none
          description: >-
            [Legacy compatibility] Dataset-level binding fallback. New chart
            bindings should be stored on ChartDatasetConfig.
        dateField:
          type: string
          description: >-
            [Legacy compatibility] Dataset-level binding fallback. New chart
            bindings should be stored on ChartDatasetConfig.
        dateFormat:
          type: string
          description: >-
            [Legacy compatibility] Dataset-level binding fallback. New chart
            bindings should be stored on ChartDatasetConfig.
        legend:
          type: string
          description: >-
            [Legacy compatibility] Previous dataset name field. Prefer
            Dataset.name for reusable dataset naming.
        fieldsSchema:
          type: object
        excludedFields:
          type: array
          items:
            type: string
        configuration:
          type: object
        joinSettings:
          type: object
          properties:
            joins:
              type: array
              items:
                type: object
                properties:
                  dr_id:
                    type: integer
                    description: DataRequest ID
                  join_id:
                    type: integer
                  dr_field:
                    type: string
                  join_field:
                    type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````