Reference
REST API
Build ForjeGames into your own tools. Every editor action is also available over HTTPS.
Base URL
All API requests go to:
https://api.forjegames.comThe API is versioned with a /v1 prefix. We ship non-breaking additions freely — breaking changes will be released under /v2 with a deprecation window of at least 6 months.
Authentication
Create an API key at Settings → API Keys. Pass it as a Bearer token in the Authorization header:
curl https://api.forjegames.com/v1/me \
-H "Authorization: Bearer fjg_live_xxxxxxxxxxxxxxxxxxxx"Rate limits
Default limits are 60 requests/minute per API key on the Creator plan, and 600 requests/minute on Studio. Every response includes:
X-RateLimit-Limit— your current per-minute quotaX-RateLimit-Remaining— requests left in the current windowX-RateLimit-Reset— Unix timestamp when the window resets
When you exceed the limit the API returns 429 Too Many Requests. Back off and retry after X-RateLimit-Reset.
POST /v1/generate
The core endpoint. Creates a generation in the specified AI mode.
curl https://api.forjegames.com/v1/generate \
-H "Authorization: Bearer $FORJEGAMES_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "build",
"prompt": "A small medieval tavern with an NPC bartender",
"project_id": "proj_abc123"
}'Request body:
mode(string, required) — one ofbuild,think,plan,image,script,terrain,3d,debug,ideasprompt(string, required) — natural-language inputproject_id(string, optional) — attach to an existing projectimage_url(string, optional) — reference image forimagemodestream(boolean, default false) — enable Server-Sent Events
Response:
{
"id": "gen_01HE2Z9M5J0XJFKC7Q4YAF1DNX",
"mode": "build",
"project_id": "proj_abc123",
"status": "completed",
"credits_used": 28,
"output": {
"scripts": [
{ "path": "ServerScriptService/Bartender.server.lua", "source": "..." }
],
"parts": [ /* ... */ ],
"summary": "Built a 12x8 tavern with an NPC bartender script."
}
}Streaming
Pass "stream": true to receive output as Server-Sent Events. Each event is a JSON object with a type discriminator: thought, tool_call, file, done.
const res = await fetch('https://api.forjegames.com/v1/generate', {
method: 'POST',
headers: { Authorization: `Bearer ${key}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ mode: 'build', prompt, stream: true }),
})
// Parse SSE stream
const reader = res.body!.getReader()
// ... dispatch events as they arrive
Projects
GET /v1/projects— list projectsGET /v1/projects/:id— fetch a project including chat historyPOST /v1/projects— create an empty projectDELETE /v1/projects/:id— delete a project
Exports
POST /v1/projects/:id/export— trigger a .rbxl exportGET /v1/exports/:id— poll status and retrieve download URL
Errors
Errors follow a consistent shape:
{
"error": {
"code": "insufficient_credits",
"message": "This action requires 28 credits but only 12 are available.",
"request_id": "req_01HE3A1NZ..."
}
}Common codes: invalid_api_key, insufficient_credits, rate_limited, invalid_mode, project_not_found, internal_error.