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

# Regenerate

Re-run the pipeline against an existing asset_id without changing the embed URL.

# Regenerate

[`POST /api/assets/:id/regenerate`](/api/assets/regenerate) replaces an asset's mp4 in place. The `asset_id` and proxy URL stay constant; the next request streams the new generation.

```bash
curl -X POST "https://motioness.com/api/assets/$ASSET_ID/regenerate" \
  -H 'Content-Type: application/json' -b cookie.txt \
  -d '{ "motion": "kinetic", "dur_seconds": 6 }'
# → { "asset_id": "a25b…", "status": "pending" }
```

## When to use it

- The output looks off and you want to retry with a different `prompt` / `seed`.
- You changed brand context and want existing assets to pick it up.
- A user clicked "Try another variant" in your dashboard.

## What it preserves

| Stays the same | Changes |
|---|---|
| `asset_id` | mp4 bytes, R2 path, `vision_prompt`, `loop_mode` |
| Proxy URL | `model` (if tier changed) |
| Edge cache key | Generation count |

The edge cache for the proxy URL gets purged automatically when the new mp4 finalizes.

## Request body

All fields optional. Omitted fields keep the asset's current values.

```json
{
  "motion": "subtle | medium | kinetic",
  "mode": "loop | animate-in | animate-on-hover",
  "dur_seconds": 4,
  "prompt_override": "cinematic slow pan left",
  "seed": 42
}
```

`prompt_override` replaces the brand-aware vision prompt for this regeneration only.

## Quota

Each regenerate counts as **one generation** against the project owner's monthly quota — same as a fresh `prepare`. `mode=loop` still costs two Replicate calls under the hood but charges as one.

## Watching the new mp4 land

Same lifecycle as a fresh asset. Subscribe via SSE:

```bash
curl -N "https://motioness.com/v1/$KEY/events/$ASSET_ID"
```

Or webhooks — `asset.completed` fires again when the new mp4 finishes.

## Errors

| Status | Body | Meaning |
|---|---|---|
| 404 | `{"error":"not found"}` | Asset doesn't exist or belongs to another user |
| 429 | `{"error":"monthly generation limit reached"}` | Free/Pro tier exhausted; upgrade |
| 429 | `{"error":"overage disabled — enable in project settings or upgrade plan"}` | Pro+ but overage toggle off |

## Iterating with the dashboard

The dashboard exposes a **Regenerate** button on every asset that opens a modal with the same fields. The pattern is the same as the API; the dashboard just authenticates via session cookie.

## What it doesn't do

- It doesn't change the source URL. To swap sources, mint a new proxy URL — the source URL is part of the asset key.
- It doesn't roll back to a previous generation. Each regenerate replaces the previous mp4. Keep variant URLs by varying `?idem=` instead.