---
title: "Optimize a prompt"
method: POST
path: "/prompts/optimize"
tags: ["Prompt"]
---

# Optimize a prompt

`POST /prompts/optimize`

## Request

- Base URL: `https://api.your-domain.com`
- URL: `https://api.your-domain.com/prompts/optimize`
- Auth: API key in header `X-API-KEY`
- TypeScript: <https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/docs/prompts/optimize/post.ts> (a function with typed inputs; its response is checked against the schema)

Rewrite a draft prompt into a clearer, better-structured version using an LLM.

## Query parameters

- `cookie_name` string, nullable

## Request body

- PromptOptimizeIn
  - `prompt` string, required: Prompt to optimize.
  - `temperature` number: Temperature for optimization, default is 0.0

## Response `200`

Successful Response

- PromptOptimizeOut
  - `content` string, required: The rewritten, optimized prompt text.

## Other responses

- `401`: Missing or invalid authentication.
- `403`: Usage budget exceeded.
- `404`: Current user does not exist.
- `422`: Validation Error

---

[API](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api.md) - [All operations](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/llms.txt) - [OpenAPI document](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/revisions/b53e89b98c2b?raw)
