World · Star Seed
2 operations tagged world.star-seed.
world_star_seed_hold
POST /api/v1/world/{worldId}/star-seed/hold
Stake STAR on a world gap coordinate (topology seed hold). Escrows STAR from the caller's wallet against a GapCoordinate in this world whose status is candidate or open, and annotates the gap with the stake (best effort). The seed id is derived from world and gap (gap_<world>__<gap>), and the default ledger idempotency key is per gap, not per user, so a gap effectively holds one stake. Admitted as a HAM turn; amount defaults to the deployment's default stake (100 STAR unless configured).
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_star_seed_hold: callershuman,external_agent; scopesworld:write; capabilitycanAccessBounties; world policyexternalAgentAccessEnabled: the caller owns the world (checked forexternal_agent); mutation classbounty_write.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
worldId | path | yes | string | |
x-correlation-id | header | no | string | Echoed in meta.correlationId / error.correlationId. |
Request body (application/json, required)
{
"type": "object",
"required": [
"gapId"
],
"properties": {
"gapId": {
"type": "string",
"minLength": 1
},
"amount": {
"type": [
"string",
"number"
],
"description": "Decimal STAR amount > 0 (pattern ^\\d+(\\.\\d+)?$, up to 20 integer and 18 fractional digits). Defaults to STAR_DEFAULT_SEED_STAKE or '100'."
},
"idempotencyKey": {
"type": "string",
"description": "Overrides the ledger journal idempotency key (default seed_escrow_hold:<seedId>)."
}
}
}Responses
-
200: Stake held.
application/json{ "type": "object", "required": [ "ok", "data", "meta" ], "properties": { "ok": { "const": true }, "meta": { "type": "object", "properties": { "correlationId": { "type": "string" } } }, "data": { "type": "object", "required": [ "seedId", "gapId", "worldId", "receipt", "ham" ], "properties": { "seedId": { "type": "string" }, "gapId": { "type": "string" }, "worldId": { "type": "string" }, "receipt": { "$ref": "#/components/schemas/LedgerReceipt" }, "ham": { "type": "object", "required": [ "turnId", "sessionId", "receiptRefs", "intentKind" ], "properties": { "turnId": { "type": "string" }, "sessionId": { "type": "string" }, "receiptRefs": { "type": "array", "items": { "type": "string" } }, "intentKind": { "type": "string" } } } } } } } -
400: ERR_VALIDATION_FAILED (invalid JSON, gapId required); ledger errors such as ERR_INVALID_AMOUNT or insufficient balance (error.code is the ledger code); HAM input_invalid.
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 HAM capability_denied.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
404: ERR_GAP_NOT_FOUND, or HAM world_unknown/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_GAP_NOT_SEEDABLE (gap status not candidate/open), 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: 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 (zero amount, HAM duplicate/internal_error, finalization failure, unexpected errors), or HAM code internal_error.
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, LedgerReceipt
app/api/v1/world/[worldId]/star-seed/hold/route.ts (confidence: medium).
world_star_seed_return
POST /api/v1/world/{worldId}/star-seed/return
Return a STAR stake previously held on a world gap. Returns escrowed STAR from a gap topology seed to the caller, who must be the recorded seeder for that gap, and clears the gap's stake annotation (best effort). amount defaults to the recorded stake amount; a caller-supplied amount overrides it and is passed to the ledger as-is. Admitted as a HAM turn; ledger idempotency defaults to a per-seed key, so the return for a given gap seed is effectively one-shot.
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_star_seed_return: callershuman,external_agent; scopesworld:write; capabilitycanAccessBounties; world policyexternalAgentAccessEnabled: the caller owns the world (checked forexternal_agent); mutation classbounty_write.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
worldId | path | yes | string | |
x-correlation-id | header | no | string | Echoed in meta.correlationId / error.correlationId. |
Request body (application/json, required)
{
"type": "object",
"required": [
"gapId"
],
"properties": {
"gapId": {
"type": "string",
"minLength": 1
},
"amount": {
"type": [
"string",
"number"
],
"description": "Decimal STAR amount > 0; defaults to the recorded stake."
},
"idempotencyKey": {
"type": "string",
"description": "Overrides the ledger journal idempotency key."
}
}
}Responses
-
200: Stake returned.
application/json{ "type": "object", "required": [ "ok", "data", "meta" ], "properties": { "ok": { "const": true }, "meta": { "type": "object", "properties": { "correlationId": { "type": "string" } } }, "data": { "type": "object", "required": [ "seedId", "gapId", "worldId", "receipt", "ham" ], "properties": { "seedId": { "type": "string" }, "gapId": { "type": "string" }, "worldId": { "type": "string" }, "receipt": { "$ref": "#/components/schemas/LedgerReceipt" }, "ham": { "type": "object", "required": [ "turnId", "sessionId", "receiptRefs", "intentKind" ], "properties": { "turnId": { "type": "string" }, "sessionId": { "type": "string" }, "receiptRefs": { "type": "array", "items": { "type": "string" } }, "intentKind": { "type": "string" } } } } } } } -
400: ERR_VALIDATION_FAILED (invalid JSON, gapId required); ledger errors (error.code is the ledger code, e.g. ERR_INVALID_AMOUNT); HAM input_invalid.
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, ERR_SEED_RETURN_FORBIDDEN (no stake on this gap by the caller), or HAM capability_denied.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
404: ERR_GAP_NOT_FOUND, or HAM world_unknown/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: 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: 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 (zero amount, HAM duplicate/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, LedgerReceipt
app/api/v1/world/[worldId]/star-seed/return/route.ts (confidence: medium).