Starholder API
Operation Reference

World

2 operations tagged world.

world_provision_post

POST /api/v1/world

Provision an additional world for the calling owner. Creates a new private world owned by the calling user (for an API key, the key's owner) with the given worldName via the canonical lifecycle mutation service, then removes any stale public-directory entry and schedules a billing sync in the background. worldName must match ^[a-z][a-z0-9_]{0,31}$ and may not be 'main'; reusing an existing name for the same owner returns 409. The lifecycle idempotency key is deterministic from owner and name.

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_provision_post: callers human, external_agent; scopes world:write; mutation class none.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "worldName"
  ],
  "properties": {
    "worldName": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]{0,31}$",
      "description": "Trimmed before validation; 'main' is reserved."
    }
  }
}

Responses

  • 201: World provisioned. Not wrapped in the ok/data envelope.

    application/json

    {
      "type": "object",
      "required": [
        "world"
      ],
      "properties": {
        "world": {
          "type": "object",
          "required": [
            "worldId",
            "worldRef",
            "lifecycleState",
            "registryRef",
            "registryHash",
            "receiptKind",
            "mirrorSynced",
            "directoryDisposition",
            "ham"
          ],
          "properties": {
            "worldId": {
              "type": "string"
            },
            "worldRef": {
              "type": "string"
            },
            "lifecycleState": {
              "type": "string"
            },
            "registryRef": {
              "type": "string"
            },
            "registryHash": {
              "type": "string"
            },
            "receiptKind": {
              "type": "string"
            },
            "mirrorSynced": {
              "type": "boolean"
            },
            "directoryDisposition": {
              "type": "string",
              "enum": [
                "removed",
                "unchanged"
              ]
            },
            "ham": {
              "$ref": "#/components/schemas/WorldLifecycleHamRecord"
            }
          }
        }
      }
    }
  • 400: Invalid JSON body, or code input_invalid (worldName missing, bad grammar, or 'main').

    application/json

    {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        }
      }
    }
  • 401: Shared 401, missing caller identity, or code user_unknown (owner has no HAM username binding).

    application/json

    {
      "oneOf": [
        {
          "$ref": "#/components/schemas/AesErrorEnvelope"
        },
        {
          "type": "object",
          "required": [
            "error"
          ],
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        }
      ]
    }
  • 403: Shared denials (a key without the world:write scope), or code capability_denied.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 409: code duplicate_world_name.

    application/json

    {
      "type": "object",
      "required": [
        "error",
        "code"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "const": "duplicate_world_name"
        }
      }
    }
  • 422: code lifecycle_precondition_failed.

    application/json

    {
      "type": "object",
      "required": [
        "error",
        "code"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        }
      }
    }
  • 429: Per-key or per-actor quota exceeded (ERR_QUOTA_EXCEEDED). Honor Retry-After.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 500: code internal_error or other unmapped failure code (e.g. ham_prepare_failed), or {error: 'Internal server error'}.

    application/json

    {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        }
      }
    }

Schemas used: #/components/responses/Forbidden, #/components/responses/RateLimited, #/components/responses/Unauthenticated, WorldLifecycleHamRecord

Contract authored from app/api/v1/world/route.ts (confidence: high).

world_detail_get

GET /api/v1/world/{worldId}

Get a world's detail and the caller's relationship to it. Returns a management row describing the world (handle, display name, description, owner, lifecycle, visibility) and the caller's posture: relationship, canRead, canPublish, pending invite, bookmark, default/bootstrap flags and avatar. A descriptive row is returned when the caller can read the world by policy or has an invite, bookmark, ownership or membership; otherwise the response is 404 to avoid revealing existence.

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_detail_get: callers human, external_agent; mutation class none.

Parameters

NameInRequiredTypeDescription
worldIdpathyesstring

Responses

  • 200: Not wrapped in the ok/data envelope.

    application/json

    {
      "type": "object",
      "required": [
        "world"
      ],
      "properties": {
        "world": {
          "$ref": "#/components/schemas/WorldManagementRow"
        }
      }
    }
  • 401: Shared 401, or {error: 'Unable to resolve caller identity'} when 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: code world_not_found (missing, or not visible to the caller).

    application/json

    {
      "type": "object",
      "required": [
        "error",
        "code"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "const": "world_not_found"
        }
      }
    }
  • 429: Per-key or per-actor quota exceeded (ERR_QUOTA_EXCEEDED). Honor Retry-After.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 500: {error: 'Internal server error'}.

    application/json

    {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "string"
        }
      }
    }
  • 503: code world_policy_unresolvable.

    application/json

    {
      "type": "object",
      "required": [
        "error",
        "code",
        "worldId"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "const": "world_policy_unresolvable"
        },
        "worldId": {
          "type": "string"
        }
      }
    }

Schemas used: #/components/responses/Forbidden, #/components/responses/RateLimited, #/components/responses/Unauthenticated, WorldManagementRow

Contract authored from app/api/v1/world/[worldId]/route.ts (confidence: high).