> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfycontrol.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Rerun Workflow

> Rerun an existing workflow with new parameters

## Overview

Rerun an existing workflow with new parameter values while keeping the same workflow structure. This is useful for executing the same workflow definition with different inputs.

<Note>
  The workflow definition (JSON structure) is reused from the original workflow. Only dynamic parameters can be changed.
</Note>

<Warning>
  The API playground does not support file uploads. Use cURL, Postman, or your application code to test this endpoint.
</Warning>

## Content Type

This endpoint requires `multipart/form-data` content type for file upload support.

**Maximum file size:** 50MB per request

## Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier (UUID) of the workflow to rerun.
</ParamField>

## Request Parameters

Only include dynamic parameters you want to update. The original workflow's name, tags, and structure are preserved.

### Dynamic Parameters

<ParamField body="$text_parameter_name" type="string">
  Text parameter - prefix the field name with `$` followed by the placeholder name.

  Example: `$prompt` for a new text prompt
</ParamField>

<ParamField body="$file_parameter_name" type="file">
  File parameter - prefix the field name with `$` followed by the placeholder name, and include the new file.

  Example: `$input_image` for a new image file
</ParamField>

<ParamField body="#choice_parameter_name" type="string">
  Choice parameter - prefix the field name with `#` followed by the placeholder name.

  Example: `#sampler` for a different sampler
</ParamField>

<Info>
  Learn more about placeholders and dynamic parameters in the [Workflows concept](/concepts/workflows) page.
</Info>

## Response

<ResponseField name="id" type="string" required>
  Unique identifier (UUID) for the new workflow instance.
</ResponseField>

<ResponseField name="name" type="string" required>
  The workflow's name (same as original).
</ResponseField>

<ResponseField name="status" type="string" required>
  Initial status of the workflow (typically `accepted`).

  Possible values: `accepted`, `uploaded`, `queued`, `running`, `completed`, `cancelled`, `invalid`, `failed`
</ResponseField>

<ResponseField name="tags" type="string[]" required>
  Array of tags associated with the workflow (same as original).
</ResponseField>

<ResponseField name="created_at" type="string" required>
  ISO 8601 timestamp when the new workflow was created.
</ResponseField>

<ResponseField name="updated_at" type="string" required>
  ISO 8601 timestamp when the workflow was last updated.
</ResponseField>

<ResponseField name="started_at" type="string">
  ISO 8601 timestamp when execution started (null initially).
</ResponseField>

<ResponseField name="completed_at" type="string">
  ISO 8601 timestamp when execution completed (null initially).
</ResponseField>

## Example Response

```json theme={null}
{
  "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "name": "Text to Image Generation",
  "status": "accepted",
  "tags": ["production", "text2img"],
  "created_at": "2024-01-15T15:45:00Z",
  "updated_at": "2024-01-15T15:45:00Z",
  "started_at": null,
  "completed_at": null
}
```

## cURL Example

Since the API playground doesn't support file uploads, use this cURL command to test:

```bash theme={null}
curl -X POST https://api.comfycontrol.app/v1/workflow/{id}/rerun \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -F '$prompt=New prompt text here' \
  -F '$input_image=@/path/to/new-image.png' \
  -F '#sampler=dpm_2'
```

Replace:

* `{id}` with the workflow UUID you want to rerun
* `YOUR_API_TOKEN` with your actual API token
* Only include the parameters you want to change
* Use `$` prefix for text/file parameters, `#` prefix for choice parameters

The `-F` flag automatically handles `multipart/form-data` with proper boundaries.

## Error Responses

<ResponseField name="400" type="error">
  Bad request - validation error in the request.

  Common causes:

  * File size exceeds 50MB limit
  * Invalid parameter format
  * Workflow parameter validation failed
  * No runner available with matching tags
</ResponseField>

<ResponseField name="401" type="error">
  Unauthorized - invalid or missing authentication token.
</ResponseField>

<ResponseField name="403" type="error">
  Forbidden - workflow parameter limit exceeded for your tier.
</ResponseField>

<ResponseField name="404" type="error">
  Not Found - original workflow with the specified ID does not exist or does not belong to your account.
</ResponseField>

## Notes

* Creates a new workflow instance with a new UUID
* Original workflow remains unchanged
* Workflow structure (JSON) is copied from the original
* Name and tags are copied from the original workflow
* Only dynamic parameters need to be provided
* The rerun workflow is scheduled on available runners based on the original workflow's tags
* Useful for batch processing with different inputs
* Each rerun counts toward your workflow limits
* **Use cURL, Postman, or application code** for testing - the API playground doesn't support file uploads
