Dark Mode

This information applies to only classic databases.

Classic databases were created before 4 March 2021. These databases have fixed compute and storage capabilities and do not include the latest authentication version.

To authenticate your DataStax Astra DB classic database, generate an authorization token. You'll use this token to authenticate with your database and make additional requests, such as creating tables or adding rows.

Use the link:_attachments/restv2.html#operation/createToken[authorization] endpoint to generate the token. For the following examples, we'll use cURL commands. If you're making requests from your application, use the code samples described in the authorization endpoint details.

The authorization token is active for 30 minutes from the most recent request made. If no request has been made within 30 minutes, the authorization token expires.

  • Open a browser, navigate to Astra DB, and log in.
  • From your *Dashboard* page, select your database.
  • Copy the *Cluster ID of your database. You can also find the Cluster ID* in the URL, which is the last UUID in the path: https://astra.datastax.com/org/undefined/database/undefined
  • Add the *Cluster ID* as an environment variable with the following command:
  • 1
  • 1
  • Copy the *Region* of your database, the region where your database is located.
  • Add the *Region* as an environment variable with the following command:
  • 1
  • 1
  • Add your username, keyspace, and your password as environment variables with the following command:
  • 1
  • 1
  • Use printenv to ensure the environment variables were exported.
  • Run the entire cURL command with the values for your database:
  • 1

Consider using a tool like this Online UUID generator to quickly create a random UUID to pass with your authorization request.

An authorization token is returned:

  • 1
  • Copy the value of the returned authToken and store the authorization token in the ASTRAAUTHORIZATIONTOKEN environment variable:
  • 1
  • 1

The authorization token must be included when making requests to your database, such as creating tables, adding rows, or modifying columns.

  • If the authorization token expires, generate a new authorization token and update it in the ASTRAAUTHORIZATIONTOKEN environment variable.

What’s next?

You can now use your token to connect to the Astra DB APIs. See more about the available APIs: