Toggle Menu

Accessing Cassandra with the Stargate Document API

Modern applications are built on APIs, and JSON documents are the most common way of expressing data payloads on those APIs. Stargate makes it easy to serve a document-style API directly from any Cassandra database, allowing you to save and search schemaless JSON documents. This is a big deal, because the traditional practice for Cassandra has been to define all your schema up front.

What Is A Document API?

What Is A Document API?

A Document API represents your data as JSON documents organized in collections, similar to document databases such as MongoDB. Interact with data stored in collections with familiar HTTP methods (GET/PUT/POST/DELETE) to work directly with your JSON documents, without having to learn a new database query language. To use the API, you create a namespace for your application, which can contain one or more named collections, which in turn can contain multiple documents. The documents can have similar or different structures - that’s entirely up to your application and how you want to represent the data!

Next concept: Why use the Document API with Cassandra?

Why Use The Document API With Cassandra?

Stargate is an open source data gateway deployed between client applications and a database. This open-source API framework gives fullstack developers native JSON support which you can then combine with the reliability and scalability of Cassandra. The Documents API builds on the Stargate REST API. Stargate acts as a gateway, handling the details of how your documents are stored in Cassandra. For Javascript developers, the Stargate JavaScript SDK is a great way to get started. 

Next concept: How to get the Stargate Document API
Why Use The Document API With Cassandra?
How To Get The Stargate Document API

How To Get The Stargate Document API

Stargate is now available in DataStax Astra. If you have an Astra database, the Stargate GraphQL API is already enabled. If you don’t have a Cassandra cluster and want one, you can set up a database for free at If you have access to your own self-hosted Cassandra cluster, see the Stargate documentation for a quickstart guide for installing and using the Document API.

Check out DataStax’s BattleStax demo application, a fullstack app that uses Stargate’s Document API, Astra, and Netlify.

Next: Try it out

Try It Out

With the Stargate Document API you can save and search schemaless JSON documents in Cassandra. Here’s two ways you can try it yourself.

Explore The Stargate Document API In DataStax Astra With The Battlestax Sample App.

Try on Astra
Explore The Stargate Document API In DataStax Astra With The Battlestax Sample App.

Stargate Document API on Astra

Getting started using the Stargate Document API on Astra.


Built around JSON-like documents, document model databases are both natural and flexible for developers to work with.

The Stargate open source project provides an API layer that allows you to expose a document-style API on top of any Cassandra database.

Astra now offers offers a Document API via Stargate, which allows you to use your Astra database as a document database. Create collections, add documents and modify them within your database.

In this scenario we will:

  • Create a new collection and add a document
  • Read the document back from the database
  • Read a subdocument from the database
  • Update a document
  • Replace a subdocument
  • Delete a document from the database

Before we begin

As a prerequisite, be sure to setup an Astra account and create a Cassandra as a Service database at

Let's get started with Stargate Document API on Astra!


Time to Complete





Want to keep going? Try another scenario.

Stargate JS SDK

BattleStax: Creating a Serverless REST Endpoint.


More Resources

Items releated to Stargate Document API

Everything you need to get up to speed on all things Stargate.

Learn More
Stargate Discord Server

Stargate Discord Server

Join our discord room to chat with the contributors and meet the community.

Start Learning


Learn about how you can get involved in the Stargate project.

Read More