Skip to main content

KvStore API

KV Store API

import { CodeBoltClient } from '@codebolt/clientsdk';

const client = new CodeBoltClient();

Quick Reference​

MethodDescription
createInstanceCreates a new KV store instance.
deleteInstanceDeletes a KV store instance and all its data.
deleteNamespaceDeletes all key-value pairs within a namespace.
deleteValueDeletes a single key-value pair from the store.
getInstanceRetrieves a specific KV store instance by its ID.
getValueRetrieves a value by its key within a specific namespace.
listInstancesLists all KV store instances.
queryQueries key-value data using filter criteria.
setValueSets a key-value pair in the store.
updateInstanceUpdates a KV store instance's configuration.

Methods​


createInstance​

client.kvStore.createInstance(data: CreateKvStoreInstanceRequest): Promise<KvStoreInstance>

Creates a new KV store instance.

An instance is an isolated key-value store that can contain multiple namespaces. Use separate instances to isolate data between different agents or workflows.

ParameterTypeRequiredDescription
dataCreateKvStoreInstanceRequestYesInstance creation payload including name and configuration

Returns: Promise<KvStoreInstance> — A promise that resolves to the newly created

Full reference →


deleteInstance​

client.kvStore.deleteInstance(id: string): Promise<unknown>

Deletes a KV store instance and all its data.

Permanently removes the instance, all its namespaces, and all stored key-value pairs. This action cannot be undone.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the instance to delete

Returns: Promise<unknown> — A promise that resolves when deletion is complete

Full reference →


deleteNamespace​

client.kvStore.deleteNamespace(instanceId: string, namespace: string): Promise<unknown>

Deletes all key-value pairs within a namespace.

Clears the entire namespace, removing every key and its associated value. Other namespaces in the instance are not affected.

ParameterTypeRequiredDescription
instanceIdstringYesThe unique identifier of the KV store instance
namespacestringYesThe namespace to delete

Returns: Promise<unknown> — A promise that resolves when the namespace has been cleared

Full reference →


deleteValue​

client.kvStore.deleteValue(instanceId: string, namespace: string, key: string): Promise<unknown>

Deletes a single key-value pair from the store.

Removes the specified key and its value from the namespace. Other keys in the same namespace are not affected.

ParameterTypeRequiredDescription
instanceIdstringYesThe unique identifier of the KV store instance
namespacestringYesThe namespace containing the key
keystringYesThe key to delete

Returns: Promise<unknown> — A promise that resolves when the key-value pair has been deleted

Full reference →


getInstance​

client.kvStore.getInstance(id: string): Promise<KvStoreInstance>

Retrieves a specific KV store instance by its ID.

Returns the full details of the instance including its configuration and namespace listing.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the KV store instance

Returns: Promise<KvStoreInstance> — A promise that resolves to the

Full reference →


getValue​

client.kvStore.getValue(instanceId: string, namespace: string, key: string): Promise<KvValue>

Retrieves a value by its key within a specific namespace.

Looks up a single key-value pair in the specified instance and namespace. Returns the value along with its metadata.

ParameterTypeRequiredDescription
instanceIdstringYesThe unique identifier of the KV store instance
namespacestringYesThe namespace containing the key
keystringYesThe key to look up

Returns: Promise<KvValue> — A promise that resolves to the including the stored data

Full reference →


listInstances​

client.kvStore.listInstances(params?: Record<string, unknown>): Promise<KvStoreInstance[]>

Lists all KV store instances.

Returns every instance in the system with their metadata and namespace information.

ParameterTypeRequiredDescription
paramsRecord<string, unknown>NoOptional query parameters for filtering or pagination

Returns: Promise<KvStoreInstance[]> — A promise that resolves to an array of objects

Full reference →


query​

client.kvStore.query(data: KvQueryRequest): Promise<KvValue[]>

Queries key-value data using filter criteria.

Searches across namespaces and keys using the provided filter parameters. Useful for finding values that match specific patterns or conditions.

ParameterTypeRequiredDescription
dataKvQueryRequestYesQuery parameters specifying filters and scope

Returns: Promise<KvValue[]> — A promise that resolves to an array of matching objects

Full reference →


setValue​

client.kvStore.setValue(data: SetKvValueRequest): Promise<KvValue>

Sets a key-value pair in the store.

Creates or overwrites a value at the specified key within a namespace and instance. The value can be any JSON-serializable data.

ParameterTypeRequiredDescription
dataSetKvValueRequestYesThe set request including instance ID, namespace, key, and value

Returns: Promise<KvValue> — A promise that resolves to the stored

Full reference →


updateInstance​

client.kvStore.updateInstance(id: string, data: UpdateKvStoreInstanceRequest): Promise<KvStoreInstance>

Updates a KV store instance's configuration.

Modifies instance properties such as name or settings. The stored data is not affected by instance updates.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the instance to update
dataUpdateKvStoreInstanceRequestYesThe fields to update

Returns: Promise<KvStoreInstance> — A promise that resolves to the updated

Full reference →