---
title: "Refresh Stats Rollup For Automation"
method: POST
path: "/v1/stats/refresh_rollup_for_automation"
tags: ["stats"]
---

# Refresh Stats Rollup For Automation

`POST /v1/stats/refresh_rollup_for_automation`

## Request

- Base URL: `https://api.linktodm.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.linktodm.com/v1/stats/refresh_rollup_for_automation`
- Auth: none declared

## Headers

- `x-admin-api-key` string

## Request body

- RefreshStatsRollupForAutomationPayload: Payload for the per-automation rollup-refresh worker. Dispatched by `/v1/stats/refresh_rollup_all_automations` and consumed by `/v1/stats/refresh_rollup_for_automation`. Exactly one of `automation_id` (normal automation) / `flow_automation_id` (flow automation) must be set — the validator below rejects requests that fail this. Matches the shape of the underlying `automation_stats_lifetime` table.
  - `user_id` integer, required
  - `automation_id` integer, nullable
  - `flow_automation_id` integer, nullable

## Response `200`

Successful Response

- RefreshStatsRollupForAutomationResponse: Response from the per-automation rollup-refresh worker. `status` is either `ok` (delta applied / row upserted) or `skipped` (the new watermark wouldn't advance past the existing one, so no work was done).
  - `status` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/linktodm/apis/salesmorph.md) - [All operations](https://skmtc.dev/linktodm/apis/salesmorph/llms.txt) - [OpenAPI document](https://skmtc.dev/linktodm/apis/salesmorph/revisions/4af0ad5dbe92?raw)
