Starholder API
Operation Reference

Account

3 operations tagged account.

account_get

GET /api/v1/account

Get the caller's account profile, credential view, and directory. Resolves the caller through AuthBoundaryDispatcher (session headers, Bearer/x-api-key API key, or persona token), then authorizes against the account_get registry policy. Returns the owner userId, tenantId, worldCount (worlds the owning user owns in the HAM world registry, deleted worlds excluded; not the worlds this credential can read), a CallerCredentialView of the presented credential, and a CallerDirectory listing /api/v1 operations that pass credential-level gates for this caller, plus the published workflows (story.publish, chat.inbox) with each step marked callable for this credential, and roomDirectory: the room-link directory that lists the room operations, which authorize room participants and are not listed here. activeKeyCount is present only for human sessions. 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):

  • account_get: callers human, external_agent; caller must own the resource; mutation class none.

Parameters

NameInRequiredTypeDescription
X-Correlation-IdheadernostringEchoed in meta.correlationId and the X-Correlation-Id response header; generated (corr_*) if absent.

Responses

  • 200: Account profile. Response headers: Cache-Control: no-store, X-Correlation-Id.

    application/json

    {
      "type": "object",
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "properties": {
        "ok": {
          "const": true
        },
        "data": {
          "type": "object",
          "required": [
            "userId",
            "tenantId",
            "worldCount",
            "credential",
            "directory"
          ],
          "properties": {
            "userId": {
              "type": "string",
              "description": "Owner user id (for API keys, the key owner)."
            },
            "tenantId": {
              "type": "string"
            },
            "activeKeyCount": {
              "type": "integer",
              "description": "Only present for human sessions."
            },
            "worldCount": {
              "type": "integer",
              "description": "Worlds the owning user owns in the HAM world registry, in any lifecycle state but deleted. Not the worlds this credential can read or write: list those with GET /api/v1/world/management, which includes private worlds."
            },
            "credential": {
              "$ref": "#/components/schemas/CallerCredentialView"
            },
            "directory": {
              "$ref": "#/components/schemas/CallerDirectory"
            }
          }
        },
        "meta": {
          "type": "object",
          "required": [
            "correlationId"
          ],
          "properties": {
            "correlationId": {
              "type": "string"
            }
          }
        }
      }
    }
  • 401: Identity resolution failed; error.code from the validator (default ERR_AUTH_INVALID), in the standard 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: ERR_INTERNAL (retryable: true) in the standard error envelope. Error codes: ERR_INTERNAL.

    application/json

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

Schemas used: #/components/responses/Forbidden, #/components/responses/Unauthenticated, ApiErrorEnvelope, CallerCredentialView, CallerDirectory

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

account_api_keys_list

GET /api/v1/account/api-keys

List the owner's API keys. Resolves the caller through AuthBoundaryDispatcher (session or API key), then authorizes against the account_api_keys_list registry policy with the caller's own account as the resource owner. Lists every API key record the owner holds, in any status, sorted by updatedAtMs descending; an API key lists all of its owner's keys, itself included. keyHash is stripped. There is no pagination. 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):

  • account_api_keys_list: callers human, external_agent; scopes account:read; caller must own the resource; mutation class none.

Responses

  • 200: Raw object, not enveloped.

    application/json

    {
      "type": "object",
      "required": [
        "keys"
      ],
      "properties": {
        "keys": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ApiKeyRecordPublic"
          }
        }
      }
    }
  • 401: Identity resolution failed; error.code from the validator (default ERR_AUTH_INVALID), in the standard 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: ERR_INTERNAL (retryable: true) when key storage cannot be read, in the standard error envelope. A storage failure is never reported as an empty list. Error codes: ERR_INTERNAL.

    application/json

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

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

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

account_api_keys_revoke

POST /api/v1/account/api-keys/{keyId}/revoke

Revoke an API key. A human session or the owner's API key (account:write); a key may revoke any of its owner's keys, including itself, and its request is confirmation-gated. Resolves the caller through AuthBoundaryDispatcher, reads the key under the caller's own account, and authorizes against the account_api_keys_revoke registry policy with that key's owner as the resource owner. Sets the key to status revoked and invalidates its cache. Revoking an already-revoked key returns the same 200 response, so the call is idempotent. The request body is not read.

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

  • account_api_keys_revoke: callers human, external_agent; scopes account:write; caller must own the resource; mutation class none.

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
keyIdpathyesstring
X-Starholder-ConfirmationheadernostringThe confirmationId from this operation's 428 response. Send it with the otherwise identical request to execute that request once.

Responses

  • 200: Raw object, not enveloped.

    application/json

    {
      "type": "object",
      "required": [
        "keyId",
        "status"
      ],
      "properties": {
        "keyId": {
          "type": "string"
        },
        "status": {
          "const": "revoked"
        }
      }
    }
  • 400: ERR_AUTH_INVALID 'Missing keyId'. Error codes: ERR_AUTH_INVALID.

    application/json

    {
      "$ref": "#/components/schemas/ApiErrorEnvelope"
    }
  • 401: Identity resolution failed; error.code from the validator (default ERR_AUTH_INVALID), in the standard error envelope.

    application/json

    {
      "oneOf": [
        {
          "$ref": "#/components/schemas/AesErrorEnvelope"
        },
        {
          "type": "object",
          "required": [
            "error"
          ],
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        }
      ]
    }
  • 403: The registry denial (not a human session, or account:write missing), or ERR_AUTH_FORBIDDEN 'Key not found or not owned by caller' when no such key exists under the caller's account (no 404).

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 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"
    }
  • 500: ERR_AUTH_INVALID 'Internal error'. Error codes: ERR_AUTH_INVALID.

    application/json

    {
      "$ref": "#/components/schemas/ApiErrorEnvelope"
    }
  • 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/Unauthenticated, ApiErrorEnvelope

Contract authored from app/api/v1/account/api-keys/[keyId]/revoke/route.ts (confidence: high).