---
title: Namespaces
---

[Skip to content](#%5Ftop) 

[API Reference](https://developers.cloudflare.com/api/typescript)

[KV](https://developers.cloudflare.com/api/typescript/resources/kv)

Copy Markdown

Open in **Claude**

Open in **ChatGPT**

Open in **Cursor**

---

**Copy Markdown**

**View as Markdown**

# Namespaces

##### [List Namespaces](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/methods/list)

client.kv.namespaces.list(NamespaceListParams { account\_id, direction, order, 2 more } params, RequestOptionsoptions?): V4PagePaginationArray<[Namespace](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces%20%3E%20%28model%29%20namespace%20%3E%20%28schema%29) { id, title, jurisdiction, supports\_url\_encoding } \>

GET/accounts/{account\_id}/storage/kv/namespaces

##### [Get a Namespace](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/methods/get)

client.kv.namespaces.get(stringnamespaceID, NamespaceGetParams { account\_id } params, RequestOptionsoptions?): [Namespace](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces%20%3E%20%28model%29%20namespace%20%3E%20%28schema%29) { id, title, jurisdiction, supports\_url\_encoding } 

GET/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}

##### [Create a Namespace](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/methods/create)

client.kv.namespaces.create(NamespaceCreateParams { account\_id, title, jurisdiction } params, RequestOptionsoptions?): [Namespace](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces%20%3E%20%28model%29%20namespace%20%3E%20%28schema%29) { id, title, jurisdiction, supports\_url\_encoding } 

POST/accounts/{account\_id}/storage/kv/namespaces

##### [Rename a Namespace](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/methods/update)

client.kv.namespaces.update(stringnamespaceID, NamespaceUpdateParams { account\_id, title } params, RequestOptionsoptions?): [Namespace](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces%20%3E%20%28model%29%20namespace%20%3E%20%28schema%29) { id, title, jurisdiction, supports\_url\_encoding } 

PUT/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}

##### [Remove a Namespace](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/methods/delete)

client.kv.namespaces.delete(stringnamespaceID, NamespaceDeleteParams { account\_id } params, RequestOptionsoptions?): [NamespaceDeleteResponse](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces%20%3E%20%28model%29%20namespace%5Fdelete%5Fresponse%20%3E%20%28schema%29) | null

DELETE/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}

##### [Write multiple key-value pairs](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/methods/bulk%5Fupdate)

client.kv.namespaces.bulkUpdate(stringnamespaceID, NamespaceBulkUpdateParams { account\_id, body } params, RequestOptionsoptions?): [NamespaceBulkUpdateResponse](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces%20%3E%20%28model%29%20namespace%5Fbulk%5Fupdate%5Fresponse%20%3E%20%28schema%29) { successful\_key\_count, unsuccessful\_keys } | null

PUT/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}/bulk

##### [Delete multiple key-value pairs](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/methods/bulk%5Fdelete)

client.kv.namespaces.bulkDelete(stringnamespaceID, NamespaceBulkDeleteParams { account\_id, body } params, RequestOptionsoptions?): [NamespaceBulkDeleteResponse](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces%20%3E%20%28model%29%20namespace%5Fbulk%5Fdelete%5Fresponse%20%3E%20%28schema%29) { successful\_key\_count, unsuccessful\_keys } | null

POST/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}/bulk/delete

##### [Get multiple key-value pairs](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/methods/bulk%5Fget)

client.kv.namespaces.bulkGet(stringnamespaceID, NamespaceBulkGetParams { account\_id, keys, type, withMetadata } params, RequestOptionsoptions?): [NamespaceBulkGetResponse](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces%20%3E%20%28model%29%20namespace%5Fbulk%5Fget%5Fresponse%20%3E%20%28schema%29) | null

POST/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}/bulk/get

##### ModelsExpand Collapse 

Namespace { id, title, jurisdiction, supports\_url\_encoding } 

id: string

Namespace identifier tag.

maxLength32

title: string

A human-readable string name for a Namespace.

maxLength512

jurisdiction?: "eu" | "fedramp" | "us"

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:

"eu"

"fedramp"

"us"

supports\_url\_encoding?: boolean

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

NamespaceDeleteResponse

NamespaceBulkUpdateResponse { 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.

NamespaceBulkDeleteResponse { 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.

NamespaceBulkGetResponse \= 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.

#### NamespacesKeys

##### [List a Namespace's Keys](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/subresources/keys/methods/list)

client.kv.namespaces.keys.list(stringnamespaceID, KeyListParams { account\_id, cursor, limit, prefix } params, RequestOptionsoptions?): CursorLimitPagination<[Key](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces.keys%20%3E%20%28model%29%20key%20%3E%20%28schema%29) { name, expiration, metadata } \>

GET/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}/keys

##### [Write multiple key-value pairs](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/subresources/keys/methods/bulk%5Fupdate)

Deprecated

client.kv.namespaces.keys.bulkUpdate(stringnamespaceID, KeyBulkUpdateParams { account\_id, body } params, RequestOptionsoptions?): [KeyBulkUpdateResponse](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces.keys%20%3E%20%28model%29%20key%5Fbulk%5Fupdate%5Fresponse%20%3E%20%28schema%29) { successful\_key\_count, unsuccessful\_keys } | null

PUT/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}/bulk

##### [Delete multiple key-value pairs](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/subresources/keys/methods/bulk%5Fdelete)

Deprecated

client.kv.namespaces.keys.bulkDelete(stringnamespaceID, KeyBulkDeleteParams { account\_id, body } params, RequestOptionsoptions?): [KeyBulkDeleteResponse](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces.keys%20%3E%20%28model%29%20key%5Fbulk%5Fdelete%5Fresponse%20%3E%20%28schema%29) { successful\_key\_count, unsuccessful\_keys } | null

POST/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}/bulk/delete

##### [Get multiple key-value pairs](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/subresources/keys/methods/bulk%5Fget)

Deprecated

client.kv.namespaces.keys.bulkGet(stringnamespaceID, KeyBulkGetParams { account\_id, keys, type, withMetadata } params, RequestOptionsoptions?): [KeyBulkGetResponse](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces.keys%20%3E%20%28model%29%20key%5Fbulk%5Fget%5Fresponse%20%3E%20%28schema%29) | 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.

#### NamespacesMetadata

##### [Read the metadata for a key](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/subresources/metadata/methods/get)

client.kv.namespaces.metadata.get(stringkeyName, MetadataGetParams { account\_id, namespace\_id } params, RequestOptionsoptions?): [MetadataGetResponse](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces.metadata%20%3E%20%28model%29%20metadata%5Fget%5Fresponse%20%3E%20%28schema%29)

GET/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}/metadata/{key\_name}

##### ModelsExpand Collapse 

MetadataGetResponse \= unknown

Arbitrary JSON that is associated with a key.

#### NamespacesValues

##### [Read key-value pair](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/subresources/values/methods/get)

client.kv.namespaces.values.get(stringkeyName, ValueGetParams { account\_id, namespace\_id } params, RequestOptionsoptions?): Response

GET/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}/values/{key\_name}

##### [Write key-value pair with optional metadata](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/subresources/values/methods/update)

client.kv.namespaces.values.update(stringkeyName, ValueUpdateParams { account\_id, namespace\_id, value, 3 more } params, RequestOptionsoptions?): [ValueUpdateResponse](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces.values%20%3E%20%28model%29%20value%5Fupdate%5Fresponse%20%3E%20%28schema%29) | null

PUT/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}/values/{key\_name}

##### [Delete key-value pair](https://developers.cloudflare.com/api/typescript/resources/kv/subresources/namespaces/subresources/values/methods/delete)

client.kv.namespaces.values.delete(stringkeyName, ValueDeleteParams { account\_id, namespace\_id } params, RequestOptionsoptions?): [ValueDeleteResponse](https://developers.cloudflare.com/api/typescript/resources/kv#%28resource%29%20kv.namespaces.values%20%3E%20%28model%29%20value%5Fdelete%5Fresponse%20%3E%20%28schema%29) | null

DELETE/accounts/{account\_id}/storage/kv/namespaces/{namespace\_id}/values/{key\_name}

##### ModelsExpand Collapse 

ValueUpdateResponse

ValueDeleteResponse