Manage keyspaces

Astra DB Serverless databases store data in collections and tables, which exist inside keyspaces.

Each Astra DB database must have at least one keyspace, and you can create more as needed. For example, you can categorize your data by data model or separate unique data from your other data.

Prerequisites

Keyspace name rules

Keyspace names must follow these rules:

  • Must start with a letter or number

  • Can contain letters, numbers, and underscores

  • Cannot exceed 48 characters.

  • Cannot be the reserved words dse or system

  • Must be unique within the database

Create a keyspace

In Astra DB Serverless databases, you use keyspaces to organize related collections and tables, similar to a schema in a relational database. For example, you can have different data models for each keyspace, store unique data in unique keyspaces, or use multiple keyspaces within a single region to build applications on a per-keyspace data model.

Every database has an initial keyspace, and you can create additional keyspaces. For Serverless (vector) databases, the initial keyspace is named default_keyspace.

You can use the Astra Portal, DevOps API, Data API clients, or Astra CLI to create keyspaces in Astra DB Serverless databases.

Astra DB doesn’t support the CQL CREATE KEYSPACE command.

Create a keyspace in the Astra Portal

The process to create a keyspace in the Astra Portal depends on the database type:

Serverless (vector) database
  1. In the Astra Portal, click the name of the database that you want to modify.

  2. Click Data Explorer.

  3. Click the Keyspace menu, and then select Create Keyspace.

  4. Enter a keyspace name.

  5. Click Create Keyspace.

Serverless (non-vector) database
  1. In the Astra Portal, click the name of the database that you want to modify.

  2. Click Add Keyspace.

  3. Enter a keyspace name.

  4. Click Add Keyspace.

The database enters Maintenance status while creating the keyspace. When the database returns to Active status, you can use the new keyspace. For example, you can create a collection or table in the keyspace.

Create a keyspace with the DevOps API

To create a keyspace with the DevOps API, use POST /v2/databases/DATABASE_ID/keyspaces/KEYSPACE_NAME:

curl -sS -L -X POST "https://api.astra.datastax.com/v2/databases/DATABASE_ID/keyspaces/KEYSPACE_NAME" \
--header "Authorization: Bearer APPLICATION_TOKEN" \
--header "Content-Type: application/json"

Replace the following:

For more information, see Create a keyspace.

The database enters Maintenance status while creating the keyspace. When the database returns to Active status, you can use the new keyspace. For example, you can create a collection or table in the keyspace.

Create a keyspace with the Astra CLI

Use the astra db create-keyspace command.

The database enters Maintenance status while creating the keyspace. When the database returns to Active status, you can use the new keyspace. For example, you can create a collection or table in the keyspace.

Create a keyspace with the Data API clients

You can use the Data API clients to create keyspaces in Astra DB Serverless databases. For more information and examples, see Create a keyspace.

Delete a keyspace

Deleting a keyspace permanently deletes all collections, tables, and data in the keyspace.

Programmatically, it is possible to delete all keyspaces in a database, but DataStax doesn’t recommend this.

You can use the Astra Portal, DevOps API, Data API clients, or Astra CLI to delete keyspaces in Astra DB Serverless databases.

Astra DB doesn’t support the CQL DROP KEYSPACE command.

Delete a keyspace in the Astra Portal

The process to delete a keyspace in the Astra Portal depends on the database type:

Serverless (vector) database
  1. In the Astra Portal, click the name of the database that you want to modify.

  2. Click Data Explorer.

  3. Click the Keyspace menu, find the keyspace that you want to delete, and then click Delete.

  4. To confirm deletion, enter the keyspace name, and then click Delete Keyspace.

Serverless (non-vector) database
  1. In the Astra Portal, click the name of the database that you want to modify.

  2. In the Keyspaces section, find the keyspace you want to delete, click More, and then click Delete.

  3. To confirm deletion, enter the keyspace name, and then click Delete Keyspace.

The database enters Maintenance status while it deletes the keyspace along with any collections, tables, and data within the keyspace.

Delete a keyspace with the DevOps API

To delete a keyspace with the DevOps API, use DELETE /v2/databases/DATABASE_ID/keyspaces/KEYSPACE_NAME:

curl -sS -L -X DELETE "https://api.astra.datastax.com/v2/databases/DATABASE_ID/keyspaces/KEYSPACE_NAME" \
--header "Authorization: Bearer APPLICATION_TOKEN" \
--header "Content-Type: application/json"

Replace the following:

For more information, see Drop a keyspace.

The database enters Maintenance status while it deletes the keyspace along with any collections, tables, and data within the keyspace.

Delete a keyspace with the Astra CLI

Use the astra db delete-keyspace command.

The database enters Maintenance status while it deletes the keyspace along with any collections, tables, and data within the keyspace.

Delete a keyspace with the Data API clients

You can use the Data API clients to delete keyspaces in Astra DB Serverless databases. For more information and examples, see Drop a keyspace.

The database enters Maintenance status while it deletes the keyspace along with any collections, tables, and data within the keyspace.

Troubleshoot keyspaces

CQL KEYSPACE command errors

CQL for Astra DB doesn’t support KEYSPACE commands. You must create and delete keyspaces through a non-CQL interface, such as the Astra Portal, DevOps API, or Astra CLI.

Data API client commands fail when passing namespace

Namespace is a deprecated term for a keyspace in a Serverless (vector) database. This term is no longer used in the Astra Portal, and namespace was deprecated in version 1.5 of the Data API clients.

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2026 | Privacy policy | Terms of use Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: Contact IBM