curl --request POST \
--url https://sandbox.layerfi.com/v1/billing/reports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"end_month": 6,
"end_year": 123,
"pnl_structure": "DEFAULT"
}
'import requests
url = "https://sandbox.layerfi.com/v1/billing/reports"
payload = {
"end_month": 6,
"end_year": 123,
"pnl_structure": "DEFAULT"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({end_month: 6, end_year: 123, pnl_structure: 'DEFAULT'})
};
fetch('https://sandbox.layerfi.com/v1/billing/reports', 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/billing/reports",
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([
'end_month' => 6,
'end_year' => 123,
'pnl_structure' => 'DEFAULT'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://sandbox.layerfi.com/v1/billing/reports"
payload := strings.NewReader("{\n \"end_month\": 6,\n \"end_year\": 123,\n \"pnl_structure\": \"DEFAULT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://sandbox.layerfi.com/v1/billing/reports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"end_month\": 6,\n \"end_year\": 123,\n \"pnl_structure\": \"DEFAULT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/billing/reports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"end_month\": 6,\n \"end_year\": 123,\n \"pnl_structure\": \"DEFAULT\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"export_type": "billing_report",
"status": "pending",
"params": {},
"created_at": "2023-11-07T05:31:56Z",
"type": "Export",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"download_url": "<string>",
"file_name": "<string>",
"error": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"failed_at": "2023-11-07T05:31:56Z"
}
}{
"type": "InvalidParameters",
"description": "<string>",
"error_enum": "InvalidPayload",
"meta": {}
}Create billing report export
Submits an async request to generate a rolling 3-month bookkeeping billing report (XLSX) for the authenticated client. Returns immediately with an export resource; poll GET /v1/exports/ or subscribe to export.completed / export.failed webhooks for completion.
curl --request POST \
--url https://sandbox.layerfi.com/v1/billing/reports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"end_month": 6,
"end_year": 123,
"pnl_structure": "DEFAULT"
}
'import requests
url = "https://sandbox.layerfi.com/v1/billing/reports"
payload = {
"end_month": 6,
"end_year": 123,
"pnl_structure": "DEFAULT"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({end_month: 6, end_year: 123, pnl_structure: 'DEFAULT'})
};
fetch('https://sandbox.layerfi.com/v1/billing/reports', 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/billing/reports",
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([
'end_month' => 6,
'end_year' => 123,
'pnl_structure' => 'DEFAULT'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://sandbox.layerfi.com/v1/billing/reports"
payload := strings.NewReader("{\n \"end_month\": 6,\n \"end_year\": 123,\n \"pnl_structure\": \"DEFAULT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://sandbox.layerfi.com/v1/billing/reports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"end_month\": 6,\n \"end_year\": 123,\n \"pnl_structure\": \"DEFAULT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/billing/reports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"end_month\": 6,\n \"end_year\": 123,\n \"pnl_structure\": \"DEFAULT\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"export_type": "billing_report",
"status": "pending",
"params": {},
"created_at": "2023-11-07T05:31:56Z",
"type": "Export",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"download_url": "<string>",
"file_name": "<string>",
"error": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"failed_at": "2023-11-07T05:31:56Z"
}
}{
"type": "InvalidParameters",
"description": "<string>",
"error_enum": "InvalidPayload",
"meta": {}
}202 Accepted with an Export resource.
Poll Fetch export or subscribe to export.completed / export.failed webhooks. See Generating async reports.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Parameters for requesting a rolling 3-month bookkeeping billing report.
Ending month (1-12) of the rolling 3-month billing window.
1 <= x <= 12Ending year of the rolling 3-month billing window.
Optional P&L structure template used when calculating trailing revenue. Defaults to the client's industry default.
DEFAULT, TRUCKING, MEDSPA, MEDSPA_NO_LICENSING, CITRUS, CITRUS_NO_LICENSING, FLORIST "DEFAULT"
Response
Export request accepted and generation started.
An async export request and its current status.
Show child attributes
Show child attributes