Starholder API
Operation Reference

World · Seeds

3 operations tagged world.seeds.

world_seeds_get

GET /api/v1/world/{worldId}/seeds

List the STAR seed feed and the caller's seed slots. Returns a page of the seed feed plus the caller's seed slot view (4 slots, each empty, queued or active with cooldown). Pagination uses an opaque string cursor (an offset) and hasMore. The feed is not filtered by the path worldId.

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

Parameters

NameInRequiredTypeDescription
worldIdpathyesstring
limitquerynointeger (1–200, default 50)Clamped into 1-200; non-numeric values fall back to 50.
cursorquerynostringnextCursor from a previous page.
includeSettledqueryno"true"Only the literal string 'true' enables it.
x-correlation-idheadernostringEchoed in error.correlationId / meta.correlationId.

Responses

  • 200: Success envelope.

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "properties": {
        "ok": {
          "const": true
        },
        "meta": {
          "type": "object",
          "properties": {
            "correlationId": {
              "type": "string"
            }
          }
        },
        "data": {
          "type": "object",
          "required": [
            "seeds",
            "hasMore",
            "slots"
          ],
          "properties": {
            "seeds": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/SeedFeedEntry"
              }
            },
            "nextCursor": {
              "type": "string"
            },
            "hasMore": {
              "type": "boolean"
            },
            "slots": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/SeedSlotViewRow"
              }
            }
          }
        }
      }
    }
  • 400: ERR_VALIDATION_FAILED (worldId missing).

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 401: Shared 401, or ERR_AUTH_INVALID when the principal has 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"
    }
  • 429: Per-key or per-actor quota exceeded (ERR_QUOTA_EXCEEDED). Honor Retry-After.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 500: ERR_INTERNAL (retryable: true).

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }

Schemas used: #/components/responses/Forbidden, #/components/responses/RateLimited, #/components/responses/Unauthenticated, SeedFeedEntry, SeedSlotViewRow

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

world_seeds_post

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

Place a STAR seed (a staked thought) into one of the caller's slots. Places a seed thought into slot 0-3, embedding the thought and holding a fixed STAR stake in escrow from the caller's wallet; a thought too similar (> 0.95) to an existing seed is rejected. The mutation is admitted as a HAM turn keyed by caller, slot, thought and matchThreshold. Re-sending the same request replays the prior result (ham.replayed: true, empty receiptRefs) instead of double-charging; if the prior turn has not settled yet, a retryable 409 ERR_IDEMPOTENCY_CONFLICT is returned. matchThreshold defaults to 0.65 and is clamped into 0.55-0.85.

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_seeds_post: callers human, external_agent; scopes world:write; capability canAccessBounties; world policy externalAgentAccessEnabled: the caller owns the world (checked for external_agent); mutation class bounty_write.

Parameters

NameInRequiredTypeDescription
worldIdpathyesstring
x-correlation-idheadernostringEchoed in meta.correlationId / error.correlationId.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "slotIndex",
    "thought"
  ],
  "properties": {
    "slotIndex": {
      "type": [
        "integer",
        "string"
      ],
      "minimum": 0,
      "maximum": 3,
      "description": "Coerced with Number(); must be an integer 0-3."
    },
    "thought": {
      "type": "string",
      "minLength": 1,
      "description": "Trimmed; must be non-empty."
    },
    "matchThreshold": {
      "type": "number",
      "description": "Only honored when a JSON number; clamped to 0.55-0.85, default 0.65."
    },
    "idempotencyKey": {
      "type": "string",
      "description": "Passed to the reward engine / ledger hold; HAM duplicate detection ignores it."
    }
  }
}

Responses

  • 200: Seed placed, or idempotent replay of a prior placement.

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "properties": {
        "ok": {
          "const": true
        },
        "meta": {
          "type": "object",
          "properties": {
            "correlationId": {
              "type": "string"
            }
          }
        },
        "data": {
          "type": "object",
          "required": [
            "seedId",
            "slotIndex",
            "slotState",
            "amount",
            "bonusAmount",
            "matchThreshold",
            "status",
            "ham"
          ],
          "properties": {
            "seedId": {
              "type": "string"
            },
            "slotIndex": {
              "type": "integer"
            },
            "slotState": {
              "type": "string",
              "enum": [
                "empty",
                "queued",
                "active"
              ]
            },
            "cooldownUntil": {
              "description": "Present only when set."
            },
            "amount": {
              "description": "Stake amount (default 100 STAR)."
            },
            "bonusAmount": {
              "description": "Bonus amount (default 25 STAR)."
            },
            "matchThreshold": {
              "type": "number"
            },
            "status": {
              "type": "string"
            },
            "ham": {
              "type": "object",
              "required": [
                "turnId",
                "sessionId",
                "receiptRefs",
                "intentKind"
              ],
              "properties": {
                "turnId": {
                  "type": "string"
                },
                "sessionId": {
                  "type": "string"
                },
                "receiptRefs": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "intentKind": {
                  "type": "string"
                },
                "replayed": {
                  "const": true
                }
              }
            }
          }
        }
      }
    }
  • 400: ERR_VALIDATION_FAILED (invalid JSON, slotIndex missing/NaN, thought missing, negative or non-integer slotIndex); ledger errors mapped to input_invalid (error.code is the ledger code).

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 401: Shared 401, or ERR_AUTH_INVALID when the principal has no user id.

    application/json

    {
      "oneOf": [
        {
          "$ref": "#/components/schemas/AesErrorEnvelope"
        },
        {
          "type": "object",
          "required": [
            "error"
          ],
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        }
      ]
    }
  • 403: Shared denials (including externalAgentAccessEnabled world flag for agents), or HAM capability_denied.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 404: HAM world_unknown or session_unknown. Also ERR_WORLD_POLICY_DENIED when the world's policy does not admit external agents. Error codes: ERR_WORLD_POLICY_DENIED.

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 409: ERR_IDEMPOTENCY_CONFLICT (duplicate not yet materialized, retryable: true), reward-engine ERR_SEED_SLOT_UNAVAILABLE / ERR_SEED_TOO_SIMILAR / other reward-engine codes, ledger ERR_IDEMPOTENCY_CONFLICT / ERR_SERIALIZATION_FAILURE, HAM idempotency_conflict / session_world_mismatch / concurrency_conflict.

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 422: Ledger ERR_INSUFFICIENT_BALANCE / ERR_INSUFFICIENT_RESERVE (mapped through HAM settlement_insufficient_budget), other HAM failure codes, or shared mutation-preflight denial.

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 429: Per-key or per-actor quota exceeded (ERR_QUOTA_EXCEEDED). Honor Retry-After.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 500: ERR_INTERNAL (including slotIndex >= 4, HAM internal_error, finalization failure).

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 503: ERR_LEDGER_UNCONFIGURED (retryable: true).

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }

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

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

world_seed_delete

DELETE /api/v1/world/{worldId}/seeds/{seedId}

Withdraw one of the caller's seeds and return its stake. Withdraws a seed owned by the caller and returns its escrowed STAR stake to the caller's wallet. Only withdrawable seeds can be withdrawn; a second call on the same seed fails with ERR_SEED_NOT_WITHDRAWABLE. This route does not go through HAM admission.

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_seed_delete: callers human, external_agent; scopes world:write; capability canAccessBounties; world policy externalAgentAccessEnabled: the caller owns the world (checked for external_agent); mutation class bounty_write.

Confirmation. This operation deletes data. For every request, 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
seedIdpathyesstring
x-correlation-idheadernostringEchoed in meta.correlationId / error.correlationId.
X-Starholder-ConfirmationheadernostringThe confirmationId from this operation's 428 response. Send it with the otherwise identical request to execute that request once.

Responses

  • 200: Seed withdrawn.

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "properties": {
        "ok": {
          "const": true
        },
        "meta": {
          "type": "object",
          "properties": {
            "correlationId": {
              "type": "string"
            }
          }
        },
        "data": {
          "type": "object",
          "required": [
            "seedId",
            "status",
            "returnedAmount"
          ],
          "properties": {
            "seedId": {
              "type": "string"
            },
            "status": {
              "const": "withdrawn"
            },
            "returnedAmount": {
              "description": "STAR amount returned."
            }
          }
        }
      }
    }
  • 400: ERR_VALIDATION_FAILED (empty path ids).

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 401: Shared 401, or ERR_AUTH_INVALID when the principal has no user id.

    application/json

    {
      "oneOf": [
        {
          "$ref": "#/components/schemas/AesErrorEnvelope"
        },
        {
          "type": "object",
          "required": [
            "error"
          ],
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        }
      ]
    }
  • 403: Shared denials, or ERR_FORBIDDEN (seed belongs to another user).

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 404: ERR_SEED_NOT_FOUND. Also ERR_WORLD_POLICY_DENIED when the world's policy does not admit external agents. Error codes: ERR_WORLD_POLICY_DENIED.

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 409: ERR_SEED_NOT_WITHDRAWABLE, or any other WithdrawSeedError code (default 409).

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 422: Shared mutation-preflight denial (bounty_write).

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 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: ERR_INTERNAL.

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable",
            "correlationId"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "correlationId": {
              "type": "string"
            },
            "retryAfterMs": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 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

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