Reports
Export comprehensive profit reports in PDF, CSV, or JSON formats for accounting, analysis, or presentations.
GET /v1/reports/profit
Get detailed profit report with all metrics.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | No | 7d, 30d, 90d, all (default: 30d) |
startDate | string | No | Custom start date (YYYY-MM-DD) |
endDate | string | No | Custom end date (YYYY-MM-DD) |
format | string | Yes | json, csv, pdf |
groupBy | string | No | day, week, month (default: day) |
includeProducts | boolean | No | Include product breakdown (default: false) |
Example (JSON)
bash
curl -H "Authorization: Bearer looha_your_api_key" \
"https://api.looha.app/v1/reports/profit?period=30d&format=json"Response:
json
{
"success": true,
"data": {
"period": {
"start": "2024-01-01",
"end": "2024-01-31"
},
"summary": {
"totalRevenue": 125000,
"totalCost": 87500,
"totalProfit": 37500,
"profitMargin": 30.0,
"adSpend": 15000,
"roas": 8.33,
"orders": 450
},
"daily": [
{
"date": "2024-01-01",
"revenue": 4200,
"cost": 2940,
"profit": 1260,
"orders": 15
}
// ... more days
]
}
}Example (CSV)
bash
curl -H "Authorization: Bearer looha_your_api_key" \
"https://api.looha.app/v1/reports/profit?period=30d&format=csv" \
-o profit_report.csvCSV Output:
csv
Date,Revenue,Cost,Profit,Profit Margin,Ad Spend,ROAS,Orders
2024-01-01,4200,2940,1260,30.0,500,8.4,15
2024-01-02,3800,2660,1140,30.0,450,8.44,13
...Example (PDF)
bash
curl -H "Authorization: Bearer looha_your_api_key" \
"https://api.looha.app/v1/reports/profit?period=30d&format=pdf" \
-o profit_report.pdfPDF includes:
- Executive summary
- Profit trends chart
- Top products table
- Ad performance comparison
- Monthly/weekly breakdowns
GET /v1/reports/ads
Get advertising performance report.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | No | Time period |
platform | string | No | Specific platform or all |
format | string | Yes | json, csv, pdf |
Example
bash
curl -H "Authorization: Bearer looha_your_api_key" \
"https://api.looha.app/v1/reports/ads?period=30d&format=pdf" \
-o ads_report.pdfGET /v1/reports/products
Get product performance report.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | No | Time period |
sortBy | string | No | profit, revenue, quantity |
format | string | Yes | json, csv, pdf |
limit | number | No | Top N products (default: 100) |
Example
bash
curl -H "Authorization: Bearer looha_your_api_key" \
"https://api.looha.app/v1/reports/products?period=30d&sortBy=profit&limit=50&format=csv" \
-o top_products.csvGET /v1/reports/summary
Get executive summary report (PDF only).
Example
bash
curl -H "Authorization: Bearer looha_your_api_key" \
"https://api.looha.app/v1/reports/summary?period=30d" \
-o executive_summary.pdfIncludes:
- Key metrics overview
- Month-over-month comparison
- Top 5 products
- Platform ROAS comparison
- Actionable insights
Scheduled Reports
POST /v1/reports/schedule
Schedule automatic report delivery.
Request Body:
json
{
"name": "Weekly Profit Report",
"type": "profit",
"format": "pdf",
"frequency": "weekly",
"day": "monday",
"time": "08:00",
"email": "owner@company.com"
}Example
bash
curl -X POST \
-H "Authorization: Bearer looha_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Weekly Profit Report",
"type": "profit",
"format": "pdf",
"frequency": "weekly",
"day": "monday",
"time": "08:00",
"email": "owner@company.com"
}' \
"https://api.looha.app/v1/reports/schedule"Use Cases
Auto-generate Monthly Report
python
import requests
from datetime import datetime
API_KEY = 'looha_your_api_key'
# Generate report for last month
response = requests.get(
'https://api.looha.app/v1/reports/profit',
params={
'period': 'last_month',
'format': 'pdf',
'includeProducts': True
},
headers={'Authorization': f'Bearer {API_KEY}'}
)
# Save PDF
filename = f"profit_report_{datetime.now().strftime('%Y-%m')}.pdf"
with open(filename, 'wb') as f:
f.write(response.content)
print(f"Report saved: {filename}")Export to Google Sheets
javascript
const API_KEY = 'looha_your_api_key'
const response = await fetch(
'https://api.looha.app/v1/reports/profit?period=30d&format=json',
{
headers: { 'Authorization': `Bearer ${API_KEY}` }
}
)
const report = await response.json()
// Convert to Google Sheets format
const rows = report.data.daily.map(day => [
day.date,
day.revenue,
day.cost,
day.profit,
day.orders
])
// Upload to Google Sheets (using Google Sheets API)
// ... implementationThat's it! You now have complete API documentation for Looha.
Need help? Contact support@looha.app