# Create Statistics Report

Creates a statistics report (Analytics Reports in the app): a chart of how many contacts got the given tags per period. The tags must exist in the account; contacts are not changed. Read its numbers with get-statistics-report, change it with update-statistics-report.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Name of the report in KlickTipp",
      "minLength": 1,
      "maxLength": 250
    },
    "tagIds": {
      "type": "array",
      "description": "IDs of the tags the report counts, from search-tags; a repeated ID is stored once",
      "items": {
        "type": "integer",
        "minimum": 1
      },
      "minItems": 1
    },
    "chart": {
      "type": [
        "null",
        "string"
      ],
      "description": "progress (taggings per period), continuous (running total) or total (one bar per tag); omit for progress",
      "default": null,
      "enum": [
        "progress",
        "continuous",
        "total"
      ]
    },
    "granularity": {
      "type": [
        "null",
        "string"
      ],
      "description": "hour, day, month or year; omit for day",
      "default": null,
      "enum": [
        "hour",
        "day",
        "month",
        "year"
      ]
    },
    "rangeFrom": {
      "type": [
        "null",
        "string"
      ],
      "description": "First day of the range as a calendar date YYYY-MM-DD, not after rangeTo, or 0 for no start",
      "default": null,
      "pattern": "^(\\d{4}-\\d{2}-\\d{2}|0)$"
    },
    "rangeTo": {
      "type": [
        "null",
        "string"
      ],
      "description": "Last day of the range as a calendar date YYYY-MM-DD, not before rangeFrom, or 0 for today",
      "default": null,
      "pattern": "^(\\d{4}-\\d{2}-\\d{2}|0)$"
    },
    "metaLabels": {
      "type": "array",
      "description": "Labels of the report",
      "default": null,
      "items": {
        "type": "string",
        "maxLength": 250
      }
    },
    "notes": {
      "type": [
        "null",
        "string"
      ],
      "description": "Internal note",
      "default": null,
      "maxLength": 1000
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "User ID of the account; omit for the account of the access token",
      "default": null,
      "minimum": 1
    }
  },
  "required": [
    "name",
    "tagIds"
  ],
  "additionalProperties": false
}
```

## Output schema:

```json
{
  "type": "object",
  "required": [
    "accountId",
    "type",
    "id",
    "settings",
    "ui"
  ],
  "properties": {
    "accountId": {
      "type": "integer"
    },
    "type": {
      "type": "string"
    },
    "id": {
      "type": "integer"
    },
    "settings": {
      "type": "object"
    },
    "ui": {
      "type": "object"
    }
  },
  "additionalProperties": false
}
```

