GetCode
Sign inGet started →
Developer

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.

Base URL
https://getcode.one
Protocol
HTTPS only
Format
JSON requests, SSE responses
Version
v1 (stable)

Authentication

All requests require an Authorization header with a Bearer token. Generate your key in Settings → API Keys.

# Include this header on every request
Authorization: Bearer gc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
⚠ Never expose your API key in client-side code. Always call from your backend.

Rate limits

Limits are enforced per API key per rolling hour window. Exceeding the limit returns HTTP 429.

Plan
/api/generate
/api/improve
Monthly cap
Free
5 / hour
10 / hour
50 / month
Starter
15 / hour
30 / hour
200 / month
Pro
30 / hour
60 / hour
Unlimited
Team
60 / hour
120 / hour
Unlimited

When rate-limited, the Retry-After header indicates seconds to wait.

POST/api/generatePro+Auth requiredSSE stream

Generate 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.

Request parameters
promptREQ
stringDescription of what to generate. More detail produces better output.
outputTypeREQ
stringOne of: website · chart · api · email · pdf · excel · word · powerpoint · video · image
originalPrompt
stringThe original user-typed prompt before any AI enhancement. Stored separately in generation history.
language
stringCode language override. Options: auto (default) · html · react · vue · typescript · python · nodejs · php. Only applies to website and api types.
SSE event types
token
object{ type: "token", text: "..." } — a chunk of generated output. Accumulate these to build the full result.
done
object{ type: "done", tokensUsed: 4821, model: "..." } — generation complete.
error
object{ type: "error", message: "..." } — generation failed. Stop reading the stream.
queue
object{ type: "queue", message: "..." } — free-tier queue notice. Generation will begin shortly.
// Node.js — consuming the SSE stream
const response = await fetch('https://getcode.one/api/generate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    prompt: 'SaaS dashboard for a project management tool',
    outputType: 'website',
    language: 'auto',
  }),
})

const reader = response.body.getReader()
const decoder = new TextDecoder()
let output = ''
let buffer = ''

while (true) {
  const { done, value } = await reader.read()
  if (done) break
  buffer += decoder.decode(value, { stream: true })
  const lines = buffer.split('\n')
  buffer = lines.pop() ?? ''
  for (const line of lines) {
    if (!line.startsWith('data: ')) continue
    const event = JSON.parse(line.slice(6))
    if (event.type === 'token') output += event.text
    if (event.type === 'done') console.log('Complete. Tokens used:', event.tokensUsed)
    if (event.type === 'error') throw new Error(event.message)
  }
}
console.log(output)
POST/api/improveStarter+Auth required

Enhance 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.

Request parameters
promptREQ
stringThe raw prompt to enhance.
outputTypeREQ
stringContext for which output type the prompt will be used with.
Response
{
  "improved": "Modern SaaS landing page with responsive nav...",
  "tokensUsed": 312
}
curl -X POST https://getcode.one/api/improve \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "make me a website",
    "outputType": "website"
  }'
POST/api/uploadPro+Auth required

Upload 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.

Request parameters
fileDataREQ
stringBase64-encoded file content.
mimeTypeREQ
stringMIME type: application/pdf · image/jpeg · image/png · image/webp · image/gif
fileNameREQ
stringOriginal filename including extension.
outputTypeREQ
stringThe target output type — guides how the file is analysed.
Response
{
  "analysedPrompt": "Generate a PDF invoice template with...",
  "fileName": "invoice.pdf",
  "fileType": "document"
}
# Read file as base64 and POST
FILE_B64=$(base64 -w 0 invoice.pdf)
curl -X POST https://getcode.one/api/upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"fileData\": \"$FILE_B64\",
    \"mimeType\": \"application/pdf\",
    \"fileName\": \"invoice.pdf\",
    \"outputType\": \"pdf\"
  }"

Error handling

Non-streaming endpoints return JSON errors. The /api/generate SSE stream returns an error event instead.

Status
Code
Meaning
400
BAD_REQUEST
Missing or invalid request body. Check required parameters.
401
UNAUTHORIZED
Missing or invalid API key.
403
FORBIDDEN
Your plan does not include API access, or the account is suspended.
422
INVALID_PROMPT
Prompt failed content policy or injection detection checks.
429
RATE_LIMITED
You have exceeded your hourly or monthly generation limit.
500
SERVER_ERROR
Unexpected server error. Retry with exponential backoff.
503
AI_UNAVAILABLE
All AI providers are temporarily unavailable. Retry in a few minutes.
JSON error shape
{ "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.

⌘ + Enter
Your output will appear here as it streams in.

Changelog

2025-06
v1.2Added originalPrompt param to /api/generate for accurate history tracking.
2025-05
v1.1Task-aware model routing — code prompts auto-route to code-specialised models.
2025-04
v1.0Public API launch. Endpoints: generate, improve, upload.