Skip to content
Kaizena FlowDocs
Search

Search the docs

Reports

Saved reports (D345), run on the data as it is now.

OperationMethod and pathScope
List saved reportsGET /reportsreports:read
Run a saved reportGET /reports/{id}/runreports:read

List saved reports

GET https://kaizenaflow.com/api/admin/v1/reports

The store's saved reports (D345), by name, each saying whether it can run as saved.

  • Operation: reports.list

  • Scope: reports:read

  • Answers: 200, the answer under data.

Query parameters

NameTypeRequiredDescription
updated_afterstring (date-time)noOnly what was made or changed after this time (ISO 8601 with its offset), for incremental sync.

Answer

FieldTypeDescription
datalist of objects
data[].idstring (uuid)
data[].titlestring
data[].runsbooleanIts spec can run as saved.
data[].updated_atstring (date-time)

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403feature_offThe store has switched off the feature the operation stands behind (Settings, Store features); the message names it.
403forbiddenThe token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which.
422invalidNothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething went wrong on our side; nothing more was done. It is safe to try again.

Example request

curl

curl 'https://kaizenaflow.com/api/admin/v1/reports' \
  -H "Authorization: Bearer $KAIZENA_TOKEN"

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/reports", {
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
  },
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/reports",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
    },
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Run a saved report

GET https://kaizenaflow.com/api/admin/v1/reports/{id}/run

Runs the saved report on the data as it is now, as the Reports page runs it: its rows and totals in the main currency, without VAT. Nothing is written.

  • Operation: reports.run

  • Scope: reports:read

  • Answers: 200, the answer under data.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Answer

FieldTypeDescription
dataobject
data.report_idstring (uuid)
data.titlestring
data.currencystringThe main currency every amount is in, without VAT.
data.columnslist of objects
data.columns[].metricstring
data.columns[].adds_upboolean
data.rowslist of objects
data.rows[].keysany
data.rows[].valuesmap of string to number or null
data.rows[].previousmap of string to number or null or null
data.rows[].restboolean
data.totalsobject
data.totals.valuesmap of string to number or null
data.totals.previousmap of string to number or null or null
data.hidden_rowsinteger
data.periodanyThe period it covers, as the report builder states it.

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403feature_offThe store has switched off the feature the operation stands behind (Settings, Store features); the message names it.
403forbiddenThe token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
409conflictNothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething went wrong on our side; nothing more was done. It is safe to try again.

Example request

curl

curl 'https://kaizenaflow.com/api/admin/v1/reports/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/run' \
  -H "Authorization: Bearer $KAIZENA_TOKEN"

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/reports/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/run", {
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
  },
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/reports/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/run",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
    },
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Made from the API contract, version 1.57This page as Markdown

Was this page helpful?