---
title: "Rewrite a rough prompt for an image or video model"
method: POST
path: "/v1/text/enhance-prompt"
tags: ["Text"]
---

# Rewrite a rough prompt for an image or video model

`POST /v1/text/enhance-prompt`

## Request

- Base URL: `https://contentmaschine.ai/api`
- URL: `https://contentmaschine.ai/api/v1/text/enhance-prompt`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://contentmaschine.ai/api/oauth/authorize`, token URL `https://contentmaschine.ai/api/oauth/token`)

Turns a rough prompt or keywords into a detailed prompt for the named tool.
Up to four reference images (inline, `{data, mimeType}`) are used as visual context;
an unusable image is dropped, not refused. Answers synchronously.

Billed by tokens: a hold of 0.01 credits is taken before the model call and the
actual token cost is charged against it.

## Request body

- object
  - `prompt` string, required: The rough prompt or keywords.
  - `tool_context` 'image-generator' | 'image-variator' | 'image-fusion' | 'video-generator': The model the prompt is for.
  - `images` object[]: Optional reference images.
    - `data` string: Base64 or a data URL.
    - `mimeType` string: The image type, used when `data` is plain base64.

## Response `200`

The rewritten prompt.

- object
  - `success` boolean
  - `data` object
    - `enhanced_prompt` string: The rewritten prompt.
    - `credits_used` number, float: Credits charged.
  - `timestamp` string, date-time

## Other responses

- `400`: The prompt is missing.
- `401`: Missing or invalid API key.
- `402`: Insufficient credits.
- `default`: Any other error. Every failure this API emits uses the same envelope; branch on `error.type`, never on `error.message`, and quote `error.correlation_id` to support.

---

[API](https://skmtc.dev/contentmaschine/apis/contentmaschine-ai-api.md) · [All operations](https://skmtc.dev/contentmaschine/apis/contentmaschine-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/contentmaschine/apis/contentmaschine-ai-api/revisions/28c74f46051c?raw)
