---
title: "Create a new prompt"
method: POST
path: "/v1/datasets/prompts"
tags: ["Datasets", "Prompts"]
---

# Create a new prompt

`POST /v1/datasets/prompts`

## Request

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

## Request body

- union
  - object
    - `datasetId` string, required
    - `messages` string, nullable
    - `idealOutput` string
    - `withPromptVariation` boolean
  - object
    - `datasetId` string, required
    - `messages` object[], nullable
      - `role` string, required
      - `content` string, required
    - `idealOutput` string
    - `withPromptVariation` boolean

## Response `200`

Created prompt

- DatasetPrompt
  - `id` string
  - `datasetId` string
  - `messages` union
    - object[]
      - `role` string
      - `content` string
    - 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)
