> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # hog_functions_rerun_create ## OpenAPI ```json POST /api/projects/{project_id}/hog_functions/{id}/rerun/ { "paths": { "/api/projects/{project_id}/hog_functions/{id}/rerun/": { "post": { "operationId": "hog_functions_rerun_create", "description": "Rerun past invocations of this hog function from their stored payloads.\n\nThe CDP worker reads matching rows from the `hog_invocation_results`\nClickHouse table, rehydrates the invocation from the stored\n`invocation_globals`, and re-enqueues onto cyclotron. Each rerun\nrun reuses the original `invocation_id` with `is_retry=1` set on the\nnew lifecycle row so the UI can surface that it was a rerun.\n\nOnly types a cyclotron worker executes (`TYPES_THAT_CAN_RERUN`) can be\nrerun: rerun re-enqueues onto the cyclotron hog queue, and other types\nrun elsewhere (source webhooks inline in the cdp-api HTTP handler,\ntransformations during ingestion, `site_*` transpiled to client-side\nJS). A re-enqueued invocation of one of those would never drain and\nwedges the partition, so a rerun of a non-rerunnable type is rejected\nwith a 400 here. A disabled function is rejected the same way: the\nworker skips its invocations, so the rerun could never execute.\n\nBecause rerun replays historical event/person/group data, it requires\n`person:read` and `group:read` on top of `hog_function:write`.", "parameters": [ { "in": "path", "name": "id", "schema": { "type": "string", "format": "uuid" }, "description": "A UUID string identifying this hog function.", "required": true }, { "$ref": "#/components/parameters/ProjectIdPath" } ], "tags": [ "hog_functions", "hog_functions" ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HogInvocationRerunRequest" } }, "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/HogInvocationRerunRequest" } }, "multipart/form-data": { "schema": { "$ref": "#/components/schemas/HogInvocationRerunRequest" } } }, "required": true }, "security": [ { "PersonalAPIKeyAuth": [ "hog_function:write", "person:read", "group:read" ] } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HogInvocationRerunResponse" } } }, "description": "" }, "400": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HogInvocationRerunResponse" } } }, "description": "" } }, "x-product": [ "cdp" ] } } }, "components": { "schemas": { "HogInvocationRerunRequest": { "type": "object", "description": "Rerun invocations of a hog function or hog flow from their stored payloads.", "properties": { "filter": { "allOf": [ { "$ref": "#/components/schemas/HogInvocationRerunFilter" } ], "description": "Required. `window_start` / `window_end` pin the query to a small set of date partitions on the `hog_invocation_results` table. Optional `invocation_ids` restricts to specific invocations within that window." } }, "required": [ "filter" ] }, "HogInvocationRerunResponse": { "type": "object", "description": "Response from the rerun endpoint. The endpoint only enqueues a wrapper\njob onto the cyclotron `rerun` queue — the actual ClickHouse paging and\nre-enqueue work happens asynchronously in the `cdp-rerun-worker` service.\nUse `rerun_job_id` to look up progress on the wrapper job later.", "properties": { "rerun_job_id": { "type": "string", "description": "ID of the cyclotron wrapper job that will run the rerun. Use this to poll status." }, "queued_count": { "type": "integer", "description": "Always 0 — rerun runs asynchronously. Kept for response shape stability." }, "skipped_count": { "type": "integer", "description": "Always 0 — rerun runs asynchronously. Kept for response shape stability." } }, "required": [ "queued_count", "rerun_job_id", "skipped_count" ] }, "HogInvocationRerunFilter": { "type": "object", "description": "Filter shape for the rerun endpoint. `window_start`/`window_end` are required.", "properties": { "window_start": { "type": "string", "format": "date-time", "description": "Inclusive lower bound on `scheduled_at` (UTC)." }, "window_end": { "type": "string", "format": "date-time", "description": "Exclusive upper bound on `scheduled_at` (UTC)." }, "status": { "type": "array", "items": { "$ref": "#/components/schemas/HogInvocationRerunFilterStatusEnum" }, "description": "Restrict to invocations whose latest status is one of these. Defaults to ['failed']." }, "error_kind": { "type": "array", "items": { "type": "string" }, "description": "Restrict to invocations whose error_kind matches one of these (e.g. 'http_5xx', 'timeout')." }, "error_message_contains": { "type": "string", "description": "Restrict to invocations whose error_message contains this substring (case-insensitive). Use to isolate one failure mode when error_kind is too coarse (most app-level errors share the 'hog_error' kind).", "maxLength": 200 }, "max_attempts": { "type": "integer", "maximum": 255, "minimum": 1, "description": "Skip invocations that have already been attempted this many times or more." }, "max_count": { "type": "integer", "maximum": 10000, "minimum": 1, "description": "Maximum number of invocations to rerun in this request. Server-side cap is 10000." }, "invocation_ids": { "type": "array", "items": { "type": "string" }, "description": "Optional restriction to specific invocation IDs within the window. Capped at 10000 per request. Always combined with `window_start`/`window_end` so the ClickHouse query can be partition-pruned.", "maxItems": 10000 } }, "required": [ "window_end", "window_start" ] }, "HogInvocationRerunFilterStatusEnum": { "enum": [ "running", "succeeded", "failed", "canceled" ], "type": "string", "description": "* `running` - running\n* `succeeded` - succeeded\n* `failed` - failed\n* `canceled` - canceled" } } } } ```