---
title: "Content Generation"
description: "How AI content generation works"
canonical_url: https://reelmirror.com/docs/guides/generation
markdown_url: https://reelmirror.com/docs/guides/generation.md
last_updated: 2026-11-09
---
# Content Generation

> How AI content generation works

## Overview

> [!NOTE]
> **TikTok tracking and generation is not yet supported.** It is coming soon. Currently, only Instagram sources can be tracked and used for generation.

ReelMirror generates AI content by analyzing source posts from tracked Instagram/TikTok accounts and creating new content that matches the creator's style. Generation is asynchronous — you start a job and poll for results.

## Generation Flow

```
1. Add source → 2. Sync content → 3. Generate → 4. Poll status → 5. Retrieve media
```

### Step 1: Add a source

Link an Instagram account to your persona:

```bash
curl -X POST https://reelmirror.com/api/v1/personas/PERSONA_ID/sources \
  -H "Authorization: Bearer rm_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"platform": "instagram", "username": "natgeo"}'
```

### Step 2: Sync content

Pull the latest posts from all tracked sources:

```bash
curl -X POST https://reelmirror.com/api/v1/personas/PERSONA_ID/sync \
  -H "Authorization: Bearer rm_YOUR_KEY"
```

This returns sync job IDs you can poll:

```json
{
  "job_ids": ["uuid-1", "uuid-2"],
  "estimated_cost_cents": 4
}
```

Poll each job until `status` is `completed`:

```bash
curl https://reelmirror.com/api/v1/sync-jobs/JOB_ID \
  -H "Authorization: Bearer rm_YOUR_KEY"
```

### Step 3: Generate content

Browse synced content and pick a source post:

```bash
curl "https://reelmirror.com/api/v1/personas/PERSONA_ID/source-posts?limit=10" \
  -H "Authorization: Bearer rm_YOUR_KEY"
```

Then generate from it:

```bash
curl -X POST https://reelmirror.com/api/v1/generate \
  -H "Authorization: Bearer rm_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_post_id": "SOURCE_POST_ID",
    "persona_id": "PERSONA_ID"
  }'
```

Response (HTTP 202):

```json
{
  "status": "started",
  "generated_post_id": "uuid"
}
```

Generation is asynchronous. Poll `GET /v1/generated-posts/{generated_post_id}` (Step 4) to retrieve media items and their statuses once processing completes.

### Step 4: Poll for results

```bash
curl https://reelmirror.com/api/v1/generated-posts/GENERATED_POST_ID \
  -H "Authorization: Bearer rm_YOUR_KEY"
```

When all media items have `status: "completed"`, the `url` fields contain your generated content.

Each media item also includes these additional fields: `is_public` (whether the item is publicly visible), `discount_applied` (whether the persona's discount mode was used), and `voice_conversion_status` (status of any voice conversion applied to the item, or `null`).

## Quick Clone

Skip the sync step entirely — clone directly from an Instagram URL:

```bash
curl -X POST https://reelmirror.com/api/v1/clone-url \
  -H "Authorization: Bearer rm_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.instagram.com/p/ABC123/",
    "persona_id": "PERSONA_ID"
  }'
```

This fetches the source post and triggers generation in one step.

## Regenerating Content

### Regenerate an entire post

Re-generate all media items and the caption for a post. Old items are soft-deleted and new ones are created:

```bash
curl -X POST https://reelmirror.com/api/v1/generate/regenerate-post \
  -H "Authorization: Bearer rm_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"generated_post_id": "GENERATED_POST_ID"}'
```

This debits your balance for the full cost again. The same `generated_post_id` is reused.

### Regenerate a single media item

If a specific media item didn't turn out well, regenerate just that item:

```bash
curl -X POST https://reelmirror.com/api/v1/generate/media-item \
  -H "Authorization: Bearer rm_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"generated_media_item_id": "ITEM_ID"}'
```

This creates a new version of the media item. Poll the item ID for the updated result.

### Retry failed items only

When a post partially fails (some items completed, some failed), you can retry only the failed items instead of regenerating the entire post. This preserves completed items and skips re-generating the caption:

```bash
curl -X POST https://reelmirror.com/api/v1/generate/regenerate-post \
  -H "Authorization: Bearer rm_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "generated_post_id": "GENERATED_POST_ID",
    "failed_only": true
  }'
```

Response (HTTP 202):

```json
{
  "status": "started",
  "generated_post_id": "uuid",
  "retried_items": [
    {
      "original_item_id": "uuid-of-failed-item",
      "new_item_id": "uuid-of-new-pending-item",
      "media_type": "video",
      "status": "pending"
    }
  ],
  "total_cost_cents": 25
}
```

Returns HTTP 422 if there are no failed items to retry. When `failed_only` is omitted or `false`, the endpoint behaves as a full regeneration (see above).

## Voice Conversion

Add voice conversion to a completed video:

```bash
curl -X POST https://reelmirror.com/api/v1/generate/voice-convert \
  -H "Authorization: Bearer rm_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"generated_media_item_id": "ITEM_ID"}'
```

The persona must have a voice sample uploaded. Voice conversion is billed per second of video duration (~$0.005/sec).

## Making Content Public

Toggle a generated media item's public visibility:

```bash
curl -X POST https://reelmirror.com/api/v1/generate/toggle-public \
  -H "Authorization: Bearer rm_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"generated_media_item_id": "ITEM_ID", "is_public": true}'
```

> [!NOTE]
> Once a **discounted** item is made public, it cannot be made private again for 20 days.

## Deleting Generated Content

Delete a generated post (and all its media items):

```bash
curl -X DELETE https://reelmirror.com/api/v1/generated-posts/GENERATED_POST_ID \
  -H "Authorization: Bearer rm_YOUR_KEY"
```

Delete a single generated media item:

```bash
curl -X DELETE https://reelmirror.com/api/v1/generated-media-items/ITEM_ID \
  -H "Authorization: Bearer rm_YOUR_KEY"
```

Deletion is a soft-delete — billing and analytics data is preserved. After deleting a generated post, the source post can be re-cloned. R2 storage files are cleaned up asynchronously.

## Generation Statuses

| Status | Meaning |
|--------|---------|
| `pending` | Queued for processing |
| `generating` | Currently being generated |
| `completed` | Done — media URL available |
| `failed` | Generation failed |

## Discount Mode

Discount mode is a persona-level setting that enables faster, cheaper (but lower quality) generation for all content created with that persona. To enable it, update the persona:

```bash
curl -X PATCH https://reelmirror.com/api/v1/personas/PERSONA_ID \
  -H "Authorization: Bearer rm_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"discount_mode": true}'
```

Once enabled, all subsequent generation requests for that persona automatically use discounted pricing (20% off). See the [Billing guide](/docs/guides/billing) for pricing details.
