---
title: "Generation API"
description: "Generate AI content"
canonical_url: https://reelmirror.com/docs/api/generation
markdown_url: https://reelmirror.com/docs/api/generation.md
last_updated: 2026-11-09
---
# ReelMirror API reference: Generation

> Generate AI content

The ReelMirror API is in beta. Base URL: `https://reelmirror.com/api` (every path starts with `/v1`). Authenticate every request with `Authorization: Bearer rm_...`. Machine-readable contract: https://reelmirror.com/docs/openapi.json.

## Endpoints

- [Generate from source post](https://reelmirror.com/docs/api/generation#generate): `POST /v1/generate`
- [Regenerate media item](https://reelmirror.com/docs/api/generation#regenerate-media-item): `POST /v1/generate/media-item`
- [Voice convert video](https://reelmirror.com/docs/api/generation#voice-convert): `POST /v1/generate/voice-convert`
- [Toggle public visibility](https://reelmirror.com/docs/api/generation#toggle-public): `POST /v1/generate/toggle-public`
- [Clone from Instagram URL](https://reelmirror.com/docs/api/generation#clone-url): `POST /v1/clone-url`
- [Regenerate post](https://reelmirror.com/docs/api/generation#regenerate-post): `POST /v1/generate/regenerate-post`

### Generate from source post

`POST /v1/generate`

Authentication: bearer token · Operation ID: `generate`

Trigger AI content generation from a synced source post. Debits balance per media item + caption.

#### Request body (application/json, required)

- `source_post_id` (string, uuid; required)
- `persona_id` (string, uuid; required)
- `auto_publish` (boolean, default false; optional): When true, automatically publish to persona's connected accounts when generation completes

#### Response 202

Generation started

Fields inside `data`:

- `id` (string; optional): The generated post ID
- `status` (string, one of `started`; optional)

#### Example request

```bash
curl -X POST "https://reelmirror.com/api/v1/generate" \
  -H "Authorization: Bearer $REELMIRROR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "source_post_id": "8f14e45f-ceea-4e7a-9c2d-3b1a5f2e7c10",
  "persona_id": "c9f0f895-fb98-4b91-9e3f-1d2a6b7c8d20"
}'
```

### Regenerate media item

`POST /v1/generate/media-item`

Authentication: bearer token · Operation ID: `regenerateMediaItem`

Create a new version of a generated media item.

#### Request body (application/json, required)

- `generated_media_item_id` (string, uuid; required)

#### Response 202

Regeneration started

Fields inside `data`:

- `id` (string; optional): The new generated media item ID
- `status` (string, one of `started`; optional)

#### Example request

```bash
curl -X POST "https://reelmirror.com/api/v1/generate/media-item" \
  -H "Authorization: Bearer $REELMIRROR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "generated_media_item_id": "8f14e45f-ceea-4e7a-9c2d-3b1a5f2e7c10"
}'
```

### Voice convert video

`POST /v1/generate/voice-convert`

Authentication: bearer token · Operation ID: `voiceConvert`

Apply voice conversion to a completed generated video. Requires persona to have a voice sample.

#### Request body (application/json, required)

- `generated_media_item_id` (string, uuid; required)

#### Response 202

Voice conversion started

Fields inside `data`:

- `id` (string; optional): The generated media item ID
- `status` (string, one of `started`; optional)

#### Example request

```bash
curl -X POST "https://reelmirror.com/api/v1/generate/voice-convert" \
  -H "Authorization: Bearer $REELMIRROR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "generated_media_item_id": "8f14e45f-ceea-4e7a-9c2d-3b1a5f2e7c10"
}'
```

### Toggle public visibility

`POST /v1/generate/toggle-public`

Authentication: bearer token · Operation ID: `togglePublic`

Make a generated media item public or private. Discounted public items are locked for 20 days.

#### Request body (application/json, required)

- `generated_media_item_id` (string, uuid; required)
- `is_public` (boolean; required)

#### Response 200

Visibility updated

Fields inside `data`:

- `id` (string; optional)
- `is_public` (boolean; optional)

#### Example request

```bash
curl -X POST "https://reelmirror.com/api/v1/generate/toggle-public" \
  -H "Authorization: Bearer $REELMIRROR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "generated_media_item_id": "8f14e45f-ceea-4e7a-9c2d-3b1a5f2e7c10",
  "is_public": true
}'
```

### Clone from Instagram URL

`POST /v1/clone-url`

Authentication: bearer token · Operation ID: `cloneUrl`

Fetch a single Instagram post by URL and generate AI content from it in one step.

#### Request body (application/json, required)

- `url` (string; required): Instagram post/reel/TV URL
- `persona_id` (string, uuid; required)

#### Response 202

Clone started

Fields inside `data`:

- `id` (string; optional): The generated post ID
- `status` (string, one of `started`; optional)

#### Example request

```bash
curl -X POST "https://reelmirror.com/api/v1/clone-url" \
  -H "Authorization: Bearer $REELMIRROR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://reelmirror.com/…",
  "persona_id": "8f14e45f-ceea-4e7a-9c2d-3b1a5f2e7c10"
}'
```

### Regenerate post

`POST /v1/generate/regenerate-post`

Authentication: bearer token · Operation ID: `regeneratePost`

Regenerate a generated post. By default, soft-deletes all existing media items and re-triggers generation from scratch. When `failed_only` is true, retries only failed media items without touching completed ones or the caption.

#### Request body (application/json, required)

- `generated_post_id` (string, uuid; required)
- `failed_only` (boolean, default false; optional): When true, retry only failed media items instead of regenerating the entire post.

#### Response 202

Regeneration started. When `failed_only` is true, the response includes `retried_items` and `total_cost_cents`.

Fields inside `data`:

- One of:
  - **Option 1**: Full regeneration response
    - `id` (string; optional): The generated post ID
    - `status` (string, one of `started`; optional)
  - **Option 2**: Failed-only retry response
    - `id` (string; optional): The generated post ID
    - `status` (string, one of `started`; optional)
    - `retried_items` (array of object; optional)
      - `original_item_id` (string, uuid; optional)
      - `new_item_id` (string, uuid; optional)
      - `media_type` (string, one of `image`, `video`; optional)
      - `status` (string, one of `pending`; optional)
    - `total_cost_cents` (integer; optional)

Errors: `422` return the standard error envelope.

#### Example request

```bash
curl -X POST "https://reelmirror.com/api/v1/generate/regenerate-post" \
  -H "Authorization: Bearer $REELMIRROR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "generated_post_id": "8f14e45f-ceea-4e7a-9c2d-3b1a5f2e7c10"
}'
```

