> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Rename Namespace

> Renames a namespace of an index.

<Note>
  The default namespace, which is the empty string `""`, cannot be renamed.
</Note>

<Note>
  There should not be a namespace with the given new namespace name, unless the
  delete existing flag is passed.
</Note>

## Request

<ParamField body="namespace" type="string" required>
  The name of the namespace to rename.
</ParamField>

<ParamField body="newNamespace" type="string" required>
  The new name of the namespace.
</ParamField>

<ParamField body="deleteExisting" type="boolean" default="false">
  When the delete existing flag is passed, if there exists a namespace
  with the new namespace name, it is deleted before the rename operation.
</ParamField>

## Response

<ResponseField name="renamed" type="boolean">
  Whether the namespace is renamed or not.
</ResponseField>

<RequestExample>
  ```sh curl theme={"system"}
  curl $UPSTASH_VECTOR_REST_URL/rename-namespace \
    -X POST \
    -d '{ "namespace": "ns", "newNamespace": "newNs" }' \
    -H "Authorization: Bearer $UPSTASH_VECTOR_REST_TOKEN"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={"system"}
  {
      "result": { "renamed": true }
  }
  ```
</ResponseExample>
