This is a staging build of the docs
We've reorganized our products to make building with Codat easier than ever
Skip to main content

Revenue

Reference document for the endpoint that produces revenue data

The Revenue endpoint retrieves the revenue and revenue growth for a specific company connection, over one or more periods of time.

Refer to the Lending reporting structure page for more detail on reports in Lending.

For Revenue, these are the dimensions and measures:

Dimensions

  • Period
  • Revenue

Measures

  • Value
  • Percentage change - The percentage change between present period’s value and previous period's value.

Report Data

  • Is structured based on dimension (index =“0”), i.e. Period.
  • The endpoint will return the revenue and revenue growth as a percentage change for each period.

View the Revenue formulas.

The endpoint is available in our API reference.

GET /data/companies/{companyId}/connections/{connectionId}/lending/commerceMetrics/revenue

Parameters

ParameterTypeDescriptionRequired
reportDatestring,
See Date
YYYY-MM-DD,
Datetime or Date (inclusive of the whole day).
Required
periodUnitstringThe period unit of time returned, and it can be: “Day”, “Week”, “Month”, “Year”.Required
periodLengthintegerBased on the period unit provided. It must be positive, not zero and an integer.Required
numberOfPeriodsintegerThe number of periods to return. It must be positive, not zero and an integer.Required
includeDisplayNamesbooleanShows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.
Default is false.
Optional

Data model

The response structure is split into four areas: Report info, Dimensions, Measures and Report data.

Report info

FieldTypeDescription
namestring"revenue"
displayNamestring"Revenue"

Dimensions

Revenue consists of these dimensions: Period and Revenue.

Dimension (index = “0”): Period

FieldTypeDescription
displayNamestring"Period"
typestring"datespan"
itemsarray,
See Dimension (index = "0") items
Returns an array of "Period". This is driven by the query parameter values.
Ordered by latest to earliest periods.

Dimension (index = “0”) items

FieldTypeDescription
displayNamestring"Period n"
startstring,
See Date
YYYY-MM-DD
Date in which the period begins (inclusive).
endstring,
See Date
YYYY-MM-DD
Date in which the period ends (inclusive).

Dimension (index = “1”): Revenue

FieldTypeDescription
displayNamestring"Revenue"
typestring"string"
itemsarray,
See Dimension (index = "1") items
Returns an array of revenue metrics.

Dimension (index = “1”) items

FieldTypeDescription
valuestringRevenue value or Revenue growth.
These will always show for any response in this report. The dimension values are not dependent on the user's query parameters.

Measures

Measures provide information about the measures contained in the report data.

The two measures for this report are as follows:

Index “0” - value

FieldTypeDescription
displayNamestring"Value"
unitsstringThe base currency of the company's commerce connection.
typestring"currency"

Index “1” - percentage change

FieldTypeDescription
displayNamestring"Percentage change vs. previous period"
unitsstring"%"
typestring"percentage"

Report data

The report data combines multiple reporting dimensions and outputs the value of each combination. Each dimension reference is specified.

Since the report data is reflective of two dimensions and their measures, the tables below represent each component grouping.

Each object is grouped by dimension (index=“0”) which is the number of periods specified by the user in the query parameters.

Each period will be broken down into Revenue and both value and percent change measures are included for each level.

Components structure

FieldTypeDescription
dimensionnumberIndex 1
dimensionDisplayNamestringShows when includeDisplayNames is set to true.
itemnumber
itemDisplayNamestringShows when includeDisplayNames is set to true.
measuresSee Measures in components

All components have the structure described in the Measures in components data model below.

Measures in components

Index "0" (Revenue)

FieldTypeDescription
measureDisplayNamestring"Value"
valuenumber

Index “1” (Revenue growth)

FieldTypeDescription
measureDisplayNamestring"Percentage change vs previous period".
If the system can't calculate the percentage change, this object will not display.
valuestring"%"

Example data

{
"reportInfo": {
"name": "revenue",
"displayName": "Revenue"
},
"dimensions": [
{
"index": 0,
"displayName": "Period",
"type": "datespan",
"items": [
{
"index": 0,
"displayName": "Period 0",
"start": "2021-04-15",
"end": "2021-05-15"
},
{
"index": 1,
"displayName": "Period 1",
"start": "2021-05-15",
"end": "2021-06-15"
}
]
},
{
"index": 1,
"displayName": "Revenue metrics",
"type": "string",
"items": [
{
"index": 0,
"value": "Revenue"
},
{
"index": 1,
"value": "Revenue growth"
}
]
}
],
"measures": [
{
"displayName": "Value",
"units": "GBP",
"index": 0,
"type": "currency"
},
{
"displayName": "Percentage change vs. previous period",
"units": "%",
"index": 1,
"type": "percentage"
}
],
"reportData": [
{
"dimension": 0,
"dimensionDisplayName": "Period",
"item": 0,
"itemDisplayName": "Period 0",
"components": [
{
"dimension": 1,
"dimensionDisplayName": "Revenue metrics",
"item": 0,
"itemDisplayName": "Revenue",
"measures": [
{
"index": 0,
"measureDisplayName": "Value",
"value": 141.81
}
]
},
{
"dimension": 1,
"dimensionDisplayName": "Revenue metrics",
"item": 1,
"itemDisplayName": "Revenue growth",
"measures": [
{
"index": 1,
"measureDisplayName": "Percentage change vs. previous period",
"value": -54.23
}
]
}
]
},
{
"dimension": 0,
"dimensionDisplayName": "Period",
"item": 1,
"itemDisplayName": "Period 1",
"components": [
{
"dimension": 1,
"dimensionDisplayName": "Revenue metrics",
"item": 0,
"itemDisplayName": "Revenue",
"measures": [
{
"index": 0,
"measureDisplayName": "Value",
"value": 375.64
}
]
},
{
"dimension": 1,
"dimensionDisplayName": "Revenue metrics",
"item": 1,
"itemDisplayName": "Revenue growth",
"measures": [
{
"index": 1,
"measureDisplayName": "Percentage change vs. previous period",
"value": 164.89
}
]
}
]
}
]
}

Was this page useful?
❤️
👍
🤔
👎
😭