Skip to content
Start here

KV

KVNamespaces

List Namespaces
kv.namespaces.list(NamespaceListParams**kwargs) -> SyncV4PagePaginationArray[Namespace]
GET/accounts/{account_id}/storage/kv/namespaces
Get a Namespace
kv.namespaces.get(strnamespace_id, NamespaceGetParams**kwargs) -> Namespace
GET/accounts/{account_id}/storage/kv/namespaces/{namespace_id}
Create a Namespace
kv.namespaces.create(NamespaceCreateParams**kwargs) -> Namespace
POST/accounts/{account_id}/storage/kv/namespaces
Rename a Namespace
kv.namespaces.update(strnamespace_id, NamespaceUpdateParams**kwargs) -> Namespace
PUT/accounts/{account_id}/storage/kv/namespaces/{namespace_id}
Remove a Namespace
kv.namespaces.delete(strnamespace_id, NamespaceDeleteParams**kwargs) -> NamespaceDeleteResponse
DELETE/accounts/{account_id}/storage/kv/namespaces/{namespace_id}
Write multiple key-value pairs
kv.namespaces.bulk_update(strnamespace_id, NamespaceBulkUpdateParams**kwargs) -> NamespaceBulkUpdateResponse
PUT/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk
Delete multiple key-value pairs
kv.namespaces.bulk_delete(strnamespace_id, NamespaceBulkDeleteParams**kwargs) -> NamespaceBulkDeleteResponse
POST/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/delete
Get multiple key-value pairs
kv.namespaces.bulk_get(strnamespace_id, NamespaceBulkGetParams**kwargs) -> NamespaceBulkGetResponse
POST/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/get
ModelsExpand Collapse
class Namespace:
id: str

Namespace identifier tag.

maxLength32
title: str

A human-readable string name for a Namespace.

maxLength512
supports_url_encoding: Optional[bool]

True if keys written on the URL will be URL-decoded before storing. For example, if set to "true", a key written on the URL as "%3F" will be stored as "?".

class NamespaceDeleteResponse:
class NamespaceBulkUpdateResponse:
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 NamespaceBulkDeleteResponse:
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[NamespaceBulkGetResponse]
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.

KVNamespacesKeys

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.

KVNamespacesMetadata

Read the metadata for a key
kv.namespaces.metadata.get(strkey_name, MetadataGetParams**kwargs) -> object
GET/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/metadata/{key_name}

KVNamespacesValues

Read key-value pair
kv.namespaces.values.get(strkey_name, ValueGetParams**kwargs) -> BinaryResponseContent
GET/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}
Write key-value pair with optional metadata
kv.namespaces.values.update(strkey_name, ValueUpdateParams**kwargs) -> ValueUpdateResponse
PUT/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}
Delete key-value pair
kv.namespaces.values.delete(strkey_name, ValueDeleteParams**kwargs) -> ValueDeleteResponse
DELETE/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}
ModelsExpand Collapse
class ValueUpdateResponse:
class ValueDeleteResponse: