---
title: "Create a new dataset"
method: POST
path: "/v1/datasets"
tags: ["Datasets"]
---

# Create a new dataset

`POST /v1/datasets`

## Request

- Base URL: `https://api.lunary.ai`
- URL: `https://api.lunary.ai/v1/datasets`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/lunary/apis/lunary-api/docs/v1/datasets/post.ts> (a function with typed inputs; its response is checked against the schema)

## Request body

- union
  - object
    - `slug` string, required
    - `format` 'text', required
    - `prompt` string, nullable
    - `withPromptVariation` boolean
  - object
    - `slug` string, required
    - `format` 'chat', required
    - `prompt` union
      - object[]
        - `role` string, required
        - `content` string, required
      - string
    - `withPromptVariation` boolean

## Response `200`

Created dataset

- Dataset
  - `id` string
  - `slug` string
  - `format` 'text' | 'chat'
  - `ownerId` string
  - `projectId` string

---

[API](https://skmtc.dev/lunary/apis/lunary-api.md) - [All operations](https://skmtc.dev/lunary/apis/lunary-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lunary/apis/lunary-api/revisions/a38233713bdc?raw)
