REST API

Prompt workflows

Generate, analyze, optimize, refine, reverse-engineer, and estimate prompts through the REST API.

Verified against the implementation ·

Generate a prompt

POST /prompts/generate accepts a goal or instruction in message. ready_to_use fills concrete details and avoids placeholders; reusable preserves useful variables for later reuse.

FieldTypeRules
messagestringRequired; 1–6,000 characters
modeenumauto, general, research, writing, planning, agent, image, video, code, automation
outputModeenumready_to_use (default) or reusable
targetModelstring enumUniversal by default; use GET /models for the current list
languagestring2–20 characters; en by default
generationIdstring or nullOptional; continue existing generator history
currentPromptstring or nullOptional; up to 20,000 characters
conversationarrayUp to 50 user/assistant messages, 4,000 characters each
attachmentIdsAsset ID arrayUp to 5 completed temporary uploads

Analyze and optimize

EndpointRequired scopeResult
POST /prompts/analyzeprompts:analyzeAnalysis saved to optimization history
POST /prompts/optimizeprompts:optimizeOne or two optimized versions
POST /prompts/analyze-and-optimizeprompts:analyze + prompts:optimizeAnalysis and optimized versions in one operation
curl -X POST https://api.promptessor.com/v1/prompts/analyze-and-optimize \
  -H "Authorization: Bearer pt_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: optimize-brief-001" \
  -d '{
    "prompt": "Write a launch email for our app",
    "context": "Audience: independent designers. Tone: confident, concise.",
    "targetModel": "Claude",
    "variationCount": 2,
    "language": "en"
  }'
  • prompt is required and supports up to 50,000 characters.
  • context is optional and supports up to 20,000 characters.
  • variationCount is 1 by default and accepts only 1 or 2.
  • attachmentIds accepts up to five completed temporary asset IDs.

Refine from feedback

POST /prompts/refine refines any prompt and stores standalone refinement history. POST /optimizations/{id}/refinements appends a new refinement to an existing optimization record.

{
  "prompt": "Write a landing page headline",
  "feedback": "Make it more concrete and emphasize the time saved",
  "targetModel": "ChatGPT",
  "language": "en",
  "attachmentIds": []
}

Reverse Prompt

POST /reverse-prompts infers a reusable prompt from an image, sampled video frames, text, or a public URL. Reverse Prompt results do not create product history.

typeRequired inputLimits
imageuploadIdAsset ID of a completed reverse_image upload
videoframes, frameCount, videoDuration1–30 data:image/ frames; duration up to 600 seconds
textcontent10–100,000 characters
urlurlPublic URL up to 2,048 characters

Visible website experience

URL reverse prompting analyzes the public, visible website experience. It does not authenticate into private pages or promise a browser-perfect reconstruction.

Estimate tokens

POST /prompts/token-estimate requires usage:read and a prompt string. It is a read-classified request and does not consume an AI workflow credit.