The Guide for Time Series Data Projects is out.

Download now
Skip to content
Blog

Introducing API tokens for CrateDB Cloud

We're pleased to announce a new feature for CrateDB Cloud: API tokens.

This new functionality opens up a world of opportunities for our users and makes it easier than ever to programmatically integrate CrateDB Cloud into your existing workflows and applications.

An API token is a secure and convenient way to authenticate with our API. Instead of using a username and password, you can use a token to access the API and perform various management and monitoring actions. Tokens can be generated and revoked at any time, providing you with complete control over access to your Cloud console.  

Why Use the API?  

There are many reasons why you might use the API. Here are a few use cases we can think of:

  • Automated Management: Creation of conditional execution of calls. An example would be running a GET call to see the available storage on your cluster. If the storage is running low, execute a PUT call to expand the storage of a cluster.  
  • Integrating with Other Applications: With the public API access, you can easily integrate CrateDB Cloud into your existing applications and workflows. Whether using a custom application or a popular tool like Zapier or others, you can use an API token to manage your cluster.  
  • Visualization and Reporting: Similar to the previous example, you could create an alert when the storage is running low if you prefer to fix the issue manually. You can also collect the storage metrics or the CPU usage and visualize them over a given period.  

What can you do with the API?  

Almost anything that you can do in the UI! We have endpoints for the following systems:  

  • Organizations
  • Regions  
  • Clusters
  • Products
  • Users
  • Roles
  • Subscriptions   

All the available endpoints can be found in our API documentation.  

Getting Started

Getting started with the CrateDB Cloud API is very simple. A new key/secret can be created in your account settings. Make sure to safely store the secret, as you will only see it once upon creation. Also, keep in mind that any key is automatically deleted after 90 days of inactivity.  

After you have the key, simply go to our API documentation and figure out what you'd like to do.  

For example, you might want to display information about the current user. That can be done with this simple curl command:  

curl -s -u $your_key:$your_secret https://console.cratedb.cloud/api/v2/users/me/

The response will contain the available information of the user:  

{  

 "email": "some@example.com",  

 "hmac": "...",  

 "is_superuser": false,  

 "name": "Some User",  

 "organization_id": "123",  

 "status": "active",  

 "uid": "uid",  

 "username": "some@example.com"  

You can also create multiple keys for your organization. This prevents issues with the so-called "Key Rollover". With only 1 API key available at a time, your services can be disrupted if you need to delete or update your key for any reason. With multiple keys, you can easily switch between them to avoid this.

Conclusion

Public API access has been a strongly requested feature, so we're thrilled it's now available for our users. It is a powerful tool allowing users to manage all aspects of their CrateDB Cloud account programmatically. Whether you're automating management tasks, integrating with other systems, or creating custom dashboards, the API will make it all much easier.