Generate client-facing APIs

Get client-facing APIs with JSON, CSV or TSV for your saved queries.

Go to Warehouse -> Queries as APIs -> Create query.

Creating a client-facing API

Here, you can select your JSON events or time series source, and query your data. We'll give you a quick visualization along with the full results.

Visualization and data

As soon as the query is saved, we'll generate a secure publicly-accessible URL you can use as API 🚀

You can regenerate the URL at any time.

JSON, CSV or TSV

Adjust the API to use a different Format.

Adjusting format

For your convenience, we always generate API for all supported formats:

JSON export CSV export TSV export
curl "https://$CLUSTER.betterstackdata.com/query/$SECRET.json"
curl "https://$CLUSTER.betterstackdata.com/query/$SECRET.csv"
curl "https://$CLUSTER.betterstackdata.com/query/$SECRET.tsv"

Pass variables into your saved queries

Specify any {{variable}}, e.g. {{currency}}, in your SQL query and we'll parameterize your API automatically.

Define variables in your API

And set the value of currency as a query parameter when calling the API:

Pass variable in URL Use --data-urlencode Multiple variables
curl "https://$CLUSTER.betterstackdata.com/query/$SECRET.json?currency=EUR"
curl "https://$CLUSTER.betterstackdata.com/query/$SECRET.json" \
  --get \
  --data-urlencode "currency=EUR"
curl "https://$CLUSTER.betterstackdata.com/query/$SECRET.json" \
  --get \
  --data-urlencode "currency=EUR"
  --data-urlencode "country=DE"

You can even use multiple variables in a single query!

Optimized for high request throughput

Better Stack Warehouse client-facing APIs are optimized for many HTTP requests. They will survive your website making it to the homepage of Reddit.

Customize cache frequency

Customize cache frequency