Connecting to Retool

Retool is the fast way to build internal tools. It lets you visually design apps that interface with any database or API. You can connect a Cube deployment to Retool using Cube’s REST API.

Here's a short video guide on how to connect Retool to Cube.

Don't have a Cube project yet? Learn how to get started here.

Click the "How to connect" link on the Overview page, navigate to the REST API tab. You will see your connection credentials, the REST API URL and the authorization token:

For a Cube instance publicly available at a specific HOST, the REST API URL would be HOST/cubejs-api/v1. Please refer to the REST API page for details.

You will also need to generate a JSON Web Token that would be used to authenticate requests to Cube.

Please check the Security page to learn how to generate a token. We suggest generating a long-lived JWT that won't expire soon.

Create a new "REST API" resource in Retool.

Next, copy and paste Cube's REST API URL and the Authorization token.

Get your Cube query in the JSON query format ready. You can copy it from Cube’s Playground or compose manually:

Create a POST request, paste the JSON query in the Body. Make sure to add a query parameter for your JSON query.

Because the Cube REST API has the format of HOST/cubejs-api/v1, don't forget to add the /load endpoint to the end of the data source API.

Next, hit Run.

Retool has an amazing feature where you can drag and drop UI components into the dashboard. You can use this to add a tables, bar charts, and much more.

Because the name of the Retool query in the example is OrdersByMonth, using the data binding curly brackets will populate the charts with data from the REST API.

{{ OrdersByMonth.data.data }}

Reference the name of the query in your Retool charts.

Get nicely rendered charts.

Did you find this page useful?