Get a database admin (TypeScript)

The Data API clients use the Database Admin class to perform administrative operations, like managing keyspaces, within a specific database.

The Database Admin class name varies by client. The TypeScript client uses DataAPIDbAdmin.

Result

Returns a DataAPIDbAdmin object that can perform administrative actions on the specified database.

Parameters

Use the admin method, which belongs to the Db class.

Method signature
admin(
  options?: AdminOptions & {
    environment?: string
  }
): DataAPIDbAdmin
Name Type Summary

environment

DataAPIEnvironment

Only for the admin method of the Db class.

The database’s environment. Can be one of: dse, hcd, cassandra, other.

options

DbOptions

Optional. A specification of options to override the inherited defaults. Use this to customize the interaction of the client with the database admin. For example, you can change the default timeouts or token.

Examples

The following examples demonstrate how to get a database admin object.

Get a database admin from a database

import {
  DataAPIClient,
  UsernamePasswordTokenProvider,
} from "@datastax/astra-db-ts";

// Get a database object
const client = new DataAPIClient({ environment: "hcd" });
const database = client.db("API_ENDPOINT", {
  token: new UsernamePasswordTokenProvider("USERNAME", "PASSWORD"),
});

// Get a database admin object
const databaseAdmin = database.admin({ environment: "hcd" });

Client reference

For more information, see the client reference.

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