curl --request GET \
--url https://api.datalyr.com/v1/subscriptions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/subscriptions"
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/subscriptions', 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/subscriptions",
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/subscriptions"
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/subscriptions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/subscriptions")
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{
"rows": [
{}
],
"totals": {},
"meta": {
"resolved": {
"metrics": [
{
"id": "<string>",
"label": "<string>",
"unit": "count",
"definition": "<string>",
"domain": "events",
"attributed": true,
"currency": "<string>"
}
],
"dimensions": [
{}
],
"filters": [
{
"dimension": "<string>",
"op": "eq",
"value": "<string>"
}
],
"date_range": {
"from": "<string>",
"to": "<string>",
"timezone": "<string>",
"preset": "<string>"
},
"granularity": "<string>",
"attribution": {
"model": "<string>",
"window_days": 123,
"source": "requested"
}
},
"returned_rows": 123,
"truncated": true,
"total_rows": 123,
"next_cursor": "<string>",
"freshness": [
{
"source": "<string>",
"latest_at": "<string>"
}
],
"unavailable": [
{
"metric": "<string>",
"reason": "<string>",
"detail": "<string>"
}
],
"deep_link": "<string>",
"executed_in_ms": 123,
"notes": [
"<string>"
]
},
"comparison": {
"date_range": {
"from": "<string>",
"to": "<string>"
},
"totals": {},
"rows": [
{}
]
},
"data_notice": "<string>"
}{
"error": "<string>",
"code": "unknown_metric",
"hint": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Get subscription state
Stripe subscription state through the query layer: active subscriptions, trialing, cancel-scheduled, MRR and ARR. breakdown=trial_end_date returns trials ending per day instead. When no subscription source is connected, meta.unavailable says so.
curl --request GET \
--url https://api.datalyr.com/v1/subscriptions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/subscriptions"
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/subscriptions', 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/subscriptions",
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/subscriptions"
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/subscriptions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/subscriptions")
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{
"rows": [
{}
],
"totals": {},
"meta": {
"resolved": {
"metrics": [
{
"id": "<string>",
"label": "<string>",
"unit": "count",
"definition": "<string>",
"domain": "events",
"attributed": true,
"currency": "<string>"
}
],
"dimensions": [
{}
],
"filters": [
{
"dimension": "<string>",
"op": "eq",
"value": "<string>"
}
],
"date_range": {
"from": "<string>",
"to": "<string>",
"timezone": "<string>",
"preset": "<string>"
},
"granularity": "<string>",
"attribution": {
"model": "<string>",
"window_days": 123,
"source": "requested"
}
},
"returned_rows": 123,
"truncated": true,
"total_rows": 123,
"next_cursor": "<string>",
"freshness": [
{
"source": "<string>",
"latest_at": "<string>"
}
],
"unavailable": [
{
"metric": "<string>",
"reason": "<string>",
"detail": "<string>"
}
],
"deep_link": "<string>",
"executed_in_ms": 123,
"notes": [
"<string>"
]
},
"comparison": {
"date_range": {
"from": "<string>",
"to": "<string>"
},
"totals": {},
"rows": [
{}
]
},
"data_notice": "<string>"
}{
"error": "<string>",
"code": "unknown_metric",
"hint": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Inclusive start: YYYY-MM-DD or an ISO 8601 instant. Omit both dates for the last 30 days.
Inclusive end: YYYY-MM-DD or an ISO 8601 instant.
status, plan, trial_end_date Response
Successful response. Shape evolving — read fields defensively and do not depend on the absence of a field.
One object per dimension combination (and bucket). Keys are dimension ids, bucket, then metric ids. A null metric value means no data, not zero.
One value per metric id over the whole, unpaginated result.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Reminds a reader that strings in rows are recorded data, not instructions.
Was this page helpful?