Insights
Query Saved Report
Query a saved Insights report
GET
/
insights
Query Saved Report
curl --request GET \
--url https://{regionAndDomain}.com/api/query/insights \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://{regionAndDomain}.com/api/query/insights"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://{regionAndDomain}.com/api/query/insights', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{regionAndDomain}.com/api/query/insights",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{regionAndDomain}.com/api/query/insights"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{regionAndDomain}.com/api/query/insights")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{regionAndDomain}.com/api/query/insights")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"computed_at": "2020-09-21T16:35:41.252314+00:00",
"date_range": {
"from_date": "2020-08-31T00:00:00-07:00",
"to_date": "2020-09-12T23:59:59.999000-07:00"
},
"headers": [
"$event"
],
"series": {
"Logged in": {
"2020-08-31T00:00:00-07:00": 9852,
"2020-09-07T00:00:00-07:00": 4325
},
"Viewed page": {
"2020-08-31T00:00:00-07:00": 10246,
"2020-09-07T00:00:00-07:00": 11432
}
}
}Authorizations
ServiceAccountProjectSecret
Service Account
Query Parameters
Required if using service account to authenticate request.
The id of the workspace if applicable.
The ID of your Insights report can be found from the url: https://mixpanel.com/project/<YOUR_PROJECT_ID>/view/<YOUR_WORKSPACE_ID>/app/boards#id=12345&editor-card-id=%22report-<YOUR_BOOKMARK_ID>%22
Response
200 - application/json
Success
Show child attributes
Show child attributes
Explanation of what the nested keys mean in series.
Maps event name of event to an object with dates as keys and number of instances as values. For example:
{ 'Viewed page': { '2020-08-17T00:00:00-07:00': 7832, '2020-08-24T00:00:00-07:00': 6234, } }
Was this page helpful?
⌘I
Query Saved Report
curl --request GET \
--url https://{regionAndDomain}.com/api/query/insights \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://{regionAndDomain}.com/api/query/insights"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://{regionAndDomain}.com/api/query/insights', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{regionAndDomain}.com/api/query/insights",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{regionAndDomain}.com/api/query/insights"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{regionAndDomain}.com/api/query/insights")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{regionAndDomain}.com/api/query/insights")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"computed_at": "2020-09-21T16:35:41.252314+00:00",
"date_range": {
"from_date": "2020-08-31T00:00:00-07:00",
"to_date": "2020-09-12T23:59:59.999000-07:00"
},
"headers": [
"$event"
],
"series": {
"Logged in": {
"2020-08-31T00:00:00-07:00": 9852,
"2020-09-07T00:00:00-07:00": 4325
},
"Viewed page": {
"2020-08-31T00:00:00-07:00": 10246,
"2020-09-07T00:00:00-07:00": 11432
}
}
}