Reports
Use this endpoint to manipulate and obtain details on Salesbox’s Reports.
Base Endpoint
https://segmentai.salesbox.com.br/api/reports
Get Report
GET /api/reports/{id}
Get an individual Report by ID.
HTTP Request
GET /api/reports/ID
Response
Expected Response Code: 200
{
"report": {
"id": 1,
"name": "Monthly Sales Overview",
"description": "Overview of sales performance by month",
"type": "sales",
"isPublished": true,
"schedule": "monthly",
"lastRun": "2024-01-15T10:00:00+00:00",
"nextRun": "2024-02-15T10:00:00+00:00",
"createdAt": "2024-01-15T10:00:00+00:00",
"modifiedAt": "2024-01-15T10:00:00+00:00",
"createdBy": 1,
"createdByUser": "John Smith",
"modifiedBy": 1,
"modifiedByUser": "John Smith",
"filters": {
"dateRange": "last_month",
"salesTeam": "all",
"products": ["all"]
},
"columns": [
"date",
"product",
"revenue",
"quantity",
"salesperson"
]
}
}
Report Properties
Name |
Type |
Description |
|---|---|---|
|
int |
ID of the Report |
|
string |
Name of the Report |
|
string/null |
Description of the Report |
|
string |
Type of report (sales, marketing, etc) |
|
boolean |
Whether the report is active |
|
string |
Report schedule (daily, weekly, monthly) |
|
datetime/null |
Last time the report was run |
|
datetime/null |
Next scheduled run time |
|
datetime |
Report creation date/time |
|
datetime/null |
Report last modified date/time |
|
int |
ID of the User that created the Report |
|
string |
Name of the User that created the Report |
|
int |
ID of the User that last modified the Report |
|
string |
Name of the User that last modified the Report |
|
object |
Report filter settings |
|
array |
List of columns to include |
List Reports
GET /api/reports
Get a list of reports.
Query Parameters
Name |
Type |
Description |
|---|---|---|
|
string |
Text to search reports by |
|
int |
Which page to display |
|
int |
How many records to return |
|
string |
Column to sort by |
|
string |
Sort direction: asc or desc |
|
string |
Filter by report type |
|
boolean |
Filter by published status |
Create Report
POST /api/reports/new
Create a new report.
Request Body
Name |
Type |
Description |
|---|---|---|
|
string |
Report name |
|
string |
Report description |
|
string |
Report type |
|
boolean |
Whether the report should be active |
|
string |
Report schedule |
|
object |
Report filter settings |
|
array |
List of columns to include |
Edit Report
PATCH /api/reports/{id}/edit
Edit an existing report.
Request Body
Same fields as Create Report.
Delete Report
DELETE /api/reports/{id}/delete
Delete an existing report.
Run Report
POST /api/reports/{id}/run
Run a report immediately.
Response
Expected Response Code: 200
{
"status": "success",
"message": "Report queued for processing",
"jobId": "abc123"
}
Get Report Results
GET /api/reports/{id}/results
Get the latest results for a report.
Response
Expected Response Code: 200
{
"results": {
"generatedAt": "2024-01-15T10:00:00+00:00",
"data": [
{
"date": "2024-01-01",
"product": "Product A",
"revenue": 1000.00,
"quantity": 5,
"salesperson": "Jane Doe"
}
],
"summary": {
"totalRevenue": 1000.00,
"totalQuantity": 5
}
}
}