API Reference
The GetCode API lets you generate production-ready code, documents, charts, and more directly from your applications. All endpoints return real, usable output — not templates.
https://getcode.oneHTTPS onlyJSON requests, SSE responsesv1 (stable)Authentication
All requests require an Authorization header with a Bearer token. Generate your key in Settings → API Keys.
Rate limits
Limits are enforced per API key per rolling hour window. Exceeding the limit returns HTTP 429.
When rate-limited, the Retry-After header indicates seconds to wait.
/api/generatePro+Auth requiredSSE streamGenerate production-ready output from a prompt. Returns a Server-Sent Events stream — tokens arrive in real time as they are generated. The stream ends with a done event.
promptREQstringDescription of what to generate. More detail produces better output.outputTypeREQstringOne of: website · chart · api · email · pdf · excel · word · powerpoint · video · imageoriginalPromptstringThe original user-typed prompt before any AI enhancement. Stored separately in generation history.languagestringCode language override. Options: auto (default) · html · react · vue · typescript · python · nodejs · php. Only applies to website and api types.tokenobject{ type: "token", text: "..." } — a chunk of generated output. Accumulate these to build the full result.doneobject{ type: "done", tokensUsed: 4821, model: "..." } — generation complete.errorobject{ type: "error", message: "..." } — generation failed. Stop reading the stream.queueobject{ type: "queue", message: "..." } — free-tier queue notice. Generation will begin shortly./api/improveStarter+Auth requiredEnhance a vague user prompt into a detailed technical brief before passing it to /api/generate. Returns JSON (not a stream). This is the same enhancement step GetCode's generator UI runs automatically.
promptREQstringThe raw prompt to enhance.outputTypeREQstringContext for which output type the prompt will be used with.{
"improved": "Modern SaaS landing page with responsive nav...",
"tokensUsed": 312
}/api/uploadPro+Auth requiredUpload a PDF or image file for AI analysis. Returns a detailed prompt you can pass directly to /api/generate. Useful for "generate from existing doc" workflows.
fileDataREQstringBase64-encoded file content.mimeTypeREQstringMIME type: application/pdf · image/jpeg · image/png · image/webp · image/giffileNameREQstringOriginal filename including extension.outputTypeREQstringThe target output type — guides how the file is analysed.{
"analysedPrompt": "Generate a PDF invoice template with...",
"fileName": "invoice.pdf",
"fileType": "document"
}Error handling
Non-streaming endpoints return JSON errors. The /api/generate SSE stream returns an error event instead.
{ "error": "Human-readable error message" }▶ Playground
Test the API live in your browser. Paste your API key, write a prompt, and see the streamed response in real time.