Create a report
curl --request POST \
--url https://api.statisfy.com/v1/reports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"owner": "<string>",
"visibility": "team",
"widgets": [
{
"title": "<string>",
"chart": {
"colors": [
"<string>"
],
"currency_symbol": "<string>",
"decimal_digits": 10,
"max_series": 2,
"page_size": 2,
"pivot_column": "<string>",
"series_column": "<string>",
"show_data_labels": true,
"show_legend": true,
"stacked": true,
"value_column": "<string>",
"x_axis": "<string>",
"y_axis": [
"<string>"
]
},
"markdown": true,
"position": {
"h": 50,
"w": 6,
"x": 5,
"y": 5000
},
"sql": "<string>",
"text": "<string>"
}
]
}
'import requests
url = "https://api.statisfy.com/v1/reports"
payload = {
"name": "<string>",
"description": "<string>",
"owner": "<string>",
"visibility": "team",
"widgets": [
{
"title": "<string>",
"chart": {
"colors": ["<string>"],
"currency_symbol": "<string>",
"decimal_digits": 10,
"max_series": 2,
"page_size": 2,
"pivot_column": "<string>",
"series_column": "<string>",
"show_data_labels": True,
"show_legend": True,
"stacked": True,
"value_column": "<string>",
"x_axis": "<string>",
"y_axis": ["<string>"]
},
"markdown": True,
"position": {
"h": 50,
"w": 6,
"x": 5,
"y": 5000
},
"sql": "<string>",
"text": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
owner: '<string>',
visibility: 'team',
widgets: [
{
title: '<string>',
chart: {
colors: ['<string>'],
currency_symbol: '<string>',
decimal_digits: 10,
max_series: 2,
page_size: 2,
pivot_column: '<string>',
series_column: '<string>',
show_data_labels: true,
show_legend: true,
stacked: true,
value_column: '<string>',
x_axis: '<string>',
y_axis: ['<string>']
},
markdown: true,
position: {h: 50, w: 6, x: 5, y: 5000},
sql: '<string>',
text: '<string>'
}
]
})
};
fetch('https://api.statisfy.com/v1/reports', 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.statisfy.com/v1/reports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'owner' => '<string>',
'visibility' => 'team',
'widgets' => [
[
'title' => '<string>',
'chart' => [
'colors' => [
'<string>'
],
'currency_symbol' => '<string>',
'decimal_digits' => 10,
'max_series' => 2,
'page_size' => 2,
'pivot_column' => '<string>',
'series_column' => '<string>',
'show_data_labels' => true,
'show_legend' => true,
'stacked' => true,
'value_column' => '<string>',
'x_axis' => '<string>',
'y_axis' => [
'<string>'
]
],
'markdown' => true,
'position' => [
'h' => 50,
'w' => 6,
'x' => 5,
'y' => 5000
],
'sql' => '<string>',
'text' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.statisfy.com/v1/reports"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"visibility\": \"team\",\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"chart\": {\n \"colors\": [\n \"<string>\"\n ],\n \"currency_symbol\": \"<string>\",\n \"decimal_digits\": 10,\n \"max_series\": 2,\n \"page_size\": 2,\n \"pivot_column\": \"<string>\",\n \"series_column\": \"<string>\",\n \"show_data_labels\": true,\n \"show_legend\": true,\n \"stacked\": true,\n \"value_column\": \"<string>\",\n \"x_axis\": \"<string>\",\n \"y_axis\": [\n \"<string>\"\n ]\n },\n \"markdown\": true,\n \"position\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 5000\n },\n \"sql\": \"<string>\",\n \"text\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.statisfy.com/v1/reports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"visibility\": \"team\",\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"chart\": {\n \"colors\": [\n \"<string>\"\n ],\n \"currency_symbol\": \"<string>\",\n \"decimal_digits\": 10,\n \"max_series\": 2,\n \"page_size\": 2,\n \"pivot_column\": \"<string>\",\n \"series_column\": \"<string>\",\n \"show_data_labels\": true,\n \"show_legend\": true,\n \"stacked\": true,\n \"value_column\": \"<string>\",\n \"x_axis\": \"<string>\",\n \"y_axis\": [\n \"<string>\"\n ]\n },\n \"markdown\": true,\n \"position\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 5000\n },\n \"sql\": \"<string>\",\n \"text\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/reports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"visibility\": \"team\",\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"chart\": {\n \"colors\": [\n \"<string>\"\n ],\n \"currency_symbol\": \"<string>\",\n \"decimal_digits\": 10,\n \"max_series\": 2,\n \"page_size\": 2,\n \"pivot_column\": \"<string>\",\n \"series_column\": \"<string>\",\n \"show_data_labels\": true,\n \"show_legend\": true,\n \"stacked\": true,\n \"value_column\": \"<string>\",\n \"x_axis\": \"<string>\",\n \"y_axis\": [\n \"<string>\"\n ]\n },\n \"markdown\": true,\n \"position\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 5000\n },\n \"sql\": \"<string>\",\n \"text\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"id": "<string>",
"name": "<string>",
"owner": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"visibility": "team",
"widgets": [
{
"built_with": "sql",
"chart": {
"colors": [
"<string>"
],
"compact_notation": "K",
"currency_symbol": "<string>",
"decimal_digits": 10,
"max_series": 2,
"orientation": "vertical",
"page_size": 2,
"pivot_column": "<string>",
"series_column": "<string>",
"show_data_labels": true,
"show_legend": true,
"stacked": true,
"value_column": "<string>",
"value_format": "number",
"x_axis": "<string>",
"y_axis": [
"<string>"
]
},
"id": "<string>",
"position": {
"h": 2,
"w": 2,
"x": 1,
"y": 1
},
"title": "<string>",
"type": "<string>",
"markdown": true,
"sql": "<string>",
"text": "<string>"
}
]
}reports
Create a report
Creates a report, with its widgets if you send them, in one go: all of it or none. name is unique across the workspace (a taken name is a 409). A widget is a chart, metric or table that runs SQL (see sql), or a text widget. visibility defaults to team. The owner, by email, is a current member of your workspace; left out, a team report has no owner and only admins can change it in the app, and a private report needs one (in the app no one else sees it, admins included). At most 50 widgets per call; add more with POST /v1/reports//widgets.
POST
/
v1
/
reports
Create a report
curl --request POST \
--url https://api.statisfy.com/v1/reports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"owner": "<string>",
"visibility": "team",
"widgets": [
{
"title": "<string>",
"chart": {
"colors": [
"<string>"
],
"currency_symbol": "<string>",
"decimal_digits": 10,
"max_series": 2,
"page_size": 2,
"pivot_column": "<string>",
"series_column": "<string>",
"show_data_labels": true,
"show_legend": true,
"stacked": true,
"value_column": "<string>",
"x_axis": "<string>",
"y_axis": [
"<string>"
]
},
"markdown": true,
"position": {
"h": 50,
"w": 6,
"x": 5,
"y": 5000
},
"sql": "<string>",
"text": "<string>"
}
]
}
'import requests
url = "https://api.statisfy.com/v1/reports"
payload = {
"name": "<string>",
"description": "<string>",
"owner": "<string>",
"visibility": "team",
"widgets": [
{
"title": "<string>",
"chart": {
"colors": ["<string>"],
"currency_symbol": "<string>",
"decimal_digits": 10,
"max_series": 2,
"page_size": 2,
"pivot_column": "<string>",
"series_column": "<string>",
"show_data_labels": True,
"show_legend": True,
"stacked": True,
"value_column": "<string>",
"x_axis": "<string>",
"y_axis": ["<string>"]
},
"markdown": True,
"position": {
"h": 50,
"w": 6,
"x": 5,
"y": 5000
},
"sql": "<string>",
"text": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
owner: '<string>',
visibility: 'team',
widgets: [
{
title: '<string>',
chart: {
colors: ['<string>'],
currency_symbol: '<string>',
decimal_digits: 10,
max_series: 2,
page_size: 2,
pivot_column: '<string>',
series_column: '<string>',
show_data_labels: true,
show_legend: true,
stacked: true,
value_column: '<string>',
x_axis: '<string>',
y_axis: ['<string>']
},
markdown: true,
position: {h: 50, w: 6, x: 5, y: 5000},
sql: '<string>',
text: '<string>'
}
]
})
};
fetch('https://api.statisfy.com/v1/reports', 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.statisfy.com/v1/reports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'owner' => '<string>',
'visibility' => 'team',
'widgets' => [
[
'title' => '<string>',
'chart' => [
'colors' => [
'<string>'
],
'currency_symbol' => '<string>',
'decimal_digits' => 10,
'max_series' => 2,
'page_size' => 2,
'pivot_column' => '<string>',
'series_column' => '<string>',
'show_data_labels' => true,
'show_legend' => true,
'stacked' => true,
'value_column' => '<string>',
'x_axis' => '<string>',
'y_axis' => [
'<string>'
]
],
'markdown' => true,
'position' => [
'h' => 50,
'w' => 6,
'x' => 5,
'y' => 5000
],
'sql' => '<string>',
'text' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.statisfy.com/v1/reports"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"visibility\": \"team\",\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"chart\": {\n \"colors\": [\n \"<string>\"\n ],\n \"currency_symbol\": \"<string>\",\n \"decimal_digits\": 10,\n \"max_series\": 2,\n \"page_size\": 2,\n \"pivot_column\": \"<string>\",\n \"series_column\": \"<string>\",\n \"show_data_labels\": true,\n \"show_legend\": true,\n \"stacked\": true,\n \"value_column\": \"<string>\",\n \"x_axis\": \"<string>\",\n \"y_axis\": [\n \"<string>\"\n ]\n },\n \"markdown\": true,\n \"position\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 5000\n },\n \"sql\": \"<string>\",\n \"text\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.statisfy.com/v1/reports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"visibility\": \"team\",\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"chart\": {\n \"colors\": [\n \"<string>\"\n ],\n \"currency_symbol\": \"<string>\",\n \"decimal_digits\": 10,\n \"max_series\": 2,\n \"page_size\": 2,\n \"pivot_column\": \"<string>\",\n \"series_column\": \"<string>\",\n \"show_data_labels\": true,\n \"show_legend\": true,\n \"stacked\": true,\n \"value_column\": \"<string>\",\n \"x_axis\": \"<string>\",\n \"y_axis\": [\n \"<string>\"\n ]\n },\n \"markdown\": true,\n \"position\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 5000\n },\n \"sql\": \"<string>\",\n \"text\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/reports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"visibility\": \"team\",\n \"widgets\": [\n {\n \"title\": \"<string>\",\n \"chart\": {\n \"colors\": [\n \"<string>\"\n ],\n \"currency_symbol\": \"<string>\",\n \"decimal_digits\": 10,\n \"max_series\": 2,\n \"page_size\": 2,\n \"pivot_column\": \"<string>\",\n \"series_column\": \"<string>\",\n \"show_data_labels\": true,\n \"show_legend\": true,\n \"stacked\": true,\n \"value_column\": \"<string>\",\n \"x_axis\": \"<string>\",\n \"y_axis\": [\n \"<string>\"\n ]\n },\n \"markdown\": true,\n \"position\": {\n \"h\": 50,\n \"w\": 6,\n \"x\": 5,\n \"y\": 5000\n },\n \"sql\": \"<string>\",\n \"text\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"id": "<string>",
"name": "<string>",
"owner": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"visibility": "team",
"widgets": [
{
"built_with": "sql",
"chart": {
"colors": [
"<string>"
],
"compact_notation": "K",
"currency_symbol": "<string>",
"decimal_digits": 10,
"max_series": 2,
"orientation": "vertical",
"page_size": 2,
"pivot_column": "<string>",
"series_column": "<string>",
"show_data_labels": true,
"show_legend": true,
"stacked": true,
"value_column": "<string>",
"value_format": "number",
"x_axis": "<string>",
"y_axis": [
"<string>"
]
},
"id": "<string>",
"position": {
"h": 2,
"w": 2,
"x": 1,
"y": 1
},
"title": "<string>",
"type": "<string>",
"markdown": true,
"sql": "<string>",
"text": "<string>"
}
]
}Authorizations
An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.
Body
application/json
Response
201 - application/json
Successful Response
Was this page helpful?