> ## Documentation Index
> Fetch the complete documentation index at: https://docs.accelbooks.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Report Builder

> Generate comprehensive financial reports with AccelBooks' Report Builder.

## Overview

AccelBooks provides a sophisticated reporting feature that allows businesses to generate essential financial reports and leverage artificial intelligence to produce custom documents based on specific prompts. This enables insightful and predictive financial analysis.

## Available Reports

AccelBooks supports several types of financial reports, including standard reports and custom AI-generated documents:

* **Balance Sheets**: Snapshot of the company's financial position at a specific date.
* **Profit and Loss Statements**: Detailed account of revenues, costs, and expenses over a period.
* **Cash Flow Reports**: Analysis of cash inflows and outflows during a specific timeframe.
* **Custom AI-Generated Reports**: Customized reports generated using AI based on user-defined prompts for in-depth analysis.

## API Endpoints

Below are the API endpoints available for generating and retrieving financial reports. These descriptions assume a RESTful API design.

### Generate Balance Sheet

Generates a balance sheet for the specified date and company.

```bash theme={null}
POST company/{company_id}/reports/balance-sheet
Content-Type: application/json
Authorization: Bearer {access_token}

{
  "start_date": "2024-01-01",
  "end_date": "2024-12-31"
}
```

Returns:

```json theme={null}
{
  "report_id": "bs-123456",
  "report_type": "balance_sheet",
  "company_id": "company_123",
  "start_date": "2024-01-01",
  "end_date": "2024-12-31",
  "generated_at": "2024-01-02T12:00:00Z",
  "download_url": "https://api.accelbooks.com/reports/bs-123456.pdf"
}
```

### Generate Profit and Loss Statement

Retrieves a profit and loss statement for a defined period for the specified company.

```bash theme={null}
POST company/{company_id}/reports/profit-loss
Content-Type: application/json
Authorization: Bearer {access_token}

{
  "start_date": "2024-01-01",
  "end_date": "2024-12-31"
}
```

Returns:

```json theme={null}
{
  "report_id": "pl-789012",
  "report_type": "profit_and_loss",
  "company_id": "company_123",
  "start_date": "2024-01-01",
  "end_date": "2024-12-31",
  "generated_at": "2024-01-02T12:05:00Z",
  "download_url": "https://api.accelbooks.com/reports/pl-789012.pdf"
}
```

### Generate Cash Flow Report

Produces a cash flow report by comparing two periods for the selected company.

```bash theme={null}
POST company/{company_id}/reports/cash-flow
Content-Type: application/json
Authorization: Bearer {access_token}

{
  "current_period_start": "2024-01-01",
  "current_period_end": "2024-06-30",
  "previous_period_start": "2023-01-01",
  "previous_period_end": "2023-06-30"
}
```

Returns:

```json theme={null}
{
  "report_id": "cf-345678",
  "report_type": "cash_flow",
  "company_id": "company_123",
  "current_period_start": "2024-01-01",
  "current_period_end": "2024-06-30",
  "previous_period_start": "2023-01-01",
  "previous_period_end": "2023-06-30",
  "generated_at": "2024-01-02T12:10:00Z",
  "download_url": "https://api.accelbooks.com/reports/cf-345678.pdf"
}
```

### Generate Custom AI-Generated Report

Creates a custom report using AI based on a user-defined prompt for predictive financial insights.

```bash theme={null}
POST company/{company_id}/reports/custom-ai
Content-Type: application/json
Authorization: Bearer {access_token}

{
  "start_date": "2024-01-01",
  "end_date": "2024-12-31",
  "prompt": "Provide a 12-month revenue forecast based on current trends and seasonal adjustments."
}
```

Returns:

```json theme={null}
{
  "report_id": "ai-901234",
  "report_type": "custom_ai",
  "company_id": "company_123",
  "start_date": "2024-01-01",
  "end_date": "2024-12-31",
  "prompt": "Provide a 12-month revenue forecast based on current trends and seasonal adjustments.",
  "generated_at": "2024-01-02T12:15:00Z",
  "download_url": "https://api.accelbooks.com/reports/ai-901234.pdf"
}
```

## Retrieving Reports

Access previously generated reports using the following endpoint:

```bash theme={null}
GET /reports/{report_id}
Authorization: Bearer {access_token}
```

Returns:

```json theme={null}
{
  "report_id": "report_id",
  "report_type": "balance_sheet|profit_and_loss|cash_flow|custom_ai",
  "company_id": "company_123",
  "generated_at": "2024-01-02T12:00:00Z",
  "download_url": "https://api.accelbooks.com/reports/report_id.pdf",
  // Additional fields depending on the report type
}
```

This endpoint allows you to retrieve any of the generated reports by providing the report's unique identifier.
