Skip to main content

Data

The easiest way to use the Data API is to use the "Export as Data API Call" button in the visualizer tool. However you can find the official documentation below.

API Endpoint

https://www.graphjson.com/api/visualize/data

API Parameters

FieldTypeDescription
api_keystringyour account api key
collectionstringthe collection you want to query data from
IANA_time_zonestringthe time zone you want result dates formatted in
graph_typestringthe type of graph you want data for
startstringwhere you want the query to begin
endstringwhere you want the query to end
filtersarraylist of filters to filter down the query
metricstringwhat metric you want to aggregate on
aggregationstringthe type of aggregation you want to do
granularitystringthe granularity of the data returned
comparestringthe time period you want to compare against

So for instance, in Python your code might look like

import requests
import json
import time

payload = {
"api_key": os.getenv('GRAPHJSON_API_KEY'),
"collection": "all_events",
"IANA_time_zone": "America/Los_Angeles",
"graph_type": "Single Line",
"start": "7 days ago",
"end": "now",
"filters": [],
"metric": None,
"aggregation": "Count",
"customizations": {"showYAxis":true,"showDots":true,"lineColor":"#987DE3","secondaryColor":"#9CA3AF"},
"granularity": "auto",
"compare": "7 days ago"
}

r = requests.post("https://www.graphjson.com/api/visualize/data", json=payload)