Starholder API
Operation Reference

World · Textroots

1 operation tagged world.textroots.

textroot_get

GET /api/v1/world/{worldId}/textroots/{ref}

Get the compiled profile of a TextRoot in a world. Resolves a TextRoot ref within the world and returns its compiled MediaXRef profile (xref identity, media summary, narrative context, linked entities and settings) inside the standard success envelope. The canonical ref of a world story is its text asset's world ref, txt:world_<worldId>:<textAssetId>: the submission read publishes it as textRootRef, get_playback ends in it, and this read reports it again as data.xref.ref and data.narrative.textRootRef. The route also opens the same story from the TextRoot id (text_root_<canonId><textAssetId>, the submission read's textRootId) and from txt:textroot<textRootId>:story, both resolved through TextRoot.source_asset_id. Colons in the ref may be sent as is or percent-encoded. A TextRoot this world has no MediaXRef for is 404 ERR_NOT_FOUND. For a story, the rendered images are media.sceneVisuals[].media[].url (each scene's illustrations, in narrative order) and entities[].canonicalVisual.url and settings[].canonicalVisual.url; entities and settings are the story's graph members (entities through AssetEntity, settings MENTIONED_IN the TextRoot), each with a ref that entity_get or setting_get reads. media.scenes holds scene labels (strings), not images. Every url is a direct image URL. This is story.publish's terminal get_playback read: workflow.nextActions names it once the submission is registered. Read-only. Echoes X-Correlation-Id on every response.

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):

  • textroot_get: callers human, external_agent; scopes world:read; capability canRead; mutation class none.

Parameters

NameInRequiredTypeDescription
worldIdpathyesstring
refpathyesstringThe story to open: the submission read's textRootRef (txt:world_<worldId>:<textAssetId>), its canonical ref. The TextRoot id (text_root_<canonId><textAssetId>) and txt:textroot<textRootId>:story open the same story. Colons may be sent as is or percent-encoded.
X-Correlation-IdheadernostringOptional caller correlation id; generated (corr_<16 hex>) when absent and echoed in the X-Correlation-Id response header and error bodies.

Responses

  • 200: Success envelope wrapping the TextRoot profile: the story's entities and settings with canonicalVisual, and media.sceneVisuals.

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "properties": {
        "ok": {
          "const": true
        },
        "data": {
          "$ref": "#/components/schemas/MediaXRefProfile"
        },
        "meta": {
          "type": "object",
          "required": [
            "correlationId"
          ],
          "properties": {
            "correlationId": {
              "type": "string"
            }
          }
        }
      }
    }
  • 400: ref is not valid percent-encoding, or worldId/ref is empty. Error codes: ERR_VALIDATION_FAILED.

    application/json

    {
      "$ref": "#/components/schemas/ApiErrorEnvelope"
    }
  • 401: No credential and no signed-in session: middleware answers { "error": "unauthorized" } before the route runs. A credential that fails validation: ERR_AUTH_INVALID in the error envelope.

    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: Ref did not resolve to a TextRoot id, or the compiled profile's ref is not in this world's namespace. Error codes: ERR_NOT_FOUND.

    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: Unexpected error, including when profile compilation throws because the MediaXRef or TextRoot card is missing. Error codes: ERR_INTERNAL.

    application/json

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

Schemas used: #/components/responses/Forbidden, #/components/responses/RateLimited, #/components/responses/Unauthenticated, ApiErrorEnvelope, MediaXRefProfile

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

On this page