Get an Astra DB admin (TypeScript)
The Data API clients use the Astra DB Admin class to perform administrative operations like creating and dropping databases.
To perform administrative actions within a specific database, see Get a database admin (TypeScript) instead.
The Astra DB Admin class name varies by client.
The TypeScript client uses AstraAdmin.
|
You need an application token with permission to create and configure databases, such as the Organization Administrator role. For more information, see Get endpoint and token. |
Result
Returns an AstraAdmin object that can perform administrative actions.
Signature
Use the admin method, which belongs to the DataAPIClient class.
admin(options?: AdminOptions): AstraAdmin
Parameters
Parameters:
| Name | Type | Summary |
|---|---|---|
|
Optional. A specification of options to override the inherited defaults. Use this to customize the interaction of the client with the admin object. For example, you can change the default timeouts or token. |
Examples
The following examples demonstrate how to get an Astra DB admin.
import { DataAPIClient } from "@datastax/astra-db-ts";
// Get an admin object
const client = new DataAPIClient("APPLICATION_TOKEN");
const admin = client.admin();
Errors
For a full list of Data API error codes and their corresponding messages, see Data API errors and error codes.
For more information about how the client handles underlying Data API errors, see TypeScript client error handling.
Client reference
For more information, see the client reference.