Connecting via the API

Using curl to connect with an API key

A quick and easy way to get started exploring is with cURL.

First, grab your API key by clicking "Connect" and then copying your API key (from the "Password" field; see below).


Then you can use the query API to query your databases or any public databases.

As an example, let's use the query API to download the first ten rows of a table. The query endpoint is You will need to pass your API key (see above) to query using the API. Note that, unlike in the previous version of, it is now necessary to include the database_name in the request.

curl --request POST \
     --url \
     --header "Authorization: Bearer ${API_KEY}" \
     --header "Accept: application/json" \
     --header "Content-Type: application/json" \
     --data '{"query_string":"SELECT * FROM mytable LIMIT 10;", "database_name":"GettingStarted/MyDatabase"}'

You can pipe the output of the above command to jq to optionally add JSON output formatting, as shown below:



Only one postgres command per query is supported

Did you received cannot insert multiple commands into a prepared statement? Only one command (i.e., one ;) is allowed per query submitted via the API.

Did this page help you?