Skip to content
helmstudio
Contents

kv

GET /kv/{ns}

List keys in a namespace, with sizes and modified times. No values.

07 §3. Ordered by key, ascending. The namespace `shared` is the shared namespace and needs `kv.shared` (Q21).

Needs the kv capability.

GoList(ctx context.Context, ns string, params *KVListParams) (*KVKeyPage, error)
Pythondef list(self, ns: str, *, prefix: Optional[Any] = None, limit: Optional[Any] = None, cursor: Optional[Any] = None) -> Any
JavaScriptlist(ns, params = {})
ParameterInTypeAbout
nspath · requiredstring
prefixquerystring
limitqueryinteger
cursorquerystringThe `next_cursor` of the previous page, unchanged.
StatusBodyMeans
200KVKeyPageA page of keys.
400ErrorThe request is malformed. Codes: `bad_request`, `bad_filter`, `bad_cursor`, `invalid_document`.
401ErrorNo studio token, or a revoked or unknown one. Code `unauthenticated`.
403ErrorThe token lacks a capability (`capability_required`, with `details.capability`), the job is not a task the studio may change (`not_a_task`), or the request came from another origin (`bad_origin`).

GET /kv/{ns}/{key}

Read one document.

Needs the kv capability.

GoGet(ctx context.Context, ns string, key string) (*KVDoc, error)
Pythondef get(self, ns: str, key: str) -> Any
JavaScriptget(ns, key)
ParameterInTypeAbout
nspath · requiredstring
keypath · requiredstring
StatusBodyMeans
200KVDocThe document. The ETag header equals `etag`.
401ErrorNo studio token, or a revoked or unknown one. Code `unauthenticated`.
403ErrorThe token lacks a capability (`capability_required`, with `details.capability`), the job is not a task the studio may change (`not_a_task`), or the request came from another origin (`bad_origin`).
404ErrorAbsent, deleted, or not the caller's to see. Code `not_found`.

PUT /kv/{ns}/{key}

Create or replace a document.

07 §3. The body is the document, a JSON object. With `If-Match`, the write happens only when the stored etag matches (409 `etag_mismatch` otherwise, and on a key that does not exist). Without it, the write is unconditional. Every successful write produces a new etag. The document's bytes count toward `kv_bytes` (Q20).

Needs the kv capability.

GoPut(ctx context.Context, ns string, key string, body map[string]any, params *KVPutParams) (*KVDoc, error)
Pythondef put(self, ns: str, key: str, body: Dict[str, Any], *, if_match: Optional[Any] = None) -> Any
JavaScriptput(ns, key, body, params = {})
ParameterInTypeAbout
nspath · requiredstring
keypath · requiredstring
If-MatchheaderstringThe etag last read. When given and stale, the write is refused with 409 `etag_mismatch`.

Request body: JSONObject (application/json)

StatusBodyMeans
200KVDocThe stored document.
400ErrorThe request is malformed. Codes: `bad_request`, `bad_filter`, `bad_cursor`, `invalid_document`.
401ErrorNo studio token, or a revoked or unknown one. Code `unauthenticated`.
403ErrorThe token lacks a capability (`capability_required`, with `details.capability`), the job is not a task the studio may change (`not_a_task`), or the request came from another origin (`bad_origin`).
409ErrorCodes: `etag_mismatch`, `name_taken`, `job_finished`, `already_running`, `not_running`, `port_conflict`, `heavy_conflict` (with `details.heavy`), `not_installed`, `conflict`, `in_use`, `missing`, `confirm_required` and `preview_changed` (with `details.preview`), `not_reclaimable`, and from M7: `approval_required` (with `details.approval`), `id_taken`, `not_fetched`, `already_exists`.
413ErrorThe body is over its limit. Code `too_large`, with `details.limit` in bytes.
429ErrorA per-studio quota is full. Code `quota_exceeded`, with `details` as QuotaDetails.

PATCH /kv/{ns}/{key}

Apply a JSON merge patch (RFC 7396) to an existing document.

07 §3. A `null` member removes that member. `If-Match` as for PUT.

Needs the kv capability.

GoPatch(ctx context.Context, ns string, key string, body map[string]any, params *KVPatchParams) (*KVDoc, error)
Pythondef patch(self, ns: str, key: str, body: Dict[str, Any], *, if_match: Optional[Any] = None) -> Any
JavaScriptpatch(ns, key, body, params = {})
ParameterInTypeAbout
nspath · requiredstring
keypath · requiredstring
If-MatchheaderstringThe etag last read. When given and stale, the write is refused with 409 `etag_mismatch`.

Request body: JSONObject (application/merge-patch+json)

StatusBodyMeans
200KVDocThe patched document.
400ErrorThe request is malformed. Codes: `bad_request`, `bad_filter`, `bad_cursor`, `invalid_document`.
401ErrorNo studio token, or a revoked or unknown one. Code `unauthenticated`.
403ErrorThe token lacks a capability (`capability_required`, with `details.capability`), the job is not a task the studio may change (`not_a_task`), or the request came from another origin (`bad_origin`).
404ErrorAbsent, deleted, or not the caller's to see. Code `not_found`.
409ErrorCodes: `etag_mismatch`, `name_taken`, `job_finished`, `already_running`, `not_running`, `port_conflict`, `heavy_conflict` (with `details.heavy`), `not_installed`, `conflict`, `in_use`, `missing`, `confirm_required` and `preview_changed` (with `details.preview`), `not_reclaimable`, and from M7: `approval_required` (with `details.approval`), `id_taken`, `not_fetched`, `already_exists`.
413ErrorThe body is over its limit. Code `too_large`, with `details.limit` in bytes.
429ErrorA per-studio quota is full. Code `quota_exceeded`, with `details` as QuotaDetails.

DELETE /kv/{ns}/{key}

Remove a document.

07 §3. With `If-Match`, only when the etag matches. Deleting a key that does not exist is 404.

Needs the kv capability.

GoDelete(ctx context.Context, ns string, key string, params *KVDeleteParams) error
Pythondef delete(self, ns: str, key: str, *, if_match: Optional[Any] = None) -> Any
JavaScriptdelete(ns, key, params = {})
ParameterInTypeAbout
nspath · requiredstring
keypath · requiredstring
If-MatchheaderstringThe etag last read. When given and stale, the write is refused with 409 `etag_mismatch`.
StatusBodyMeans
204Removed.
401ErrorNo studio token, or a revoked or unknown one. Code `unauthenticated`.
403ErrorThe token lacks a capability (`capability_required`, with `details.capability`), the job is not a task the studio may change (`not_a_task`), or the request came from another origin (`bad_origin`).
404ErrorAbsent, deleted, or not the caller's to see. Code `not_found`.
409ErrorCodes: `etag_mismatch`, `name_taken`, `job_finished`, `already_running`, `not_running`, `port_conflict`, `heavy_conflict` (with `details.heavy`), `not_installed`, `conflict`, `in_use`, `missing`, `confirm_required` and `preview_changed` (with `details.preview`), `not_reclaimable`, and from M7: `approval_required` (with `details.approval`), `id_taken`, `not_fetched`, `already_exists`.