World · Environment
2 operations tagged world.environment.
world_environment_get
GET /api/v1/world/{worldId}/environment
Get the world's Look & Feel selection and its options. The world's Look & Feel as a selection surface. selection is the current authoring mode (pack, splat or custom) with the values the world renders with. options lists every value a save accepts: packRef, splatRef (mine: the caller's world splats; all: the shared library), backgroundProgram, activeBundle, ambientMode and the meshOpacity range. A value the world already uses but the lists no longer offer is included and labeled (legacy) or Current. fieldsByMode names the selection fields each mode uses. revision is the baseRevision for the next save. Response is marked Cache-Control: no-store.
Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key (X-Api-Key, or Authorization: Bearer; when both are sent, Authorization is used) or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.
Authorization (ROUTE_AUTH_POLICIES; GET /api/v1/account lists the operations your credential passes):
world_environment_get: callershuman,external_agent; scopesworld:read; world policyexternalAgentReadEnabled: the caller can read the world (checked forexternal_agent); mutation classnone.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
worldId | path | yes | string | |
x-correlation-id | header | no | string | Echoed in meta.correlationId / X-Correlation-Id. |
Responses
-
200: Success envelope.
application/json{ "type": "object", "required": [ "ok", "data", "meta" ], "properties": { "ok": { "const": true }, "meta": { "type": "object", "properties": { "correlationId": { "type": "string" } } }, "data": { "$ref": "#/components/schemas/WorldEnvironmentSurface" } } } -
401: Shared 401, or ERR_AUTH_INVALID (no user id).
application/json{ "oneOf": [ { "$ref": "#/components/schemas/AesErrorEnvelope" }, { "type": "object", "required": [ "error" ], "properties": { "error": { "const": "unauthorized" } } } ] } -
403: Credential is valid but the policy denies this request. ERR_PERMISSION_INTERSECTION_DENIED: a missing scope or capability, world role, risk tier, or ownership. ERR_AUTH_FORBIDDEN: the actor kind is not allowed on this operation. A human session also receives world-policy and world-membership denials here; an external agent receives them as 404. error.details.reason names the denial.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
404: ERR_WORLD_NOT_FOUND: no such world, or the caller cannot read it. Also ERR_WORLD_POLICY_DENIED when the world's policy does not admit external agents. Error codes:
ERR_WORLD_NOT_FOUND,ERR_WORLD_POLICY_DENIED.application/json{ "$ref": "#/components/schemas/ApiErrorEnvelope" } -
429: Per-key or per-actor quota exceeded (ERR_QUOTA_EXCEEDED). Honor Retry-After.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
500: ERR_INTERNAL. Error codes:
ERR_INTERNAL.application/json{ "$ref": "#/components/schemas/ApiErrorEnvelope" } -
503: ERR_WORLD_POLICY_UNRESOLVABLE, or ERR_SERVICE_UNAVAILABLE (retryable: true) when the world splat library cannot be read. A failed read is never reported as an empty option list. Error codes:
ERR_WORLD_POLICY_UNRESOLVABLE,ERR_SERVICE_UNAVAILABLE.application/json{ "$ref": "#/components/schemas/ApiErrorEnvelope" }
Schemas used: #/components/responses/Forbidden, #/components/responses/RateLimited, #/components/responses/Unauthenticated, ApiErrorEnvelope, WorldEnvironmentSurface
app/api/v1/world/[worldId]/environment/route.ts (confidence: high).
world_environment_put
PUT /api/v1/world/{worldId}/environment
Save the world's Look & Feel selection. Saves a Look & Feel selection, the same save the world's Look & Feel editor makes. Send the revision from world_environment_get as baseRevision and a selection with its mode and the fields fieldsByMode lists for that mode; a field the mode uses and the request omits keeps the world's current value, and fields of other modes are ignored. Every value must be one of the published options. Choosing a pack clears custom values; choosing a splat applies the splat shell defaults; choosing custom clears the pack and splat. The save requires the caller to be able to edit the world's environment, and an API key may save only its owner's worlds. Returns the updated surface, whose revision is the next baseRevision.
Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key (X-Api-Key, or Authorization: Bearer; when both are sent, Authorization is used) or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.
Authorization (ROUTE_AUTH_POLICIES; GET /api/v1/account lists the operations your credential passes):
world_environment_put: callershuman,external_agent; scopesworld:write; world policyexternalAgentAccessEnabled: the caller owns the world (checked forexternal_agent); mutation classnone.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
worldId | path | yes | string | |
x-correlation-id | header | no | string | Echoed in meta.correlationId / X-Correlation-Id. |
Request body (application/json, required)
{
"type": "object",
"required": [
"baseRevision",
"selection"
],
"properties": {
"baseRevision": {
"type": "integer",
"minimum": 0,
"description": "revision from world_environment_get."
},
"selection": {
"type": "object",
"description": "mode and the fields fieldsByMode lists for it. An omitted mode keeps the current mode.",
"properties": {
"mode": {
"type": "string",
"enum": [
"pack",
"splat",
"custom"
]
},
"packRef": {
"type": "string",
"description": "One of options.packRef."
},
"splatRef": {
"type": "string",
"description": "One of options.splatRef.mine or options.splatRef.all."
},
"backgroundProgram": {
"type": "string",
"description": "One of options.backgroundProgram."
},
"activeBundle": {
"type": "string",
"description": "One of options.activeBundle."
},
"ambientMode": {
"type": "string",
"enum": [
"off",
"passive",
"active"
]
},
"creaturesEnabled": {
"type": "boolean"
},
"showNodes": {
"type": "boolean"
},
"showHemisphereMesh": {
"type": "boolean"
},
"meshOpacity": {
"type": "number",
"minimum": 0,
"maximum": 1
}
}
},
"requestId": {
"type": "string",
"description": "Optional id recorded on the action's audit record; generated when absent."
}
}
}Responses
-
200: Success envelope with the updated surface.
application/json{ "type": "object", "required": [ "ok", "data", "meta" ], "properties": { "ok": { "const": true }, "meta": { "type": "object", "properties": { "correlationId": { "type": "string" } } }, "data": { "$ref": "#/components/schemas/WorldEnvironmentSurface" } } } -
400: ERR_VALIDATION_FAILED. The message begins with the field at fault, for example selection.packRef: packRef must be one of options.packRef. Error codes:
ERR_VALIDATION_FAILED.application/json{ "$ref": "#/components/schemas/ApiErrorEnvelope" } -
401: Shared 401, or ERR_AUTH_INVALID (no user id).
application/json{ "oneOf": [ { "$ref": "#/components/schemas/AesErrorEnvelope" }, { "type": "object", "required": [ "error" ], "properties": { "error": { "const": "unauthorized" } } } ] } -
403: Shared denials, or ERR_CAPABILITY_DENIED when the caller cannot edit this world's environment.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
404: ERR_WORLD_NOT_FOUND: no such world, or the caller cannot read it. Also ERR_WORLD_POLICY_DENIED when the world's policy does not admit external agents. Error codes:
ERR_WORLD_NOT_FOUND,ERR_WORLD_POLICY_DENIED.application/json{ "$ref": "#/components/schemas/ApiErrorEnvelope" } -
409: ERR_PLACE_REVISION_CONFLICT: baseRevision is not the latest revision; the message names the latest. Read world_environment_get and save again. ERR_EXECUTION_FAILED when the place update was not dispatched. Error codes:
ERR_PLACE_REVISION_CONFLICT,ERR_EXECUTION_FAILED.application/json{ "$ref": "#/components/schemas/ApiErrorEnvelope" } -
429: Per-key or per-actor quota exceeded (ERR_QUOTA_EXCEEDED). Honor Retry-After.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
500: ERR_INTERNAL. Error codes:
ERR_INTERNAL.application/json{ "$ref": "#/components/schemas/ApiErrorEnvelope" } -
503: ERR_WORLD_POLICY_UNRESOLVABLE, or ERR_SERVICE_UNAVAILABLE (retryable: true) when the world splat library cannot be read to validate the selection. Error codes:
ERR_WORLD_POLICY_UNRESOLVABLE,ERR_SERVICE_UNAVAILABLE.application/json{ "$ref": "#/components/schemas/ApiErrorEnvelope" }
Schemas used: #/components/responses/Forbidden, #/components/responses/RateLimited, #/components/responses/Unauthenticated, ApiErrorEnvelope, WorldEnvironmentSurface
app/api/v1/world/[worldId]/environment/route.ts (confidence: high).