Skip to content
Start here

Keys

List a Namespace's Keys
client.kv.namespaces.keys.list(stringnamespaceId, KeyListParams { account_id, cursor, limit, prefix } params, RequestOptionsoptions?): CursorLimitPagination<Key { name, expiration, metadata } >
GET/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys
Write multiple key-value pairs
Deprecated
client.kv.namespaces.keys.bulkUpdate(stringnamespaceId, KeyBulkUpdateParams { account_id, body } params, RequestOptionsoptions?): KeyBulkUpdateResponse { successful_key_count, unsuccessful_keys } | null
PUT/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk
Delete multiple key-value pairs
Deprecated
client.kv.namespaces.keys.bulkDelete(stringnamespaceId, KeyBulkDeleteParams { account_id, body } params, RequestOptionsoptions?): KeyBulkDeleteResponse { successful_key_count, unsuccessful_keys } | null
POST/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/delete
Get multiple key-value pairs
Deprecated
client.kv.namespaces.keys.bulkGet(stringnamespaceId, KeyBulkGetParams { account_id, keys, type, withMetadata } params, RequestOptionsoptions?): KeyBulkGetResponse | null
POST/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/get
ModelsExpand Collapse
Key { name, expiration, metadata }

A name for a value. A value stored under a given key may be retrieved via the same key.

name: string

A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.

maxLength512
expiration?: number

The time, measured in number of seconds since the UNIX epoch, at which the key will expire. This property is omitted for keys that will not expire.

metadata?: unknown

Arbitrary JSON that is associated with a key.

KeyBulkUpdateResponse { successful_key_count, unsuccessful_keys }
successful_key_count?: number

Number of keys successfully updated.

unsuccessful_keys?: Array<string>

Name of the keys that failed to be fully updated. They should be retried.

KeyBulkDeleteResponse { successful_key_count, unsuccessful_keys }
successful_key_count?: number

Number of keys successfully updated.

unsuccessful_keys?: Array<string>

Name of the keys that failed to be fully updated. They should be retried.

KeyBulkGetResponse = WorkersKVBulkGetResult { values } | WorkersKVBulkGetResultWithMetadata { values } | null
One of the following:
WorkersKVBulkGetResult { values }
values?: Record<string, string | number | boolean | Record<string, unknown>>

Requested keys are paired with their values in an object.

One of the following:
string
number
boolean
Record<string, unknown>
WorkersKVBulkGetResultWithMetadata { values }
values?: Record<string, Values | null>

Requested keys are paired with their values and metadata in an object.

metadata: unknown

The metadata associated with the key.

value: unknown

The value associated with the key.

expiration?: number

Expires the key at a certain time, measured in number of seconds since the UNIX epoch.