Sharpen prompts from your own code
The same engine as the desktop app, over HTTPS. Send a rough prompt, get back a sharper one and a short list of what changed. You don't need any of this to use Prompty itself: the desktop app signs in with your account.
1. Get a key
Create one in Dashboard → Developers. It's shown once. Keep it on your server or in an environment variable, never in browser code, and revoke it there if it leaks.
2. Sharpen a prompt
POST /api/v1/rewrite with your key as a Bearer token.
curl https://prompty-rosy-chi.vercel.app/api/v1/rewrite \
-H "Authorization: Bearer $PROMPTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "my react list is slow", "mode": "code", "target": "Cursor"}'// Node.js 18+ or any server-side JavaScript
const res = await fetch("https://prompty-rosy-chi.vercel.app/api/v1/rewrite", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PROMPTY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ text: "explain kubernetes", mode: "improve", target: "ChatGPT" }),
});
const { rewritten, changes } = await res.json();textstring, required
The prompt to sharpen, 1 to 20,000 characters.
modeimprove | concise | detailed | code | image | grammar
How to sharpen it. Defaults to improve.
targetstring
The tool the prompt is for, like “ChatGPT” or “Midjourney”, so the rewrite suits it. Up to 100 characters.
qualityfast | balanced | deep
How hard Claude thinks. Defaults to balanced.
The response:
{
"rewritten": "My React list of ~5,000 rows re-renders on every keystroke…",
"changes": ["Added context", "Expected behaviour", "How to verify"],
"category": "coding",
"mode": "code",
"usage": { "plan": "free", "used": 3, "limit": 25 }
}Other endpoints
GET /api/v1/meaccount
Your plan, this month's usage and when it resets.
GET /api/v1/libraryyour prompts
Everything in your library, newest first: id, title, content, mode, category, createdAt.
POST /api/v1/librarysave a prompt
Saves content (with optional title, mode, category) to your library.
Limits and errors
API rewrites share your plan's monthly allowance (25 on Free, 600 on Pro) and are limited to 20 requests a minute per key. Errors come back as JSON with an error code and a readable message.
400 invalid_requestyour input
The body is missing `text` or a field is out of range.
401 invalid_keyauthentication
The key is missing, wrong or revoked.
402 quota_exceededplan
This month's rewrites are used up; includes an `upgradeUrl`.
429 rate_limitedslow down
Too many requests this minute.
502 rewrite_failedtry again
The rewrite didn't work this time; it isn't counted.
Prompty never stores the text you send; only counts and categories are kept for your stats.