# Analytics API

Source: https://frameleaf.app/docs/api/reference/analytics/

Use your own server and its scoped API keys.

## Retrieve library analytics

GET /api/analytics

Counts, sizes, dated history and processing outcomes for one selection and date range. Series that are not recorded for the selection are omitted or null, never filled in; estimated processing cost is an estimate, not a charge.

```json
{
  "description": "Counts, sizes, dated history and processing outcomes for one selection and date range. Series that are not recorded for the selection are omitted or null, never filled in; estimated processing cost is an estimate, not a charge.",
  "operationId": "getAnalyticsReport",
  "parameters": [
    {
      "name": "range",
      "required": false,
      "in": "query",
      "schema": {
        "default": "year",
        "$ref": "#/components/schemas/AnalyticsRange"
      }
    },
    {
      "name": "scope",
      "required": false,
      "in": "query",
      "description": "`all` (the whole server, administrators only), `account:<id>` or `library:<id>`",
      "schema": {
        "default": "all",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AnalyticsReportResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Retrieve library analytics",
  "tags": [
    "Analytics"
  ],
  "x-frameleaf-permission": "all"
}
```

## List analytics scopes

GET /api/analytics/scopes

The selections the signed-in account may read analytics for: the whole server for administrators, then accounts and external libraries.

```json
{
  "description": "The selections the signed-in account may read analytics for: the whole server for administrators, then accounts and external libraries.",
  "operationId": "getAnalyticsScopes",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AnalyticsScopesResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "List analytics scopes",
  "tags": [
    "Analytics"
  ],
  "x-frameleaf-permission": "all"
}
```
