Get an analysis
curl --request GET \
--url https://api.datalyr.com/v1/analyses/{analysisId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/analyses/{analysisId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.datalyr.com/v1/analyses/{analysisId}', 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://api.datalyr.com/v1/analyses/{analysisId}",
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: Bearer <token>"
],
]);
$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://api.datalyr.com/v1/analyses/{analysisId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.datalyr.com/v1/analyses/{analysisId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/analyses/{analysisId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"report_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"created_via": "dashboard",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"body_md": "<string>",
"plans": [
{
"id": "<string>",
"plan": {
"metrics": [
"<string>"
],
"date_range": {
"from": "<string>",
"to": "<string>"
},
"dimensions": [
"<string>"
],
"filters": [
{
"dimension": "<string>",
"op": "eq",
"value": "<string>"
}
],
"granularity": "hour",
"compare": "previous_period",
"attribution": {
"model": "last_touch",
"window_days": 45
},
"order_by": [
{
"field": "<string>",
"dir": "asc"
}
],
"limit": 200,
"cursor": "<string>",
"response_format": "concise"
},
"label": "<string>"
}
],
"date_range": {
"from": "<string>",
"to": "<string>"
},
"created_by": {
"type": "user",
"id": "<string>",
"client_id": "<string>"
},
"deleted_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}{
"error": "<string>",
"code": "insufficient_scope",
"required_scope": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Dashboards, analyses and share links
Get an analysis
One analysis in full, with its body and plans. Needs datalyr:read.
GET
/
analyses
/
{analysisId}
Get an analysis
curl --request GET \
--url https://api.datalyr.com/v1/analyses/{analysisId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/analyses/{analysisId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.datalyr.com/v1/analyses/{analysisId}', 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://api.datalyr.com/v1/analyses/{analysisId}",
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: Bearer <token>"
],
]);
$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://api.datalyr.com/v1/analyses/{analysisId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.datalyr.com/v1/analyses/{analysisId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/analyses/{analysisId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"report_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"created_via": "dashboard",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"body_md": "<string>",
"plans": [
{
"id": "<string>",
"plan": {
"metrics": [
"<string>"
],
"date_range": {
"from": "<string>",
"to": "<string>"
},
"dimensions": [
"<string>"
],
"filters": [
{
"dimension": "<string>",
"op": "eq",
"value": "<string>"
}
],
"granularity": "hour",
"compare": "previous_period",
"attribution": {
"model": "last_touch",
"window_days": 45
},
"order_by": [
{
"field": "<string>",
"dir": "asc"
}
],
"limit": 200,
"cursor": "<string>",
"response_format": "concise"
},
"label": "<string>"
}
],
"date_range": {
"from": "<string>",
"to": "<string>"
},
"created_by": {
"type": "user",
"id": "<string>",
"client_id": "<string>"
},
"deleted_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}{
"error": "<string>",
"code": "insufficient_scope",
"required_scope": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Response
Successful response.
Required string length:
1 - 120The reports the analysis shows, embedded or after the body.
Maximum array length:
12dashboard means the Datalyr app. chat means a person selected Save as analysis in AI chat.
Available options:
dashboard, chat, mcp, api Markdown. Raw HTML is not rendered. A line of the form ::report[<id>] embeds that report. Not in list responses.
Maximum string length:
50000At most 64 KB serialized. Not in list responses.
Maximum array length:
20Show child attributes
Show child attributes
The range the attached reports run over. Null means each report's own default.
- Option 1
- Option 2
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?