Fetch P&L line items
curl --request GET \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines', 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://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"business_id": "550e8400-e29b-41d4-a716-446655440000",
"start_date": "2024-01-01T00:00:00Z",
"end_date": "2024-12-31T23:59:59.999Z",
"pnl_structure_line_item_name": "operating_expenses",
"pnl_structure_line_item_display_name": "Operating Expenses",
"lines": [
{
"id": "li_abc123def456",
"entry_id": "550e8400-e29b-41d4-a716-446655440000",
"account": {
"type": "Single_Chart_Account",
"id": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "Current Assets",
"account_number": "4000",
"stable_name": {
"type": "StableName",
"stable_name": "CURRENT_ASSETS"
},
"account_type": {
"display_name": "Asset"
},
"account_subtype": {
"display_name": "Current Assets"
}
},
"amount": 125050,
"date": "2024-03-15T14:30:00Z",
"source": {
"transaction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"account_name": "<string>",
"date": "2023-11-07T05:31:56Z",
"amount": 123,
"counterparty": "<string>",
"entity_name": "Bank Transaction",
"display_description": "Generated display description based on account name and date"
}
}
],
"type": "Profit_And_Loss_Line_Item_Detail_Report",
"tag_filter": {
"key": "<string>",
"value": [
"<string>"
]
}
}
}{
"description": "<string>",
"meta": {}
}{
"description": "<string>",
"meta": {}
}Profit and Loss
Fetch P&L line items
Returns detailed line item information for a specific P&L account or category over a specified time period.
GET
/
v1
/
businesses
/
{businessId}
/
reports
/
profit-and-loss
/
lines
Fetch P&L line items
curl --request GET \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines', 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://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/reports/profit-and-loss/lines")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"business_id": "550e8400-e29b-41d4-a716-446655440000",
"start_date": "2024-01-01T00:00:00Z",
"end_date": "2024-12-31T23:59:59.999Z",
"pnl_structure_line_item_name": "operating_expenses",
"pnl_structure_line_item_display_name": "Operating Expenses",
"lines": [
{
"id": "li_abc123def456",
"entry_id": "550e8400-e29b-41d4-a716-446655440000",
"account": {
"type": "Single_Chart_Account",
"id": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "Current Assets",
"account_number": "4000",
"stable_name": {
"type": "StableName",
"stable_name": "CURRENT_ASSETS"
},
"account_type": {
"display_name": "Asset"
},
"account_subtype": {
"display_name": "Current Assets"
}
},
"amount": 125050,
"date": "2024-03-15T14:30:00Z",
"source": {
"transaction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"account_name": "<string>",
"date": "2023-11-07T05:31:56Z",
"amount": 123,
"counterparty": "<string>",
"entity_name": "Bank Transaction",
"display_description": "Generated display description based on account name and date"
}
}
],
"type": "Profit_And_Loss_Line_Item_Detail_Report",
"tag_filter": {
"key": "<string>",
"value": [
"<string>"
]
}
}
}{
"description": "<string>",
"meta": {}
}{
"description": "<string>",
"meta": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Content-Type must be set to application/json.
Path Parameters
The UUID of the business to fetch the P&L line items for.
Query Parameters
Start date for the line item report (ISO 8601 format).
End date for the line item report (ISO 8601 format).
Name of the specific line item to fetch details for.
Accounting basis for the report.
Available options:
ACCRUAL, CASH P&L structure template to use.
Response
P&L line item detail report.
Detailed report for a specific P&L line item showing all ledger entries that contribute to it.
Show child attributes
Show child attributes
⌘I