Starholder API
Operation Reference

World · Lifecycle

1 operation tagged world.lifecycle.

world_lifecycle_post

POST /api/v1/world/{worldId}/lifecycle

Pause, resume, archive, or delete a world you own. Owner-only lifecycle transition delegated to the canonical lifecycle service. delete requires the world to be archived first (otherwise 422 lifecycle_precondition_failed) and produces tombstone and sweep report refs. After success the public directory entry is rebuilt or removed, and archive/delete schedule a background billing sync. The idempotency key is deterministic from intent, world, owner, reason and evidenceRefs.

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_lifecycle_post: callers human, external_agent; scopes world:write; world role owner or higher (humans, and API keys through their owner); mutation class none.

Confirmation. This operation deletes data. For a request whose body action is 'delete', the first request changes nothing and answers 428 with what it would remove; resending the identical request with X-Starholder-Confirmation: <confirmationId> within 5 minutes runs it once. See Delete confirmation.

Parameters

NameInRequiredTypeDescription
worldIdpathyesstring
X-Starholder-ConfirmationheadernostringThe confirmationId from this operation's 428 response. Send it with the otherwise identical request to execute that request once.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "action"
  ],
  "properties": {
    "action": {
      "type": "string",
      "enum": [
        "pause",
        "resume",
        "archive",
        "delete"
      ]
    },
    "reason": {
      "type": "string",
      "description": "Optional, trimmed."
    },
    "evidenceRefs": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Non-string entries are dropped."
    }
  }
}

Responses

  • 200: Transition applied. 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",
              "enum": [
                "provisioning",
                "active",
                "paused",
                "archived",
                "deleted"
              ]
            },
            "registryRef": {
              "type": "string"
            },
            "registryHash": {
              "type": "string"
            },
            "receiptKind": {
              "type": "string"
            },
            "mirrorSynced": {
              "type": "boolean"
            },
            "directoryDisposition": {
              "type": "string",
              "enum": [
                "upserted",
                "removed",
                "unchanged"
              ]
            },
            "billingLifecycleTriggered": {
              "type": "string",
              "enum": [
                "archived",
                "deleted"
              ]
            },
            "tombstoneRef": {
              "type": "string"
            },
            "sweepReportRef": {
              "type": "string"
            },
            "ham": {
              "$ref": "#/components/schemas/WorldLifecycleHamRecord"
            }
          }
        }
      }
    }
  • 400: Invalid JSON body, or code input_invalid (bad action).

    application/json

    {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        }
      }
    }
  • 401: Shared 401, missing caller identity, or code user_unknown.

    application/json

    {
      "oneOf": [
        {
          "$ref": "#/components/schemas/AesErrorEnvelope"
        },
        {
          "type": "object",
          "required": [
            "error"
          ],
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        }
      ]
    }
  • 403: Shared denials (policy requires world role owner), or code capability_denied.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 404: code world_unknown.

    application/json

    {
      "type": "object",
      "required": [
        "error",
        "code"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        }
      }
    }
  • 422: code lifecycle_precondition_failed or delete_sweep_incomplete; may include retrySameInputs: true.

    application/json

    {
      "type": "object",
      "required": [
        "error",
        "code"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "retrySameInputs": {
          "const": true
        }
      }
    }
  • 428: The request deletes data and nothing was changed. ERR_CONFIRMATION_REQUIRED: X-Starholder-Confirmation was not sent. ERR_CONFIRMATION_INVALID, ERR_CONFIRMATION_EXPIRED or ERR_CONFIRMATION_USED: the confirmation sent does not match this caller, operation and request, has expired, or was already used; the response carries a fresh one. confirmation.impact states what the request removes. To proceed, send confirmation.confirm (the same method, path and body) with its X-Starholder-Confirmation header before confirmation.expiresAt; it executes once.

    application/json

    {
      "$ref": "#/components/schemas/ConfirmationChallenge"
    }
  • 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 unmapped HAM failure codes (may include retrySameInputs: true), or {error: 'Internal server error'}.

    application/json

    {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "retrySameInputs": {
          "const": true
        }
      }
    }
  • 503: ERR_CONFIRMATION_UNAVAILABLE: the server cannot record that a confirmation was used, so the delete did not run. Retryable.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }

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

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