Recurring Queries
Learn how to use our six recurring query endpoints to submit a new query, check the query run status, fetch query results and manage existing queries.
Recurring queries are only submitted once, but they continue to generate new reports for every calendar day, week, or month. This is a good option for teams that want to pull in the same traffic data with every day, week, or month that passes. The query start and end times are defined by the selected date range option:
Daily recurring queries (
date_range=day
) return data for the previous 24-hour calendar day based on your selected timezone for the query. These queries begin a new run at 12:01AM each day for their selected timezone, and should be completed (available to fetch) by 4AM.Weekly recurring queries (
date_range=week
) return data for the previous 7-day calendar week (12:00AM Monday - 11:59PM Sunday) based on your selected timezone for the query. These queries begin a new run at 12:01AM every Monday for their selected timezone, and should be completed (available to fetch) by 4AM Monday.Monthly recurring queries (
date_range=month
) return data for the previous calendar month based on your selected timezone for the query. These queries begin a new run at 12:01AM on the first calendar day of every month for their selected timezone, and should be completed (available to fetch) by 4AM on the first day.
Getting data back from a recurring query for the first time is a three-step process:
Run a
/submit/
call to submit your new query and receive a query ID.Wait for your first query run to complete — 4AM the next day for daily queries, 4AM the next Monday for weekly queries, 4AM the next first calendar month day for monthly queries. THEN, run a
/status/
call to check the status of your submitted query using the query ID from your previous call to the/submit/
endpoint. Continue running as frequently as every ten seconds or so until you receive acompleted
status for your query.Once the status of your query is
completed
, run a/fetch/
call with the original query ID to download your completed query results. Continue using the same query ID to check status and fetch your updated results with every day, week, or month that passes.
Submit Recurring Query
GET
https://api.chartbeat.com/query/v2/recurring/submit/
The expected return value of this call is a query ID that can be used to both check the status of your query and fetch the results when ready. The "filter" parameter is simply a stand-in for the value that you want to filter by; select the dimension that you want to filter the data by, and specify the value for that dimension. Note: Metrics and Dimensions should come before Filters in the appended query parameter sequence.
Path Parameters
Name | Type | Description |
---|---|---|
| string | Append |
Query Parameters
Name | Type | Description |
---|---|---|
apikey (see note) | string | NOTE: Your API key should no longer be set as a query param; instead, pass it in the HTTP header |
| string | Site ID for the Site you are querying traffic data |
| integer | Base-10 values only |
| string | Metric or Dimension to sort your queried data by |
| string | Either |
| string | Timezone in a valid Olson timezone format, e.g. America/New_York |
| string | Comma-separated list of metrics to include in the query results |
| string | Set to |
| number | Unique user ID for your personal Chartbeat login (contact support@chartbeat.com to obtain) |
{filter} | string |
|
| string | Comma-separated list of dimensions to include in the query results |
| string | Email address(es) to send recurring query results (comma-delimited) |
Get Status of Recurring Query
GET
https://api.chartbeat.com/query/v2/recurring/status/
Use the /recurring/status/
endpoint to check on the status of your recurring query. Wait for your query status to return "completed" before making the fetch call.
Run status will display as null, queued, or completed.
Query Parameters
Name | Type | Description |
---|---|---|
| string | Your query ID from the original submit call |
| string | Site ID for the Site of your submit call |
apikey (see note) | string | NOTE: Your API key should no longer be set as a query param; instead, pass it in the HTTP header |
Fetch Recent Recurring Query Run
GET
https://api.chartbeat.com/query/v2/recurring/fetch/
The /recurring/fetch/
endpoint will download the data for a completed query (default format is a CSV file).
Query Parameters
Name | Type | Description |
---|---|---|
| string | Site ID for the Site of your submit call |
| string | Query ID from your original submit call |
| string | Set to |
apikey (see note) | string | NOTE: Your API key should no longer be set as a query param; instead, pass it in the HTTP header |
Get Previous Recurring Query Runs
GET
https://api.chartbeat.com/query/v2/recurring/runs/
Use this endpoint to return a list of run IDs associated with previous runs for your daily, weekly, or monthly query. To fetch data for a previous run, use the Fetch One-time Query call with your run ID assigned to the query_id
parameter.
Query Parameters
Name | Type | Description |
---|---|---|
| string | Query ID from the original submit call |
| string | Site ID (usually your site's root domain) |
apikey (see note) | string | NOTE: Your API key should no longer be set as a query param; instead, pass it in the HTTP header |
Get Recurring Queries List
GET
https://dashapi.chartbeat.com/query/v2/recurring/list/
Use the /recurring/list/
endpoint to view details of all active recurring queries for a given Site on your account.
Query Parameters
Name | Type | Description |
---|---|---|
| string | Chartbeat Site ID (usually root domain of the site you're querying) |
apikey (see note) | string | NOTE: Your API key should no longer be set as a query param; instead, pass it in the HTTP header |
Cancel Recurring Query
GET
https://api.chartbeat.com/query/v2/recurring/cancel/
Use this call to cancel a specific recurring query that you created.
Query Parameters
Name | Type | Description |
---|---|---|
| string | Query ID for the query you want to cancel |
| string | Site ID for the query you are canceling |
apikey (see note) | string | NOTE: Your API key should no longer be set as a query param; instead, pass it in the HTTP header |
Last updated