Reports API Reference

Manage business reports, data analysis, and reporting operations in the analytics system.

Base Path: /api/reports

Overview

The Reports API provides endpoints for managing business reports including creation, execution, scheduling, and deletion. Supports custom report definitions with filtering and data extraction.

Key Operations


API Endpoints

POST /api/reports

Create Report

Creates a new custom report definition.

Authentication

Bearer Token

Request Body

{
  "name": "Monthly Revenue Report",
  "description": "Revenue breakdown by month",
  "type": "financial",
  "dataSource": "invoices",
  "filters": {
    "status": "paid",
    "dateRange": "monthly"
  },
  "columns": ["date", "amount", "currency", "vendor"],
  "groupBy": "date",
  "sortBy": "date desc"
}

Response

{
  "id": "report_123",
  "name": "Monthly Revenue Report",
  "type": "financial",
  "createdAt": "2026-06-02T10:30:00Z"
}
GET /api/reports/{id}

Get Report by ID

Gets report definition details by ID.

Authentication

Bearer Token

Path Parameters

Parameter Type
id string

Response

{
  "id": "report_123",
  "name": "Monthly Revenue Report",
  "description": "Revenue breakdown by month",
  "type": "financial",
  "dataSource": "invoices",
  "filters": {
    "status": "paid",
    "dateRange": "monthly"
  },
  "columns": ["date", "amount", "currency", "vendor"],
  "groupBy": "date",
  "sortBy": "date desc",
  "createdAt": "2026-06-02T10:30:00Z"
}
GET /api/reports

List Reports

Gets all report definitions with pagination.

Authentication

Bearer Token

Query Parameters

Parameter Type Description
$filter string OData filter expression
$skip integer Skip n records
$top integer Take n records

Response

{
  "value": [
    {
      "id": "report_123",
      "name": "Monthly Revenue Report",
      "type": "financial",
      "createdAt": "2026-06-02T10:30:00Z"
    }
  ],
  "count": 30
}
PUT /api/reports/{id}

Update Report

Updates report definition.

Authentication

Bearer Token

Request Body

{
  "name": "Monthly Revenue Report - Updated",
  "description": "Updated revenue breakdown by month and vendor",
  "columns": ["date", "amount", "currency", "vendor", "product_type"],
  "groupBy": "date, vendor"
}

Response

{
  "id": "report_123",
  "name": "Monthly Revenue Report - Updated",
  "updatedAt": "2026-06-02T11:00:00Z"
}
DELETE /api/reports/{id}

Delete Report

Deletes a report definition.

Authentication

Bearer Token

Response

{
  "success": true,
  "message": "Report deleted"
}
POST /api/reports/{id}/execute

Execute Report

Executes a report and returns data.

Authentication

Bearer Token

Request Body

{
  "dateRange": "2026-05-01 to 2026-05-31",
  "format": "json",
  "includeMetadata": true
}

Response

{
  "reportId": "report_123",
  "executedAt": "2026-06-02T11:10:00Z",
  "rows": [
    {
      "date": "2026-05-01",
      "amount": 5234.50,
      "currency": "USD",
      "vendor": "Vendor A"
    },
    {
      "date": "2026-05-02",
      "amount": 3120.00,
      "currency": "USD",
      "vendor": "Vendor B"
    }
  ],
  "totalRows": 31,
  "summary": {
    "totalAmount": 156780.50,
    "averageAmount": 5054.21
  }
}

Error Responses

Code HTTP Status Description
REPORT_NOT_FOUND 404 Report does not exist
INVALID_DATA_SOURCE 400 Invalid data source specified
INVALID_COLUMNS 400 One or more columns do not exist in data source
EXECUTION_FAILED 400 Report execution failed

Quick Links