curl --request POST \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss-comparison \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"periods": {
"type": "Comparison_Months",
"months": [
{
"year": 2024,
"month": 12
}
]
},
"tag_filters": [
{
"required_tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
]
}
],
"reporting_basis": "ACCRUAL",
"structure": "DEFAULT"
}
'[
{
"pnls": [
{
"period": {
"type": "Comparison_Months",
"months": [
{
"year": 2024,
"month": 12
}
]
},
"tag_filter": {
"key": "<string>",
"value": [
"<string>"
]
},
"pnl": {
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"income": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"cost_of_goods_sold": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"gross_profit": 123,
"expenses": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"profit_before_taxes": 123,
"taxes": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"net_profit": 123,
"other_outflows": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"personal_expenses": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"fully_categorized": true
}
}
]
}
]Compare Profit & Loss views across time periods and/or tags. This endpoint allows specifying multiple time periods (specified in months, years, or custom date ranges) and tags and will generate a comparison for every combination. Note that this endpoint is retrieval only, but uses a POST HTTP verb rather than GET because of the complexity of the parameters.
curl --request POST \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss-comparison \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"periods": {
"type": "Comparison_Months",
"months": [
{
"year": 2024,
"month": 12
}
]
},
"tag_filters": [
{
"required_tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
]
}
],
"reporting_basis": "ACCRUAL",
"structure": "DEFAULT"
}
'[
{
"pnls": [
{
"period": {
"type": "Comparison_Months",
"months": [
{
"year": 2024,
"month": 12
}
]
},
"tag_filter": {
"key": "<string>",
"value": [
"<string>"
]
},
"pnl": {
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"income": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"cost_of_goods_sold": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"gross_profit": 123,
"expenses": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"profit_before_taxes": 123,
"taxes": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"net_profit": 123,
"other_outflows": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"personal_expenses": {
"name": "<string>",
"display_name": "<string>",
"value": 123,
"is_contra": true,
"line_items": "<array>"
},
"fully_categorized": true
}
}
]
}
]Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Content-Type must be set to application/json
The UUID of the business to fetch the profit and loss for
Show child attributes
Show child attributes
The tag dimension key (e.g., "department", "project", "location")
"department"
The tag value (e.g., "sales", "marketing", "engineering")
"sales"
If the TagDimension doesn't exist, providing this value specifies the display name upon database insertion. Otherwise, it is left as null on the TagDimension.
"Department"
If the TagValueDefinition doesn't exist, providing this value specifies the display name upon database insertion. Otherwise, it is left as null on the TagValueDefinition.
"Sales Department"
ACCRUAL, CASH DEFAULT, TRUCKING, MEDSPA, MEDSPA_NO_LICENSING, CITRUS, CITRUS_NO_LICENSING, FLORIST Show child attributes
Show child attributes