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.

To perform administrative actions outside of a specific database, see Get an Astra DB admin (TypeScript) instead.

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

You need an application token with permission to interact with the target database, such as the Database Administrator role.

For more information, see Get endpoint and token.

Result

Returns an AstraDbAdmin 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?: "astra"
  }
): AstraDbAdmin
Name Type Summary

environment

DataAPIEnvironment

Optional. Only for the admin method of the Db class.

The database’s environment. Must be astra or unspecified.

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.

Alternatively, use the dbAdmin method, which belongs to the AstraDbAdmin class.

Alternative method signature and parameters
dbAdmin(
  endpoint: string,
  options?: DbOptions
): AstraDbAdmin
dbAdmin(
  id: string,
  region: string,,
  options?: DbOptions
): AstraDbAdmin
Name Type Summary

endpoint

string

The database’s API endpoint, typically formatted as \https://DATABASE_ID-REGION.apps.astra.datastax.com.

id

string

The database’s ID.

region

string

The database’s region.

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 } from "@datastax/astra-db-ts";

// Get a database object
const client = new DataAPIClient();
const database = client.db("API_ENDPOINT", {
  token: "APPLICATION_TOKEN",
});

// Get a database admin object
const databaseAdmin = database.admin();

Get a database admin from an admin

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

// Get an admin object
const client = new DataAPIClient("APPLICATION_TOKEN");
const admin = client.admin();

// Get a database admin object
const databaseAdmin = admin.dbAdmin("API_ENDPOINT");

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