Skip to main content

Query your data

This section provides all the information you need to query your data. It covers the different query APIs and provides examples of various visualizations. You can test your GraphQL requests without writing a single line of code in our GraphQL Explorer.

Query APIs

Propel's query APIs are designed for powering various types of visualizations, as well as server-to-server use cases. Each API takes a different input and returns the data in a format optimized for its corresponding visualization.

Time Series

The Time Series API returns values and labels for every time granule over the requested relative or absolute time range.

Read the docs

GraphQL Time Series example query
# What was the daily revenue for El Buen Sabor for the last 30 days?
query TimeSeriesExample1($input: TimeSeriesInput!) {
timeSeries(input: $input) {


The Counter API returns a single value for the requested relative or absolute time range.

Read the docs

Counter metric example cardCounter metric example card
GraphQL Counter example query
# Compare the revenue for the last 30 days to the previous 30 days before that
query CounterExample1(
$revenueLast30DaysInput: CounterInput!
$revenuePrevious30DaysInput: CounterInput!
) {
revenueLast30Days: counter(input: $revenueLast30DaysInput) {
revenuePrevious30Days: counter(input: $revenuePrevious30DaysInput) {


The Leaderboard API returns an ordered list of aggregated values grouped by a given dimension.

Read the docs

GraphQL Leaderboard example query
# Find the top restaurants with the most revenue for the last 30 days.
query LeaderboardExample1($input: LeaderboardInput!) {
leaderboard(input: $input) {

Metric Report

The Metric Report API returns one or multiple metrics grouped by a common dimension.

Read the docs

Leaderboard metric example cardLeaderboard metric example card
GraphQL Metric Report example query
# Fetch a report showing the revenue and taco order
# count for the top performing restaurant-taco pairs.
query MetricReportExample($input: MetricReportInput!) {
metricReport(input: $input) {
pageInfo {

How to test your GraphQL query

Once you have a GraphQL query for your data that you want to test, there are a few ways to go about it.

1. GraphQL Explorer

You can check out our GraphQL Explorer, log in to your Propel account, and test your query there.

2. cURL or a similar tool

If you'd like to test your query with curl or a similar tool, you can first create an access token like so:

curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET"

You can find your client ID and secret on Propel Console in the Applications page.

Once you have your access token, you can use it to test your query like this:

curl -X POST \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"query": "query LeaderboardExample1($input: LeaderboardInput!) { leaderboard(input: $input) { headers rows }}",
"variables": {
"input": {
"metricName": "Revenue",
"sort": "DESC",
"timeRange": {
"relative": "LAST_N_DAYS",
"n": 30
"rowLimit": 10,
"dimensions": [
"columnName": "restaurant_name"
"filters": []

3. JavaScript

Here's an example of how you can run a GraphQL query using fetch in vanilla JavaScript.

const query = `
query LeaderboardExample1($input: LeaderboardInput!) {
leaderboard(input: $input) {

const variables = {
input: {
metricName: 'Revenue',
sort: 'DESC',
timeRange: {
relative: 'LAST_N_DAYS',
n: 30
rowLimit: 10,
dimensions: [{ columnName: 'restaurant_name' }],
filters: []

// Fetch access token
fetch('', {
method: 'post',
body: `grant_type=client_credentials&client_id=${process.env.CLIENT_ID}&client_secret=${process.env.SECRET}`
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
.then((response) => response.json())
.then((jsonData) => jsonData.access_token)

// Post the GraphQL query
.then((access_token) => {
return fetch('', {
method: 'POST',
headers: {
Authorization: `Bearer ${access_token}`,
'Content-Type': 'application/json'
body: JSON.stringify({ query, variables })
.then((response) => response.json())
.then((data) => console.log(data))

In production code, make sure not to expose your client ID and secret on the frontend.

For a more comprehensive example that shows you the whole flow from creating an OAuth 2.0 client, obtaining an access token, and running and processing a GraphQL query, you can check Propel Next.js Starter App.

Additional guides