Getting Started

The first step to get started with the SQL API in Cube Cloud is to create a deployment. You can follow this step-by-step guide on creating a deployment within Cube Cloud.

Once the deployment is ready, click How to connect link on the Overview page. It will open a modal with instructions on different ways to connect to Cube. Navigate to the SQL API tab and enable the SQL API.

Once it is enabled, you should see a screen like the one below with your connection credentials.

Since the Cube SQL API is Postgres-compatible, please make sure to select Postgres as a database type when connecting from BI tools.

To enable the SQL API, we first need to add a new environment variable:


If you're running Cube through Docker Compose, remember to add a port mapping to the Cube service for CUBEJS_PG_SQL_PORT:

    image: cubejs/cube
      - 5432:5432 # Cube SQL API

Or if running Docker from command line:

docker run -p 4000:4000 -p 5432:5432 \
  -v ${PWD}:/cube/conf \
  -e CUBEJS_DEV_MODE=true \
  -e CUBEJS_PG_SQL_PORT=5432 \

Then, set Cube SQL credentials auth:


Now, you can start your Cube instance and connect via the psql client with provided credentials:

psql -h --port 5432 -U myusername --password

Did you find this page useful?