API Reference
Use the PromptGen API to generate expert AI prompts programmatically from any language or platform.
Base URL:
All requests must include your API key in the
https://getpromptgen.com/api/v1All requests must include your API key in the
Authorization header.
Authentication
All API requests are authenticated using an API key passed as a Bearer token.
Authorization: Bearer sb_live_YOUR_API_KEY
Generate your API key in Settings → Developer. Keys start with sb_live_ and are shown only once at creation.
Rate Limits
| Plan | Calls / day | Max keys |
|---|---|---|
| Free | 10 | 5 |
| Pro | 500 | 5 |
When you exceed the limit, the API returns 429 Too Many Requests. Limits reset at midnight UTC.
Each response includes calls_remaining_today so you can track usage programmatically.
Generate a Prompt
POST
/api/v1/generate
Generates a structured, expert-quality prompt for any task.
Request Body
| Field | Type | Description |
|---|---|---|
| taskrequired | string | What you want the prompt to accomplish |
| domain | string | Domain hint: auto, software, business, creative, education, research, data. Default: auto |
| technique | string | Prompting technique: auto, chain_of_thought, few_shot, role_play, step_by_step. Default: auto |
| target_ai | string | Model to optimise for: general, claude, gpt4, gemini. Default: general |
| provider | string | Which LLM generates the prompt: anthropic, openai, gemini. Default: anthropic |
| context | string | Optional extra context for the prompt |
Response
| Field | Type | Description |
|---|---|---|
| prompt | string | The generated, ready-to-use prompt |
| quality_score | float | Quality score 1–10 |
| quality_reasoning | string | One-line explanation of the score |
| domain | string | Domain used |
| technique | string | Technique used |
| model_used | string | Exact model ID that generated the prompt |
| provider | string | Provider used |
| latency_ms | integer | Generation time in milliseconds |
| calls_remaining_today | integer | Remaining API calls for today |
Example Request
curl -X POST https://getpromptgen.com/api/v1/generate \
-H "Authorization: Bearer sb_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"task": "Write a blog post about the future of AI",
"domain": "creative",
"provider": "anthropic"
}'
Example Response
{
"prompt": "You are an expert technology writer with 10 years...",
"quality_score": 9.2,
"quality_reasoning": "Clear persona, structured output, and specific constraints.",
"domain": "creative",
"technique": "chain_of_thought",
"model_used": "claude-sonnet-4-6",
"provider": "anthropic",
"latency_ms": 1842,
"calls_remaining_today": 9
}
Get API Identity
GET
/api/v1/me
Returns information about the API key and its owner. Useful for verifying a key works.
curl https://getpromptgen.com/api/v1/me \
-H "Authorization: Bearer sb_live_YOUR_KEY"
{
"user_email": "you@example.com",
"plan": "free",
"key_prefix": "sb_live_a8f3",
"calls_today": 1,
"daily_limit": 10,
"calls_remaining": 9
}
Error Codes
| Status | Meaning |
|---|---|
| 400 | Bad request — missing or invalid fields |
| 401 | Invalid or missing API key |
| 403 | Account inactive or no access |
| 429 | Daily rate limit exceeded |
| 502 | Upstream LLM provider error |
All errors return JSON: {"detail": "Human-readable message"}
Code Examples
Python
import requests
resp = requests.post(
"https://getpromptgen.com/api/v1/generate",
headers={"Authorization": "Bearer sb_live_YOUR_KEY"},
json={"task": "Summarise this document", "domain": "business"}
)
data = resp.json()
print(data["prompt"])
JavaScript / Node
const res = await fetch("https://getpromptgen.com/api/v1/generate", {
method: "POST",
headers: {
"Authorization": "Bearer sb_live_YOUR_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ task: "Write unit tests for my auth module" })
});
const { prompt } = await res.json();
console.log(prompt);
PHP
$ch = curl_init("https://getpromptgen.com/api/v1/generate");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer sb_live_YOUR_KEY",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode(["task" => "Create a marketing email"])
]);
$data = json_decode(curl_exec($ch), true);
echo $data["prompt"];