Skip to content
Start here

Namespaces

List namespaces
client.KV.Namespaces.List(ctx, params) (*V4PagePaginationArray[Namespace], error)
GET/accounts/{account_id}/storage/kv/namespaces
Get a namespace
client.KV.Namespaces.Get(ctx, namespaceID, query) (*Namespace, error)
GET/accounts/{account_id}/storage/kv/namespaces/{namespace_id}
Create a namespace
client.KV.Namespaces.New(ctx, params) (*Namespace, error)
POST/accounts/{account_id}/storage/kv/namespaces
Rename a namespace
client.KV.Namespaces.Update(ctx, namespaceID, params) (*Namespace, error)
PUT/accounts/{account_id}/storage/kv/namespaces/{namespace_id}
Delete a namespace
client.KV.Namespaces.Delete(ctx, namespaceID, body) (*NamespaceDeleteResponse, error)
DELETE/accounts/{account_id}/storage/kv/namespaces/{namespace_id}
Write multiple key-value pairs
client.KV.Namespaces.BulkUpdate(ctx, namespaceID, params) (*NamespaceBulkUpdateResponse, error)
PUT/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk
Delete multiple key-value pairs
client.KV.Namespaces.BulkDelete(ctx, namespaceID, params) (*NamespaceBulkDeleteResponse, error)
POST/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/delete
Get multiple key-value pairs
client.KV.Namespaces.BulkGet(ctx, namespaceID, params) (*NamespaceBulkGetResponse, error)
POST/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/get
ModelsExpand Collapse
type Namespace struct{…}
ID string

ID of the Workers KV namespace.

maxLength32
Title string

Human-readable string name for a Workers KV namespace.

maxLength512
Jurisdiction NamespaceJurisdictionOptional

Specify the jurisdiction to restrict the KV namespace to durably store data within. Can only be set at namespace creation time.

One of the following:
const NamespaceJurisdictionEu NamespaceJurisdiction = "eu"
const NamespaceJurisdictionFedramp NamespaceJurisdiction = "fedramp"
const NamespaceJurisdictionUs NamespaceJurisdiction = "us"
Mode NamespaceModeOptional

The mode of the Workers KV namespace. Specify instant when creating a namespace to create a KV Instant namespace. Omit this field when creating a namespace to create a classic namespace. Currently, instant is the only supported explicit value.

SupportsURLEncoding boolOptional

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 ”?”.

NamespacesKeys

List keys in a namespace
client.KV.Namespaces.Keys.List(ctx, namespaceID, params) (*CursorLimitPagination[Key], error)
GET/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys
Write multiple key-value pairs
Deprecated
client.KV.Namespaces.Keys.BulkUpdate(ctx, namespaceID, params) (*NamespaceKeyBulkUpdateResponse, error)
PUT/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk
Delete multiple key-value pairs
Deprecated
client.KV.Namespaces.Keys.BulkDelete(ctx, namespaceID, params) (*NamespaceKeyBulkDeleteResponse, error)
POST/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/delete
Get multiple key-value pairs
Deprecated
client.KV.Namespaces.Keys.BulkGet(ctx, namespaceID, params) (*NamespaceKeyBulkGetResponse, error)
POST/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/get
ModelsExpand Collapse
type Key struct{…}

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 float64Optional

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 unknownOptional

Arbitrary JSON that is associated with a key.

NamespacesMetadata

Get a key's metadata
client.KV.Namespaces.Metadata.Get(ctx, namespaceID, keyName, query) (*NamespaceMetadataGetResponse, error)
GET/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/metadata/{key_name}

NamespacesValues

Get a key's value
client.KV.Namespaces.Values.Get(ctx, namespaceID, keyName, query) (*Response, error)
GET/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}
Write a key-value pair with optional metadata
client.KV.Namespaces.Values.Update(ctx, namespaceID, keyName, params) (*NamespaceValueUpdateResponse, error)
PUT/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}
Delete a key-value pair
client.KV.Namespaces.Values.Delete(ctx, namespaceID, keyName, body) (*NamespaceValueDeleteResponse, error)
DELETE/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}