Skip to content

Guides

Content Generation

How AI content generation works

Beta

Overview#

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#

Code
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:

Terminal
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:

Terminal
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:

Terminal
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:

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

Then generate from it:

Terminal
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#

Terminal
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:

Terminal
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:

Terminal
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:

Terminal
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:

Terminal
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:

Terminal
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:

Terminal
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}'

Deleting Generated Content#

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

Terminal
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:

Terminal
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#

StatusMeaning
pendingQueued for processing
generatingCurrently being generated
completedDone — media URL available
failedGeneration 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:

Terminal
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 for pricing details.