Skip to main content

World Rules

World rules define the canon of a project — physics, lore constraints, and character behavioral rules. They are fed into AI prompts to ensure consistency across all generated content.

Endpoints overview

MethodEndpointPermissionDescription
GET/api/world-rulesauthenticatedList all world rules
GET/api/world-rules/project/:projectIdauthenticatedList rules by project
GET/api/world-rules/:idauthenticatedGet world rule by ID
POST/api/world-rulesworld_rule:createCreate a world rule
PUT / PATCH/api/world-rules/:idworld_rule:editUpdate a world rule
DELETE/api/world-rules/:idworld_rule:deleteDelete a world rule

Endpoints

List all world rules

GET /api/world-rules — Auth required

Response200

[
{
"id": "wr-uuid-001",
"text": "No magic is allowed inside the lab. All technology must have a plausible scientific basis.",
"textI18n": {
"uk": "У лабораторії магія заборонена.",
"en": "No magic is allowed inside the lab.",
"es": "No se permite magia dentro del laboratorio."
},
"createdAt": "2025-01-15T10:00:00.000Z",
"updatedAt": "2025-01-15T10:00:00.000Z"
}
]

List world rules by project

GET /api/world-rules/project/:projectId — Auth required

Response200 — array of world rule objects (same shape as above)


Get world rule by ID

GET /api/world-rules/:id — Auth required

Response200 — single world rule object


Create world rule

POST /api/world-rules — Auth required, Permission: world_rule:create

Request body

{
"projectId": "proj-uuid-001",
"text": "No magic is allowed inside the lab."
}
FieldRequiredNotes
projectIdyesUUID of the parent project
textyesThe rule text; auto-translated to all locales

Response201

{
"id": "wr-uuid-002",
"text": "No magic is allowed inside the lab.",
"textI18n": {
"uk": "У лабораторії магія заборонена.",
"en": "No magic is allowed inside the lab.",
"es": "No se permite magia dentro del laboratorio."
},
"createdAt": "2025-04-01T12:00:00.000Z",
"updatedAt": "2025-04-01T12:00:00.000Z"
}

Update world rule

PUT /api/world-rules/:id or PATCH /api/world-rules/:id — Auth required, Permission: world_rule:edit

Request body (all fields optional)

{
"text": "No magic or supernatural abilities are allowed anywhere in the facility."
}

Response200 — updated world rule object


Delete world rule

DELETE /api/world-rules/:id — Auth required, Permission: world_rule:delete

Response204