Generate code from a prompt, with a single API call.
The DocForge AI v1 API turns natural-language prompts into structured, multi-file projects — and deploys them to a public URL. Same engine that powers the chat app, now callable from your code.
Quickstart
Generate a complete todo app from a single prompt. Copy the example for your language and run it.
curl -X POST https://www.docforgeai.jo3.org/api/v1/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "Build a todo app with React and localStorage",
"model": "auto",
"duration": "auto"
}'Authentication
The v1 API is in public beta — no API key is required. Just send requests directly.
Authorization: Bearer <key> header will get higher rate limits and usage analytics.Endpoints
Two POST endpoints. Both run on the edge runtime and accept JSON request bodies.
/api/v1/generateRequest body
| Field | Type | Required | Description |
|---|---|---|---|
| prompt | string | required | Natural-language description of what to build. Max 10,000 chars. |
| model | string | optional | auto (default) | nemotron | glm-5.2 | gemma | poolside |
| duration | string | optional | auto (default) | 5min | 10min — longer durations produce more files |
Request example
curl -X POST https://www.docforgeai.jo3.org/api/v1/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "Build a todo app with React and localStorage",
"model": "auto",
"duration": "auto"
}'Response fields
filesarrayGenerated files: { path, content, language }.
tokensUsednumberEstimated tokens consumed (prompt + output, 4 chars ≈ 1 token).
durationnumberGeneration time in milliseconds.
modelstringThe provider that was actually used (e.g. nemotron-nothinking).
fileCountnumberNumber of files in the response.
promptstringEchoed prompt (truncated to 200 chars) for debugging.
Response example
{
"files": [
{
"path": "index.html",
"content": "<!DOCTYPE html>\n<html>\n <head>...",
"language": "html"
},
{
"path": "src/App.tsx",
"content": "import { useState } from \"react\";\n...",
"language": "tsx"
},
{
"path": "src/styles.css",
"content": "body { margin: 0; }\n...",
"language": "css"
}
],
"tokensUsed": 4521,
"duration": 8234,
"model": "nemotron-nothinking",
"fileCount": 3,
"prompt": "Build a todo app with React and localStorage"
}/api/v1/deployRequest body
| Field | Type | Required | Description |
|---|---|---|---|
| files | array | required | Array of { path: string, content: string }. Max 200 files, 1 MB each, 10 MB total. |
| projectId | string | optional | Optional. Re-deploys with the same projectId reuse the same URL. |
Request example
curl -X POST https://www.docforgeai.jo3.org/api/v1/deploy \
-H "Content-Type: application/json" \
-d '{
"files": [
{ "path": "index.html", "content": "<h1>Hello world</h1>" },
{ "path": "styles.css", "content": "body { font-family: sans-serif; }" }
],
"projectId": "my-app"
}'Response fields
idstringShort URL-safe deployment id (e.g. bskrxjre).
urlstringPublic URL where the deployment is served.
entrystringPath of the entry HTML file (empty string when none).
fileCountnumberNumber of files stored.
titlestring|nullTitle extracted from the first <title> tag, if any.
createdAtnumberUnix timestamp (ms) when the deployment was created.
Response example
{
"id": "bskrxjre",
"url": "https://www.docforgeai.jo3.org/d/bskrxjre",
"entry": "index.html",
"fileCount": 2,
"title": "Hello world",
"createdAt": 1722633600000
}Try it live
Send a real request to /api/v1/generate right from this page. The response renders below — file tree on the left, code on the right.
Calls POST /api/v1/generate from your browser. Counts against your per-IP rate limit.
Rate limits & pricing
Free during the public beta. Rate limits are per IP and reset every 60 seconds.
X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers. When you exceed the limit, the API returns 429 with a Retry-After header (seconds). Limits are tracked per IP and reset 60 seconds after the first request in the window.Error responses
All errors return JSON with an error field. 4xx errors should be handled client-side; 5xx errors are usually transient — retry with backoff.
| Status | Label | When |
|---|---|---|
| 400 | Bad Request | Missing or invalid prompt/files. Response body includes a human-readable error message. |
| 413 | Payload Too Large | A file or the total deployment exceeds the size limit. |
| 429 | Rate Limited | More than 10 requests in the last 60 seconds from your IP. Retry after the number of seconds in retryAfter. |
| 502 | Bad Gateway | The deployer backend (dev) is unreachable. Make sure the deployer mini-service on port 3009 is running. |
| 503 | Service Unavailable | All LLM providers failed. Wait a few seconds and retry. |
| 504 | Gateway Timeout | Generation exceeded the per-provider timeout (2 min). Try a shorter prompt. |
Example: 429 response
{
"error": "Rate limit exceeded. Maximum 10 requests per minute per IP.",
"retryAfter": 42,
"docs": "/api-docs#rate-limits"
}Retry strategy
For 429 and 5xx errors, use exponential backoff: wait 1s, then 2s, then 4s. Stop after 3 retries. The Retry-After header (when present) tells you exactly how long to wait.
Ready to build?
Copy a quickstart example and ship something today.