Query

The Query API allows you to retrieve data from Telemetry. It accepts basic SQL, enabling you to query all available data using commands such as JOINS and UNIONS. These queries can return a wide range of data, from system metrics to user engagement.

POST https://api.telemetry.sh/query

Headers

NameTypeDescription

Content-Type

String

application/json

Authorization

String

<YOUR_API_KEY>

Body

NameTypeDescription

query

String

SQL Query you want to run

Example usage with cURL

To query the average Uber price grouped by city from the table named uber_rides using cURL, you can use the following command:

curl -X POST https://api.telemetry.sh/query \
  -H "Content-Type: application/json" \
  -H "Authorization: $API_KEY" \
  -d '{
    "query": "
      SELECT
        city,
        AVG(price) AS average_price
      FROM
        uber_rides
      GROUP BY
        city
      LIMIT
        10000;
    "
  }'

Using the JavaScript SDK

We recommend using our SDKs for a better developer experience. Here’s an example of how to use our JavaScript SDK:

const results = 
  await telemetry.query(`
    SELECT
      city,
      AVG(price)
    FROM
      uber_rides
    GROUP BY
      city
  `);

Last updated