Legacy APIs (deprecated)
The legacy APIs are deprecated for Astra DB Serverless as of September 2024, and end-of-life (EOL) is scheduled for the end of 2025. As EOL approaches, DataStax will provide migration information to support your transition to the DevOps and Data APIs. If you have questions or concerns, contact your account representative or DataStax Support. |
Several DataStax APIs were available before the 2023 release of the DataStax Data API.
If you use the legacy APIs, DataStax encourages you to explore the Data API and clients, which offer the following features and benefits:
-
AI-enabled, multi-region functionality designed for Astra DB Serverless databases.
-
High-demand features, such as vector searches with AI projections that return similarity scores.
-
No need for complex data modeling. Start coding applications quickly.
-
Leverage the scalability, performance, and real-time indexing capabilities of Astra DB Serverless and Apache Cassandra®.
Legacy Stargate APIs (deprecated)
Legacy Stargate APIs include the following:
-
Document API: If you use this API, DataStax recommends that you use the vector-enabled Data API.
-
REST API: Exposes CRUD access to data stored in Cassandra tables.
-
GraphQL API: Modifies and queries table data using GraphQL types, mutations, and queries with any Cassandra deployment.
-
gRPC API: A data gateway deployed between client applications and a database. The Stargate gRPC API is implemented to create language-specific queries using CQL with any Cassandra deployment.
Table-based authentication and authorization for legacy APIs
Table-based authentication and authorization uses the Stargate Auth API to generate an auth token based on a Cassandra username and password. The auth-table-based-service uses the generated auth token to allow Stargate API queries access to the Cassandra data.
By default, the token persists for 30 minutes with a sliding window. Each use of the token to authenticate resets the 30 minute window. A token created and used after 29 minutes will authenticate a request, but if 31 minutes passes before use, the token will no longer exist.
You can use the REST API to generate an auth token:
curl -L -X POST "https://ASTRA_DB_ID-ASTRA_DB_REGION.apps.astra.datastax.com/api/rest/v1/auth" \
-H "Content-Type: application/json" \
--data-raw '{
"username": "CLIENT_ID",
"password": "CLIENT_SECRET"
}'
A successful response includes the authentication token:
{ "authToken": "AUTH_TOKEN" }
You must provide this token in each subsequent request in the X-Cassandra-Token
header.
You can provide the token directly in the header or export it as an environment variable.
-
REST or Document API (v2)
-
GraphQL
Store the auth token in an environment variable to make it easy to use with HTTP:
export AUTH_TOKEN=AUTH_TOKEN
Add the auth token to the HTTP Headers box in the GraphQL playground:
{ "X-Cassandra-Token": "AUTH_TOKEN" }