Skip to content
Start here

Keys

List a Namespace's Keys
kv.namespaces.keys.list(strnamespace_id, KeyListParams**kwargs) -> SyncCursorLimitPagination[Key]
GET/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys
Write multiple key-value pairs
Deprecated
kv.namespaces.keys.bulk_update(strnamespace_id, KeyBulkUpdateParams**kwargs) -> KeyBulkUpdateResponse
PUT/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk
Delete multiple key-value pairs
Deprecated
kv.namespaces.keys.bulk_delete(strnamespace_id, KeyBulkDeleteParams**kwargs) -> KeyBulkDeleteResponse
POST/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/delete
Get multiple key-value pairs
Deprecated
kv.namespaces.keys.bulk_get(strnamespace_id, KeyBulkGetParams**kwargs) -> KeyBulkGetResponse
POST/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/get
ModelsExpand Collapse
class Key:

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

name: str

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: Optional[float]

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: Optional[object]

Arbitrary JSON that is associated with a key.

class KeyBulkUpdateResponse:
successful_key_count: Optional[float]

Number of keys successfully updated.

unsuccessful_keys: Optional[List[str]]

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

class KeyBulkDeleteResponse:
successful_key_count: Optional[float]

Number of keys successfully updated.

unsuccessful_keys: Optional[List[str]]

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

Optional[KeyBulkGetResponse]
One of the following:
class WorkersKVBulkGetResult:
values: Optional[Dict[str, Union[str, float, bool, Dict[str, object]]]]

Requested keys are paired with their values in an object.

One of the following:
str
float
bool
Dict[str, object]
class WorkersKVBulkGetResultWithMetadata:
values: Optional[Dict[str, Optional[WorkersKVBulkGetResultWithMetadataValues]]]

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

metadata: object

The metadata associated with the key.

value: object

The value associated with the key.

expiration: Optional[float]

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