Starholder API
Operation Reference

Star

7 operations tagged star.

star_account_statement_get

GET /api/v1/star/account-statement

Get the caller's wallet postings with running balance for a window. Authorizes with authorizeRouteRequest (human or external_agent). Returns the ledger postings for user:<userId>:wallet between from and to, each with a running balance. Both bounds are required. Read-only, with no pagination.

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

  • star_account_statement_get: callers human, external_agent; mutation class none.

Parameters

NameInRequiredTypeDescription
fromqueryyesstring
toqueryyesstring

Responses

  • 200: Raw object.

    application/json

    {
      "type": "object",
      "required": [
        "entries"
      ],
      "properties": {
        "entries": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/AccountStatementEntry"
          }
        }
      }
    }
  • 400: {error:'from and to are required ISO timestamps'} or a LedgerError {error: code, message, retryable, details}.

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "retryable": {
          "type": "boolean"
        },
        "details": {
          "type": "object"
        }
      }
    }
  • 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"
    }
  • 500: {error:'internal_error', message}

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 503: {error:'ledger_unconfigured'}

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        }
      }
    }

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

Contract authored from app/api/v1/star/account-statement/route.ts (confidence: high).

star_activity_get

GET /api/v1/star/activity

List the caller's STAR activity (receipts) with cursor paging. Authorizes with authorizeRouteRequest (human or external_agent; external agents see the owner's activity). Lists the receipts where the user's wallet is sender or recipient, newest first (by occurred_at, then receipt_id descending), each formatted as a StarActivityItem with direction and counterparty labels. It supports a date window, a receipt type filter, and a keyset cursor.

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

  • star_activity_get: callers human, external_agent; mutation class none.

Parameters

NameInRequiredTypeDescription
fromquerynostringWindow start; default epoch. Unparseable values silently fall back to the default.
toquerynostringWindow end; default now. Unparseable values silently fall back to the default.
typequerynostringOne of the 7 ReceiptType values (lib/star-ledger/types.ts).
cursorquerynostringOpaque keyset cursor of the form '<occurredAt>|<receiptId>', taken from nextCursor.
limitquerynointeger (1–100, default 50)Non-positive or invalid values become 50; values above 100 are capped at 100.

Responses

  • 200: Raw object, not enveloped.

    application/json

    {
      "type": "object",
      "required": [
        "userId",
        "items",
        "nextCursor",
        "hasMore"
      ],
      "properties": {
        "userId": {
          "type": "string"
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/StarActivityItem"
          }
        },
        "nextCursor": {
          "type": [
            "string",
            "null"
          ],
          "description": "Non-null whenever items is non-empty, even when hasMore is false."
        },
        "hasMore": {
          "type": "boolean",
          "description": "Heuristic: true when items.length equals limit."
        }
      }
    }
  • 400: {error:'from must be <= to'} or {error:'Invalid receipt type filter'}.

    application/json

    {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "string"
        }
      }
    }
  • 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"
    }
  • 500: {error: string}

    application/json

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

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

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

star_activity_receipt_get

GET /api/v1/star/activity/{receiptId}

Get one STAR receipt and its activity view. Authorizes with authorizeRouteRequest (human or external_agent; an external agent reads its owner's receipts). Loads the receipt by id, requires the caller to be its fromOwnerId or toOwnerId, and returns the raw LedgerReceipt together with its formatted StarActivityItem. Read-only.

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

  • star_activity_receipt_get: callers human, external_agent; mutation class none.

Parameters

NameInRequiredTypeDescription
receiptIdpathyesstring

Responses

  • 200: Raw object, not enveloped.

    application/json

    {
      "type": "object",
      "required": [
        "receipt",
        "activity"
      ],
      "properties": {
        "receipt": {
          "$ref": "#/components/schemas/LedgerReceipt"
        },
        "activity": {
          "$ref": "#/components/schemas/StarActivityItem"
        }
      }
    }
  • 401: Also {error:'Could not resolve user identity'} if the authorized identity has no userId.

    application/json

    {
      "oneOf": [
        {
          "$ref": "#/components/schemas/AesErrorEnvelope"
        },
        {
          "type": "object",
          "required": [
            "error"
          ],
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        }
      ]
    }
  • 403: Shared denials, or {error:'Forbidden'}: the caller is not a party to the receipt.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 404: {error:'Not found'}

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "const": "Not found"
        }
      }
    }
  • 500: {error: string}

    application/json

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

Schemas used: #/components/responses/Forbidden, #/components/responses/Unauthenticated, LedgerReceipt, StarActivityItem

Contract authored from app/api/v1/star/activity/[receiptId]/route.ts (confidence: high).

star_balance_get

GET /api/v1/star/balance

Get the caller's STAR wallet balance. Authorizes with authorizeRouteRequest (human or external_agent). An external agent sees its owner's wallet. Reads the user:<userId>:wallet balance and returns '0' when the account does not exist yet. availableBalance and totalBalance are always the same value. Read-only.

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

  • star_balance_get: callers human, external_agent; mutation class none.

Responses

  • 200: Raw object, not enveloped. Cache-Control: no-store, no-cache, must-revalidate.

    application/json

    {
      "type": "object",
      "required": [
        "userId",
        "accountId",
        "asset",
        "availableBalance",
        "totalBalance",
        "computedAt"
      ],
      "properties": {
        "userId": {
          "type": "string"
        },
        "accountId": {
          "type": "string",
          "description": "user:<userId>:wallet"
        },
        "asset": {
          "const": "STAR"
        },
        "availableBalance": {
          "type": "string",
          "description": "Decimal string (StarAmount)."
        },
        "totalBalance": {
          "type": "string",
          "description": "Decimal string; equal to availableBalance."
        },
        "computedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  • 401: Also {error:'Could not resolve user identity'} if the authorized identity has no userId.

    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"
    }
  • 500: {error:'Failed to fetch star balance'}

    application/json

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

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

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

star_seed_slots_get

GET /api/v1/star/seeds/my-slots

List the caller's four seed slots and their seeds. Authorizes against the star_seed_slots_get registry policy (session or API key) and lists the slots of the credential's owner. Always returns exactly four slot rows (slotsPerUser = 4). Each row has its state (empty, queued, or active), an optional cooldown timestamp, and the occupying seed if there is one. Read-only.

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

  • star_seed_slots_get: callers human, external_agent; scopes account:read; mutation class none.

Responses

  • 200: Raw object.

    application/json

    {
      "type": "object",
      "required": [
        "slots"
      ],
      "properties": {
        "slots": {
          "type": "array",
          "minItems": 4,
          "maxItems": 4,
          "items": {
            "$ref": "#/components/schemas/SeedSlotViewRow"
          }
        }
      }
    }
  • 401: Also returned by the handler as {error:'Authentication required'} when the authorized identity names no user.

    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"
    }
  • 500: Store errors are not caught, so Next returns its default 500.

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

Contract authored from app/api/v1/star/seeds/my-slots/route.ts (confidence: high).

star_tip_post

POST /api/v1/star/tip

Tip another user STAR with a required memo. Behaves like /api/v1/star/transfer (authorizeRouteRequest, then the HAM 'star.tip' turn, then the ledger tip, then finalization) but requires a memo. The ledger validates the memo: at most 140 characters, plus a memo policy check. A repeat after success returns 409.

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

  • star_tip_post: callers human, external_agent; scopes account:write; mutation class none.

Parameters

NameInRequiredTypeDescription
x-correlation-idheadernostring

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "idempotencyKey",
    "recipientId",
    "amount",
    "memo"
  ],
  "properties": {
    "idempotencyKey": {
      "type": "string",
      "minLength": 1
    },
    "recipientId": {
      "type": "string",
      "minLength": 1
    },
    "amount": {
      "type": "string",
      "description": "Decimal STAR; minimum 0.01."
    },
    "memo": {
      "type": "string",
      "minLength": 1,
      "maxLength": 140
    }
  }
}

Responses

  • 200: Raw object.

    application/json

    {
      "type": "object",
      "required": [
        "receipt",
        "ham"
      ],
      "properties": {
        "receipt": {
          "$ref": "#/components/schemas/LedgerReceipt"
        },
        "ham": {
          "type": "object",
          "properties": {
            "turnId": {
              "type": "string"
            },
            "sessionId": {
              "type": "string"
            },
            "receiptRefs": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "intentKind": {
              "const": "star.tip"
            }
          }
        }
      }
    }
  • 400: As for transfer, plus ERR_MEMO_REQUIRED, ERR_MEMO_TOO_LONG, and ERR_MEMO_POLICY_VIOLATION.

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "retryable": {
          "type": "boolean"
        },
        "details": {
          "type": "object"
        }
      }
    }
  • 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: {error, code:'world_unknown'|'session_unknown'}

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        }
      }
    }
  • 409: {error:'idempotency_conflict', message, turnId}, or HAM conflict codes.

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "turnId": {
          "type": "string"
        }
      }
    }
  • 422: {error, code} for other HAM failure codes.

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        }
      }
    }
  • 500: {error:'internal_error', message}

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 503: {error:'ledger_unconfigured'}

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        }
      }
    }

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

Contract authored from app/api/v1/star/tip/route.ts (confidence: medium).

star_transfer_post

POST /api/v1/star/transfer

Transfer STAR from the caller's wallet to another user. Authorizes with authorizeRouteRequest (human or external_agent; an external agent spends its owner's wallet). It records the mutation as a HAM turn ('star.transfer') in the sender's default HAM world, runs the ledger peer transfer, and finalizes the HAM turn; a ledger failure tombstones the turn. The recipient's wallet is created automatically if it does not exist. A repeated request with the same idempotencyKey and body after success returns 409, not the original result.

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

  • star_transfer_post: callers human, external_agent; scopes account:write; mutation class none.

Parameters

NameInRequiredTypeDescription
x-correlation-idheadernostringRecorded on the HAM bundle.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "idempotencyKey",
    "recipientId",
    "amount"
  ],
  "properties": {
    "idempotencyKey": {
      "type": "string",
      "minLength": 1,
      "description": "Global ledger idempotency key. Use a UUID."
    },
    "recipientId": {
      "type": "string",
      "minLength": 1,
      "description": "Recipient user id. Not validated against existing users."
    },
    "amount": {
      "type": "string",
      "description": "Decimal STAR amount; minimum 0.01."
    }
  }
}

Responses

  • 200: Raw object.

    application/json

    {
      "type": "object",
      "required": [
        "receipt",
        "ham"
      ],
      "properties": {
        "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": {
              "const": "star.transfer"
            }
          }
        }
      }
    }
  • 400: {error:'Invalid JSON'} or a required-field message; {error, code:'input_invalid'} from HAM; or a LedgerError {error: code, message, retryable, details}, for example ERR_INSUFFICIENT_BALANCE, ERR_SELF_TRANSFER, ERR_AMOUNT_BELOW_MINIMUM, ERR_INVALID_AMOUNT, ERR_RATE_LIMIT_EXCEEDED (400, not 429), ERR_IDEMPOTENCY_CONFLICT, ERR_SERIALIZATION_FAILURE.

    application/json

    {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "retryable": {
          "type": "boolean"
        },
        "details": {
          "type": "object"
        }
      }
    }
  • 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: Also {error, code:'capability_denied'} from HAM admission.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 404: {error, code:'world_unknown'} when the sender has no default HAM world, or code 'session_unknown'.

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        }
      }
    }
  • 409: {error:'idempotency_conflict', message, turnId}: a completed HAM turn exists for this key and body. Also {error, code} for idempotency_conflict, session_world_mismatch, or concurrency_conflict from HAM.

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "turnId": {
          "type": "string"
        }
      }
    }
  • 422: {error, code} for any other HAM failure code.

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        }
      }
    }
  • 500: {error:'internal_error', message}, including HAM finalization failure. An unconfigured ledger pool throws before the try block and produces Next's default 500.

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 503: {error:'ledger_unconfigured'}

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "const": "ledger_unconfigured"
        }
      }
    }

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

Contract authored from app/api/v1/star/transfer/route.ts (confidence: medium).