> For the complete documentation index, see [llms.txt](https://docs.bitsby.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bitsby.app/api-documentation/invoice-statistics.md).

# Invoice statistics

## Description

Allows you to get general statistics on your invoices and payments.

## Request

```bash
curl -X POST https://api.bitsby.app/statistics/invoices \
  -H "Authorization: Token MSvL2ltaDZdWVjmZURURMVWhqSJLT2NURjhL2Fla1Z1T1IxQTltKs1T3Ay" \
	-F "startDate=2000-01-01" \
	-F "endDate=2030-01-01"
```

## Request parameters

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Data type</th><th>Description</th><th>Example</th><th>Mandatory?</th></tr></thead><tbody><tr><td><code>startDate</code></td><td>String</td><td>Start date of invoice creation in Y-m-d format</td><td>2000-01-01</td><td>no</td></tr><tr><td><code>endDate</code></td><td>String</td><td>End date of invoice creation in Y-m-d format</td><td>2030-01-01</td><td>no</td></tr></tbody></table>

## Example answer

```json
{
    "result": "success",
    "data": {
        "invoicesTotalNum": 51,
        "invoicesPaidNum": 24,
        "invoicesTotalUSD": 335.03,
        "invoicesByProjects": {
            "9deea1e2-0c08-41a3-bdc2-a34eada3892d": 335.03
        },
        "invoicesByCurrencies": {
            "USD": 335.03
        },
        "invoicesByMonths": {
            "March-2024": 42,
            "February-2024": 293.03
        },
        "invoicesByDate": {
            "2024-03-04": {
                "date": 1709510400000,
                "value": 21
            },
            "2024-03-03": {
                "date": 1709424000000,
                "value": 10
            },
            "2024-03-01": {
                "date": 1709251200000,
                "value": 11
            },
            "2024-02-27": {
                "date": 1708992000000,
                "value": 12
            },
            "2024-02-26": {
                "date": 1708905600000,
                "value": 38
            }
        }
    }
}
```

## Answer parameters

| Parameter              | Description                                          |
| ---------------------- | ---------------------------------------------------- |
| `invoicesTotalNum`     | Total number of invoices                             |
| `invoicesPaidNum`      | Number of paid invoices (with status "Paid")         |
| `invoicesTotalUSD`     | Sum of all paid invoices in USD                      |
| `invoicesByProjects`   | Sum of all paid invoices by projects in USD          |
| `invoicesByCurrencies` | Sum of all paid invoices by currency                 |
| `invoicesByMonths`     | Sum of all paid invoices by month in USD             |
| `invoicesByDate`       | Sum of all paid invoices by days in USD              |
| `invoicesByDate.date`  | Date in Unix Timestamp format including microseconds |
| `invoicesByDate.value` | Sum of all paid invoices for a specific date in USD  |
