# Read Automation Statistics

Reads how many contacts started and finished one automation, are active in it, ended on an open, wait for a queue job or failed -- lifetime totals, not restricted to a period -- and, when the account has conversion statistics, how many finished or reached a goal between from and to and how many of them reached each goal action. Only automations: a newsletter or autoresponder ID is refused, read those with get-campaign-statistics. Reads only.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "automationId": {
      "type": "integer",
      "description": "ID of the automation; a newsletter or autoresponder ID is refused",
      "minimum": 1
    },
    "from": {
      "type": [
        "null",
        "integer"
      ],
      "description": "Unix timestamp where the conversion period begins; omit for the beginning of the automation",
      "default": null,
      "minimum": 0
    },
    "to": {
      "type": [
        "null",
        "integer"
      ],
      "description": "Unix timestamp where the conversion period ends; omit for now",
      "default": null,
      "minimum": 0
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "User ID of the account; omit for the account the access token works in",
      "default": null,
      "minimum": 1
    }
  },
  "required": [
    "automationId"
  ],
  "additionalProperties": false
}
```

## Output schema:

```json
{
  "type": "object",
  "required": [
    "automationId",
    "name",
    "status",
    "totals",
    "conversion",
    "conversionAvailable",
    "statisticsUrl"
  ],
  "properties": {
    "automationId": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "totals": {
      "type": "object",
      "description": "Lifetime counts, not restricted to from and to.",
      "required": [
        "started",
        "finished",
        "active",
        "endedOnOpen",
        "waitingForJob",
        "failed",
        "converted"
      ],
      "properties": {
        "started": {
          "type": "integer"
        },
        "finished": {
          "type": "integer"
        },
        "active": {
          "type": "integer"
        },
        "endedOnOpen": {
          "type": "integer"
        },
        "waitingForJob": {
          "type": "integer"
        },
        "failed": {
          "type": "integer"
        },
        "converted": {
          "type": "integer"
        }
      }
    },
    "conversion": {
      "type": [
        "object",
        "null"
      ],
      "description": "Goal conversion within from and to; null when the account has no conversion statistics.",
      "required": [
        "from",
        "to",
        "finished",
        "converted",
        "goals"
      ],
      "properties": {
        "from": {
          "type": "string"
        },
        "to": {
          "type": "string"
        },
        "finished": {
          "type": "integer",
          "description": "Contacts that finished the automation or reached a goal in the period."
        },
        "converted": {
          "type": "integer",
          "description": "Of those, the contacts that reached a goal."
        },
        "goals": {
          "type": "array",
          "description": "One entry per goal action of the automation, also when nobody reached it.",
          "items": {
            "type": "object",
            "required": [
              "actionId",
              "name",
              "reached"
            ],
            "properties": {
              "actionId": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "reached": {
                "type": "integer"
              }
            }
          }
        }
      }
    },
    "conversionAvailable": {
      "type": "boolean"
    },
    "statisticsUrl": {
      "type": "string"
    }
  }
}
```

