ghl_workflow_get_log_statistics
Count workflow log records grouped by status, step, type, removal reason, or time to reveal enrollments, completions, failures, and trends.
Instructions
WORKFLOW API — limited availability: enabled for selected sub-accounts only; others get 403 WORKFLOW_API_NOT_ENABLED_FOR_LOCATION (not a token or scope problem). Suggested order: get step types -> build the definition -> validate (validate_workflow_definition, read-only) -> create (always lands in draft) -> publish via update status. Rate limits: integration daily quota + 10s burst (X-RateLimit-* headers) AND a per-sub-account budget per 10s window with reads and writes counted separately; no Retry-After is sent. Logs: default and max range 30 days; retained 60 days.
Get Workflow Log Statistics
Limited availability. The workflow API is currently enabled for selected sub-accounts only; any other sub-account receives 403 WORKFLOW_API_NOT_ENABLED_FOR_LOCATION.
Count the log records of one workflow, grouped by one or more dimensions. It answers how many: enrollments, completions, failures per step, why contacts left, and trends over time. To answer who, use Get Workflow Logs.
Before you call it. Get workflowId from Search Workflows. Never pass a workflow name.
Grouping. Each row holds one value for every dimension in groupBy, plus count. Grouping by week, day or hour adds bucket, the start of each interval in timezone. startDate and endDate always stay UTC. Rows are sorted by the grouped values in ascending order (status, then type, stepId, removedReason and bucket), not by count.
Finding filter values. Group by a dimension to see which values this workflow has, then filter on them. For example, groupBy=removedReason lists the reasons present, and those values work in removedReasons.
Steps. Rows grouped by stepId also carry stepName, the name of that step on its most recent log record in the date range. stepId matches actions[].id in Get Workflow Definition. A step count includes the remove_from_workflow record written when a contact leaves the workflow at that step, so group by stepId and type together to count how often the step itself ran.
Common questions.
Enrollments: `statuses=added_ Endpoint: GET /workflows/{workflowId}/logs/aggregate (Version header: v3; source: v3/workflows-v3.json) OAuth scopes: workflows.logs Pagination params: limit — pass them to page through full result sets.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of grouped rows. A grouping that produces more is refused with 422 rather than truncated. Default 1000, maximum 5000 | |
| types | No | Count only these step types: a step `type` key, as listed by Get Step Types or in `actions[].type` of Get Workflow Definition. Unlike Get Workflow Logs, `if_else` and `drip` match only those exact keys here. New values can appear. Group by `type` first to see the types this workflow has | |
| endDate | No | End of the range, ISO 8601. A plain date includes the whole day. At most 30 days after startDate. Defaults to now | |
| groupBy | No | Dimensions to group the counts by. Repeat the parameter or send a comma-separated list. `status` is the step outcome, `type` the step type, `stepId` the step, `removedReason` why the contact left the workflow, and `week`, `day` or `hour` a time bucket (one at most). Defaults to `status` | |
| statuses | No | Count only these step outcomes. Values: `added_to_workflow` (the contact entered the workflow), `success` (the step ran), `error` and `failed` (the step did not complete), `failed_retry_limit_reached` (the step gave up after its retries), `retry` (the step will run again), `skipped` (the step did not run, for example because of DND, a time window or missing data), `waiting` (the contact is waiting at the step), `wait_finished` (a wait ended), `finished` (the contact left the workflow, see removedReason), `paused_due_to_draft_mode` (the workflow was unpublished while the contact was in it), `contact_merged` (the contact was merged into another contact), `drip_queued` (the contact is waiting in a drip step for its batch), `drip_resume` (the batch was released and the contact moved on), `processing` (the step has started and has not finished yet), and `winner_declared` (an A/B test step picked its winning path; the record has no contact). New values can appear. Group by `status` first to see the values this workflow has | |
| timezone | No | IANA timezone for the week, day and hour buckets. It does not move startDate and endDate, which stay UTC. Defaults to UTC | |
| startDate | No | Start of the range, ISO 8601: a plain date (start of that day, UTC) or a full timestamp. Send it together with endDate. Defaults to 30 days ago. Logs are available for the last 60 days, so it cannot be earlier than that | |
| locationId | Yes | Sub-account (location) ID. It must be the sub-account the token belongs to, otherwise the request is refused with 403 | |
| workflowId | Yes | Workflow ID. Get it from Search Workflows. Never pass a workflow name | |
| removedReasons | No | Count only records removed for these reasons. Values: `end_of_workflow` (the contact reached the end), `contact_deleted` (the contact was deleted), `deleted_workflow` (the workflow was deleted), `record_deleted` (the record was deleted), `goal_action` (a goal step removed the contact), `contact_reply_stop_response` (the contact replied and the workflow stops on reply), `contact_merge` (the contact was merged), `appointment-change`, `invoice-change` and `service-booking-change` (the appointment, invoice or booking changed and the workflow restarted for the contact), `attendee-change` (the Events attendee or their event changed, and the run for that attendee ended), `rental-booking-change` (the rental booking that started the workflow was deleted or cancelled), `wait_step_window_in_past` (a wait step time window pointed to a time in the past, so the contact left), and `missing-data` (the step the contact was on was deleted from the workflow). Values are exact, including the ones with hyphens. New values can appear. Group by `removedReason` first to see the values this workflow has |