Skip to main content
POST/public/enhance

Enhance a prompt using AI-powered optimization.

Required permission: enhance

Request Body

FieldTypeRequiredDescription
promptstringYesThe prompt to enhance (1-100,000 chars)
modalitystringNoTarget modality: text, image, video, audio, code, 3d. Default: text
tonestringNoDesired tone: professional, casual, academic, creative, technical, friendly
lengthstringNoDetail level: concise, standard, detailed
maxTokensintegerNoMaximum tokens for response (1-8192)
customInstructionsstringNoAdditional instructions (max 2000 chars)
streambooleanNoEnable streaming response. Default: false

Example Request

curl -X POST https://api.promptomize.app/api/v1/public/enhance \
  -H "X-API-Key: pk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Write a professional email to schedule a meeting",
    "modality": "text",
    "tone": "professional",
    "length": "standard"
  }'

Response

Success (200)

{
  "enhancedPrompt": "Compose a professional business email...",
  "usage": {
    "inputTokens": 42,
    "outputTokens": 156,
    "totalTokens": 198,
    "processingMs": 1234
  },
  "quota": {
    "used": 15,
    "limit": 100,
    "remaining": 85
  }
}

Error Responses

400 - Validation Error

{
  "error": "Validation error",
  "code": "VALIDATION_ERROR",
  "details": [
    { "field": "prompt", "message": "Required" }
  ]
}

401 - Authentication Error

{
  "error": "Invalid API key",
  "code": "INVALID_API_KEY",
  "message": "The provided API key is invalid, expired, or revoked"
}

429 - Rate Limit Exceeded

{
  "error": "Rate limit exceeded",
  "code": "RATE_LIMIT_EXCEEDED",
  "message": "You have exceeded 60 requests per minute",
  "retryAfter": 45
}

Streaming

Set stream: true to receive the response as Server-Sent Events (SSE).

Stream Events

Token event
data: {"type": "token", "content": "Compose"}
Complete event
data: {"type": "complete", "enhancedPrompt": "...", "usage": {...}}
Done marker
data: [DONE]