Starholder API
Operation Reference

KSLP Radio

5 operations tagged kslp-radio.

kslp_radio_playlists_get

GET /api/v1/kslp-radio/playlists

List the caller's KSLP radio playlists. A human session or the owner's API key (account:read), through authorizeRouteRequest; a key lists its owner's playlists. The owner's username, which addresses the playlist storage, comes from the owner's HAM user record (ham_users) for every credential, never from a request header. Lists the caller's playlists newest-updated first with an opaque keyset cursor. 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):

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

Parameters

NameInRequiredTypeDescription
limitquerynointeger (1–200, default 50)Out-of-range or non-integer values return 400.
cursorquerynostringOpaque base64url cursor from nextCursor.

Responses

  • 200: Raw object.

    application/json

    {
      "$ref": "#/components/schemas/KslpPlaylistListResponseV1"
    }
  • 400: KSLP_REQUEST_INVALID: bad limit or cursor. Error codes: KSLP_REQUEST_INVALID.

    application/json

    {
      "$ref": "#/components/schemas/KslpApiErrorV1"
    }
  • 401: Also KSLP_AUTH_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: ERR_ACCOUNT_RECORD_MISSING: the API key's owner has no HAM user record. Opening the inbox once while signed in to Starholder creates it. This error uses the platform shape, not the KSLP shape.

    application/json

    {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable"
          ],
          "properties": {
            "code": {
              "const": "ERR_ACCOUNT_RECORD_MISSING"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "const": false
            }
          }
        }
      }
    }
  • 503: KSLP_PLAYLIST_STORAGE_FAILED Error codes: KSLP_PLAYLIST_STORAGE_FAILED.

    application/json

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

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

Contract authored from app/api/v1/kslp-radio/playlists/route.ts (confidence: high).

kslp_radio_playlists_post

POST /api/v1/kslp-radio/playlists

Create a KSLP radio playlist (Idempotency-Key required). A human session or the owner's API key (account:write). Creates a playlist owned by the caller: the name is NFC-normalized and trimmed, and orderedRefs must be canonical refs. The Idempotency-Key header is required. Replaying the same key with the same request returns the stored playlist with replayed=true, and reusing the key with a different request returns 409. Writes are serialized with a Redis lock (15 s).

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

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

Parameters

NameInRequiredTypeDescription
Idempotency-Keyheaderyesstring

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "name",
    "orderedRefs"
  ],
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "description": "Non-empty after NFC normalization and trim."
    },
    "orderedRefs": {
      "type": "array",
      "description": "May be empty.",
      "items": {
        "type": "string",
        "pattern": "^[a-z][a-z0-9_-]*:[a-zA-Z0-9_-]+:[^:\\s]+$"
      }
    }
  }
}

Responses

  • 201: Created; replays also return 201.

    application/json

    {
      "type": "object",
      "required": [
        "playlist",
        "replayed"
      ],
      "properties": {
        "playlist": {
          "$ref": "#/components/schemas/KslpRadioPlaylistRecordV1"
        },
        "replayed": {
          "type": "boolean"
        }
      }
    }
  • 400: KSLP_REQUEST_INVALID (invalid JSON), KSLP_PLAYLIST_NAME_REQUIRED, KSLP_PLAYLIST_REFS_INVALID, or KSLP_IDEMPOTENCY_KEY_REQUIRED. Error codes: KSLP_REQUEST_INVALID, KSLP_PLAYLIST_NAME_REQUIRED, KSLP_PLAYLIST_REFS_INVALID, KSLP_IDEMPOTENCY_KEY_REQUIRED.

    application/json

    {
      "$ref": "#/components/schemas/KslpApiErrorV1"
    }
  • 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"
    }
  • 409: KSLP_IDEMPOTENCY_KEY_REUSED Error codes: KSLP_IDEMPOTENCY_KEY_REUSED.

    application/json

    {
      "$ref": "#/components/schemas/KslpApiErrorV1"
    }
  • 500: ERR_ACCOUNT_RECORD_MISSING: the API key's owner has no HAM user record. Opening the inbox once while signed in to Starholder creates it. This error uses the platform shape, not the KSLP shape.

    application/json

    {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable"
          ],
          "properties": {
            "code": {
              "const": "ERR_ACCOUNT_RECORD_MISSING"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "const": false
            }
          }
        }
      }
    }
  • 503: KSLP_PLAYLIST_CONCURRENCY_BUSY or KSLP_PLAYLIST_STORAGE_FAILED Error codes: KSLP_PLAYLIST_CONCURRENCY_BUSY, KSLP_PLAYLIST_STORAGE_FAILED.

    application/json

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

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

Contract authored from app/api/v1/kslp-radio/playlists/route.ts (confidence: high).

kslp_radio_playlists_item_get

GET /api/v1/kslp-radio/playlists/{playlistId}

Get one of the caller's KSLP radio playlists. A human session or the owner's API key (account:read). Loads the playlist from the caller's owner-scoped storage. Another user's playlist is indistinguishable from a missing one and returns 404. 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):

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

Parameters

NameInRequiredTypeDescription
playlistIdpathyesstring

Responses

  • 200: Raw object.

    application/json

    {
      "type": "object",
      "required": [
        "playlist"
      ],
      "properties": {
        "playlist": {
          "$ref": "#/components/schemas/KslpRadioPlaylistRecordV1"
        }
      }
    }
  • 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: KSLP_PLAYLIST_NOT_FOUND Error codes: KSLP_PLAYLIST_NOT_FOUND.

    application/json

    {
      "$ref": "#/components/schemas/KslpApiErrorV1"
    }
  • 500: ERR_ACCOUNT_RECORD_MISSING: the API key's owner has no HAM user record. Opening the inbox once while signed in to Starholder creates it. This error uses the platform shape, not the KSLP shape.

    application/json

    {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable"
          ],
          "properties": {
            "code": {
              "const": "ERR_ACCOUNT_RECORD_MISSING"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "const": false
            }
          }
        }
      }
    }
  • 503: KSLP_PLAYLIST_STORAGE_FAILED Error codes: KSLP_PLAYLIST_STORAGE_FAILED.

    application/json

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

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

Contract authored from app/api/v1/kslp-radio/playlists/[playlistId]/route.ts (confidence: high).

kslp_radio_playlists_item_patch

PATCH /api/v1/kslp-radio/playlists/{playlistId}

Update a playlist's name or refs with optimistic concurrency. A human session or the owner's API key (account:write). Requires the Idempotency-Key header and expectedRevision; the update applies only when expectedRevision equals the current revision, and the revision is then incremented. At least one of name or orderedRefs must be supplied. Replays are recognized only against the most recent mutation's key and request hash.

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

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

Parameters

NameInRequiredTypeDescription
playlistIdpathyesstring
Idempotency-Keyheaderyesstring

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "expectedRevision"
  ],
  "anyOf": [
    {
      "required": [
        "name"
      ]
    },
    {
      "required": [
        "orderedRefs"
      ]
    }
  ],
  "properties": {
    "expectedRevision": {
      "type": "integer",
      "minimum": 1
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "orderedRefs": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z][a-z0-9_-]*:[a-zA-Z0-9_-]+:[^:\\s]+$"
      }
    }
  }
}

Responses

  • 200: Raw object; replays return replayed=true.

    application/json

    {
      "type": "object",
      "required": [
        "playlist",
        "replayed"
      ],
      "properties": {
        "playlist": {
          "$ref": "#/components/schemas/KslpRadioPlaylistRecordV1"
        },
        "replayed": {
          "type": "boolean"
        }
      }
    }
  • 400: KSLP_REQUEST_INVALID (invalid JSON, bad expectedRevision, nothing to change), KSLP_PLAYLIST_NAME_REQUIRED, KSLP_PLAYLIST_REFS_INVALID, or KSLP_IDEMPOTENCY_KEY_REQUIRED. Error codes: KSLP_REQUEST_INVALID, KSLP_PLAYLIST_NAME_REQUIRED, KSLP_PLAYLIST_REFS_INVALID, KSLP_IDEMPOTENCY_KEY_REQUIRED.

    application/json

    {
      "$ref": "#/components/schemas/KslpApiErrorV1"
    }
  • 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: KSLP_PLAYLIST_NOT_FOUND Error codes: KSLP_PLAYLIST_NOT_FOUND.

    application/json

    {
      "$ref": "#/components/schemas/KslpApiErrorV1"
    }
  • 409: KSLP_PLAYLIST_REVISION_CONFLICT (with error.currentRevision) or KSLP_IDEMPOTENCY_KEY_REUSED. Error codes: KSLP_PLAYLIST_REVISION_CONFLICT, KSLP_IDEMPOTENCY_KEY_REUSED.

    application/json

    {
      "$ref": "#/components/schemas/KslpApiErrorV1"
    }
  • 500: ERR_ACCOUNT_RECORD_MISSING: the API key's owner has no HAM user record. Opening the inbox once while signed in to Starholder creates it. This error uses the platform shape, not the KSLP shape.

    application/json

    {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "retryable"
          ],
          "properties": {
            "code": {
              "const": "ERR_ACCOUNT_RECORD_MISSING"
            },
            "message": {
              "type": "string"
            },
            "retryable": {
              "const": false
            }
          }
        }
      }
    }
  • 503: KSLP_PLAYLIST_CONCURRENCY_BUSY or KSLP_PLAYLIST_STORAGE_FAILED Error codes: KSLP_PLAYLIST_CONCURRENCY_BUSY, KSLP_PLAYLIST_STORAGE_FAILED.

    application/json

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

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

Contract authored from app/api/v1/kslp-radio/playlists/[playlistId]/route.ts (confidence: high).

kslp_radio_playlists_item_delete

DELETE /api/v1/kslp-radio/playlists/{playlistId}

Delete a playlist at an expected revision. A human session or the owner's API key (account:write); a key's request is confirmation-gated. Requires a JSON body containing expectedRevision, which is unusual for DELETE. The playlist is deleted only when expectedRevision matches the current revision. Deleting a missing or foreign playlist also returns 204. The Idempotency-Key header 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):

  • kslp_radio_playlists_item_delete: callers human, external_agent; scopes account:write; 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
playlistIdpathyesstring
X-Starholder-ConfirmationheadernostringThe confirmationId from this operation's 428 response. Send it with the otherwise identical request to execute that request once.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "expectedRevision"
  ],
  "properties": {
    "expectedRevision": {
      "type": "integer",
      "minimum": 1
    }
  }
}

Responses

  • 204: Deleted, or the playlist does not exist or is not visible to the caller. No body.

  • 400: KSLP_REQUEST_INVALID: missing or invalid JSON body or expectedRevision. Error codes: KSLP_REQUEST_INVALID.

    application/json

    {
      "$ref": "#/components/schemas/KslpApiErrorV1"
    }
  • 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"
    }
  • 409: KSLP_PLAYLIST_REVISION_CONFLICT with error.currentRevision. Error codes: KSLP_PLAYLIST_REVISION_CONFLICT.

    application/json

    {
      "$ref": "#/components/schemas/KslpApiErrorV1"
    }
  • 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"
    }
  • 503: KSLP_PLAYLIST_CONCURRENCY_BUSY or KSLP_PLAYLIST_STORAGE_FAILED Also ERR_CONFIRMATION_UNAVAILABLE, in the standard error envelope, when the server cannot record that a confirmation was used; the delete did not run. Error codes: KSLP_PLAYLIST_CONCURRENCY_BUSY, KSLP_PLAYLIST_STORAGE_FAILED, ERR_CONFIRMATION_UNAVAILABLE.

    application/json

    {
      "oneOf": [
        {
          "$ref": "#/components/schemas/KslpApiErrorV1"
        },
        {
          "$ref": "#/components/schemas/AesErrorEnvelope"
        }
      ]
    }

Schemas used: #/components/responses/ConfirmationRequired, #/components/responses/Forbidden, #/components/responses/Unauthenticated, AesErrorEnvelope, KslpApiErrorV1

Contract authored from app/api/v1/kslp-radio/playlists/[playlistId]/route.ts (confidence: high).