Search + K

Command Palette

Search for a command to run...

Sign In

Create a Namespace

POST /accounts/{account_id}/storage/kv/namespaces
Copy endpoint
https://api.cloudflare.com/client/v4

Creates a namespace under the given title. A 400 is returned if the account already owns a namespace with this title. A namespace must be explicitly deleted to be replaced.

Parameters

path Path Parameters

Name Type
account_id required
type WorkersKvIdentifier = string

Request Body

application/json required
interface WorkersKvCreateRenameNamespaceBody {
title: WorkersKvNamespaceTitle

A human-readable string name for a Namespace.

type WorkersKvNamespaceTitle = string
;
}

Responses

200 application/json

Create a Namespace response.

interface WorkersKvApiResponseCommon {
errors: WorkersKvMessages
type WorkersKvMessages = { code: number;message: string; }[]
;
messages: WorkersKvMessages
type WorkersKvMessages = { code: number;message: string; }[]
;
success: true;
}
& { result?: WorkersKvNamespace
interface WorkersKvNamespace {
id: WorkersKvNamespaceIdentifier;
supports_url_encoding?: boolean;
title: WorkersKvNamespaceTitle;
}
; }

Client Errors

4XX application/json

Create a Namespace response failure.

interface WorkersKvApiResponseCommonFailure {
errors: WorkersKvMessages
type WorkersKvMessages = { code: number;message: string; }[]
;
messages: WorkersKvMessages
type WorkersKvMessages = { code: number;message: string; }[]
;
result: {} | null;
success: false;
}