Report definitions
Save a report definition
POST
/
report-definitions
Save a report definition
curl --request POST \
--url https://api.sandbox.flowpayroll.ai/v1/report/report-definitions \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--header 'X-Org-Id: <api-key>' \
--data '
{
"name": "<string>",
"definition": {
"dataset": "<string>",
"select": [
{
"field": "<string>",
"as": "<string>",
"distinct": false,
"tagName": "<string>",
"tagGroup": "<string>"
}
],
"filters": {
"and": "<array>",
"or": "<array>",
"not": null,
"field": "<string>",
"value": "<unknown>"
},
"groupBy": [
"<string>"
],
"orderBy": [
{
"field": "<string>",
"direction": "asc"
}
],
"limit": 123
},
"description": "<string>"
}
'import requests
url = "https://api.sandbox.flowpayroll.ai/v1/report/report-definitions"
payload = {
"name": "<string>",
"definition": {
"dataset": "<string>",
"select": [
{
"field": "<string>",
"as": "<string>",
"distinct": False,
"tagName": "<string>",
"tagGroup": "<string>"
}
],
"filters": {
"and": "<array>",
"or": "<array>",
"not": None,
"field": "<string>",
"value": "<unknown>"
},
"groupBy": ["<string>"],
"orderBy": [
{
"field": "<string>",
"direction": "asc"
}
],
"limit": 123
},
"description": "<string>"
}
headers = {
"X-Auth-Token": "<api-key>",
"X-Org-Id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Auth-Token': '<api-key>',
'X-Org-Id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
definition: {
dataset: '<string>',
select: [
{
field: '<string>',
as: '<string>',
distinct: false,
tagName: '<string>',
tagGroup: '<string>'
}
],
filters: {
and: '<array>',
or: '<array>',
not: null,
field: '<string>',
value: '<unknown>'
},
groupBy: ['<string>'],
orderBy: [{field: '<string>', direction: 'asc'}],
limit: 123
},
description: '<string>'
})
};
fetch('https://api.sandbox.flowpayroll.ai/v1/report/report-definitions', 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.sandbox.flowpayroll.ai/v1/report/report-definitions",
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>',
'definition' => [
'dataset' => '<string>',
'select' => [
[
'field' => '<string>',
'as' => '<string>',
'distinct' => false,
'tagName' => '<string>',
'tagGroup' => '<string>'
]
],
'filters' => [
'and' => '<array>',
'or' => '<array>',
'not' => null,
'field' => '<string>',
'value' => '<unknown>'
],
'groupBy' => [
'<string>'
],
'orderBy' => [
[
'field' => '<string>',
'direction' => 'asc'
]
],
'limit' => 123
],
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Auth-Token: <api-key>",
"X-Org-Id: <api-key>"
],
]);
$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.sandbox.flowpayroll.ai/v1/report/report-definitions"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"definition\": {\n \"dataset\": \"<string>\",\n \"select\": [\n {\n \"field\": \"<string>\",\n \"as\": \"<string>\",\n \"distinct\": false,\n \"tagName\": \"<string>\",\n \"tagGroup\": \"<string>\"\n }\n ],\n \"filters\": {\n \"and\": \"<array>\",\n \"or\": \"<array>\",\n \"not\": null,\n \"field\": \"<string>\",\n \"value\": \"<unknown>\"\n },\n \"groupBy\": [\n \"<string>\"\n ],\n \"orderBy\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"asc\"\n }\n ],\n \"limit\": 123\n },\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Auth-Token", "<api-key>")
req.Header.Add("X-Org-Id", "<api-key>")
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.sandbox.flowpayroll.ai/v1/report/report-definitions")
.header("X-Auth-Token", "<api-key>")
.header("X-Org-Id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"definition\": {\n \"dataset\": \"<string>\",\n \"select\": [\n {\n \"field\": \"<string>\",\n \"as\": \"<string>\",\n \"distinct\": false,\n \"tagName\": \"<string>\",\n \"tagGroup\": \"<string>\"\n }\n ],\n \"filters\": {\n \"and\": \"<array>\",\n \"or\": \"<array>\",\n \"not\": null,\n \"field\": \"<string>\",\n \"value\": \"<unknown>\"\n },\n \"groupBy\": [\n \"<string>\"\n ],\n \"orderBy\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"asc\"\n }\n ],\n \"limit\": 123\n },\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.flowpayroll.ai/v1/report/report-definitions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Auth-Token"] = '<api-key>'
request["X-Org-Id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"definition\": {\n \"dataset\": \"<string>\",\n \"select\": [\n {\n \"field\": \"<string>\",\n \"as\": \"<string>\",\n \"distinct\": false,\n \"tagName\": \"<string>\",\n \"tagGroup\": \"<string>\"\n }\n ],\n \"filters\": {\n \"and\": \"<array>\",\n \"or\": \"<array>\",\n \"not\": null,\n \"field\": \"<string>\",\n \"value\": \"<unknown>\"\n },\n \"groupBy\": [\n \"<string>\"\n ],\n \"orderBy\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"asc\"\n }\n ],\n \"limit\": 123\n },\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"definitionId": "<string>",
"name": "<string>",
"definition": {
"dataset": "<string>",
"select": [
{
"field": "<string>",
"as": "<string>",
"distinct": false,
"tagName": "<string>",
"tagGroup": "<string>"
}
],
"filters": {
"and": "<array>",
"or": "<array>",
"not": null,
"field": "<string>",
"value": "<unknown>"
},
"groupBy": [
"<string>"
],
"orderBy": [
{
"field": "<string>",
"direction": "asc"
}
],
"limit": 123
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "<string>"
}{
"error": "<string>",
"errors": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
FlowPayroll JWT (raw token, no Bearer prefix)
Organisation to scope the request to. Required when the principal can access more than one organisation; optional for single-organisation principals (the authorizer resolves it automatically).
Body
application/json
Response
Created
The report-definition document — one contract drives sync runs, exports, saved definitions and schedules. See docs/API.md for the full rules.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Save a report definition
curl --request POST \
--url https://api.sandbox.flowpayroll.ai/v1/report/report-definitions \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--header 'X-Org-Id: <api-key>' \
--data '
{
"name": "<string>",
"definition": {
"dataset": "<string>",
"select": [
{
"field": "<string>",
"as": "<string>",
"distinct": false,
"tagName": "<string>",
"tagGroup": "<string>"
}
],
"filters": {
"and": "<array>",
"or": "<array>",
"not": null,
"field": "<string>",
"value": "<unknown>"
},
"groupBy": [
"<string>"
],
"orderBy": [
{
"field": "<string>",
"direction": "asc"
}
],
"limit": 123
},
"description": "<string>"
}
'import requests
url = "https://api.sandbox.flowpayroll.ai/v1/report/report-definitions"
payload = {
"name": "<string>",
"definition": {
"dataset": "<string>",
"select": [
{
"field": "<string>",
"as": "<string>",
"distinct": False,
"tagName": "<string>",
"tagGroup": "<string>"
}
],
"filters": {
"and": "<array>",
"or": "<array>",
"not": None,
"field": "<string>",
"value": "<unknown>"
},
"groupBy": ["<string>"],
"orderBy": [
{
"field": "<string>",
"direction": "asc"
}
],
"limit": 123
},
"description": "<string>"
}
headers = {
"X-Auth-Token": "<api-key>",
"X-Org-Id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Auth-Token': '<api-key>',
'X-Org-Id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
definition: {
dataset: '<string>',
select: [
{
field: '<string>',
as: '<string>',
distinct: false,
tagName: '<string>',
tagGroup: '<string>'
}
],
filters: {
and: '<array>',
or: '<array>',
not: null,
field: '<string>',
value: '<unknown>'
},
groupBy: ['<string>'],
orderBy: [{field: '<string>', direction: 'asc'}],
limit: 123
},
description: '<string>'
})
};
fetch('https://api.sandbox.flowpayroll.ai/v1/report/report-definitions', 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.sandbox.flowpayroll.ai/v1/report/report-definitions",
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>',
'definition' => [
'dataset' => '<string>',
'select' => [
[
'field' => '<string>',
'as' => '<string>',
'distinct' => false,
'tagName' => '<string>',
'tagGroup' => '<string>'
]
],
'filters' => [
'and' => '<array>',
'or' => '<array>',
'not' => null,
'field' => '<string>',
'value' => '<unknown>'
],
'groupBy' => [
'<string>'
],
'orderBy' => [
[
'field' => '<string>',
'direction' => 'asc'
]
],
'limit' => 123
],
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Auth-Token: <api-key>",
"X-Org-Id: <api-key>"
],
]);
$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.sandbox.flowpayroll.ai/v1/report/report-definitions"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"definition\": {\n \"dataset\": \"<string>\",\n \"select\": [\n {\n \"field\": \"<string>\",\n \"as\": \"<string>\",\n \"distinct\": false,\n \"tagName\": \"<string>\",\n \"tagGroup\": \"<string>\"\n }\n ],\n \"filters\": {\n \"and\": \"<array>\",\n \"or\": \"<array>\",\n \"not\": null,\n \"field\": \"<string>\",\n \"value\": \"<unknown>\"\n },\n \"groupBy\": [\n \"<string>\"\n ],\n \"orderBy\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"asc\"\n }\n ],\n \"limit\": 123\n },\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Auth-Token", "<api-key>")
req.Header.Add("X-Org-Id", "<api-key>")
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.sandbox.flowpayroll.ai/v1/report/report-definitions")
.header("X-Auth-Token", "<api-key>")
.header("X-Org-Id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"definition\": {\n \"dataset\": \"<string>\",\n \"select\": [\n {\n \"field\": \"<string>\",\n \"as\": \"<string>\",\n \"distinct\": false,\n \"tagName\": \"<string>\",\n \"tagGroup\": \"<string>\"\n }\n ],\n \"filters\": {\n \"and\": \"<array>\",\n \"or\": \"<array>\",\n \"not\": null,\n \"field\": \"<string>\",\n \"value\": \"<unknown>\"\n },\n \"groupBy\": [\n \"<string>\"\n ],\n \"orderBy\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"asc\"\n }\n ],\n \"limit\": 123\n },\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.flowpayroll.ai/v1/report/report-definitions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Auth-Token"] = '<api-key>'
request["X-Org-Id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"definition\": {\n \"dataset\": \"<string>\",\n \"select\": [\n {\n \"field\": \"<string>\",\n \"as\": \"<string>\",\n \"distinct\": false,\n \"tagName\": \"<string>\",\n \"tagGroup\": \"<string>\"\n }\n ],\n \"filters\": {\n \"and\": \"<array>\",\n \"or\": \"<array>\",\n \"not\": null,\n \"field\": \"<string>\",\n \"value\": \"<unknown>\"\n },\n \"groupBy\": [\n \"<string>\"\n ],\n \"orderBy\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"asc\"\n }\n ],\n \"limit\": 123\n },\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"definitionId": "<string>",
"name": "<string>",
"definition": {
"dataset": "<string>",
"select": [
{
"field": "<string>",
"as": "<string>",
"distinct": false,
"tagName": "<string>",
"tagGroup": "<string>"
}
],
"filters": {
"and": "<array>",
"or": "<array>",
"not": null,
"field": "<string>",
"value": "<unknown>"
},
"groupBy": [
"<string>"
],
"orderBy": [
{
"field": "<string>",
"direction": "asc"
}
],
"limit": 123
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "<string>"
}{
"error": "<string>",
"errors": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}