API Documentation (1.0)

Download OpenAPI specification:Download

Miraflow provides a suite of APIs for managing your avatars, video and media as well as generating new videos.

These endpoints require authorization. Include your API key in the request by replacing API_KEY:

curl -H "x-api-key: API_KEY" https://miraflow.ai/api/avatars

Media Upload

Upload images and files for use with other API endpoints.

Direct Upload Workflow:

  1. Call /api/media/initialize with file metadata
  2. Upload the file directly to the returned uploadUrl (S3 presigned URL)
  3. Call /api/media/finalize with the mediaId
  4. Use the mediaId in other API calls

Initialize media upload

Initializes a media upload and returns a presigned URL for direct upload to S3.

Workflow:

  1. Call this endpoint with file metadata (name, type, size)
  2. Upload the file directly to the returned uploadUrl using a PUT request
  3. Call /api/media/finalize with the mediaId to complete the upload

Example upload to S3:

curl -X PUT -H "Content-Type: image/png" --data-binary @image.png "$uploadUrl"
Authorizations:
ApiKeyAuth
Request Body schema: application/json
required
fileName
required
string

Name of the file

contentType
required
string

MIME type of the file

fileSize
required
integer

Size of the file in bytes

Responses

Response Schema: application/json
mediaId
string

ID to use for finalization and in other API calls

uploadUrl
string

Presigned URL for direct file upload

Request samples

Content type
application/json
{
  • "fileName": "my-image.png",
  • "contentType": "image/png",
  • "fileSize": 1024000
}

Response samples

Content type
application/json
{}

Finalize media upload

Finalizes a media upload after the file has been uploaded to S3. Call this after successfully uploading the file to the uploadUrl from /api/media/initialize.

Authorizations:
ApiKeyAuth
Request Body schema: application/json
required
mediaId
required
string

The media ID from the initialize response

Responses

Response Schema: application/json
success
boolean

Request samples

Content type
application/json
{
  • "mediaId": "cm42ab3ou0008aggajj0jy5e2"
}

Response samples

Content type
application/json
{
  • "success": true
}

Avatar Videos

Create talking avatar videos with AI voices

List avatars

Lists the available avatars. These include stock avatars as well as avatars created by the account associated with the supplied API key.

Authorizations:
ApiKeyAuth

Responses

Response Schema: application/json
any

Response samples

Content type
application/json
{
  • "avatars": [
    • {
      }
    ]
}

List voices

Lists the available voices. These include stock voices as well as voices created by the account associated with the supplied API key.

Authorizations:
ApiKeyAuth

Responses

Response Schema: application/json
any

Response samples

Content type
application/json
{
  • "avatars": [
    • {
      }
    ]
}

List videos

Lists the videos that have completed generation.

Authorizations:
ApiKeyAuth

Responses

Response Schema: application/json
any

Response samples

Content type
application/json
{
  • "videos": [
    • {
      }
    ]
}

Fetch video metadata

Fetches metadata for a single completed video.

Authorizations:
ApiKeyAuth
path Parameters
id
required
string

The ID of the desired video

Responses

Response Schema: application/json
id
string
name
string
sourceAvatarId
string
createdAt
string <date>
downloadUrl
string <url>

Response samples

Content type
application/json
{}

Download video

Downloads a single completed video.

Authorizations:
ApiKeyAuth
path Parameters
id
required
string

The ID of the desired video

Responses

Response Schema: video/mp4
string <binary>

Check video generation status

Checks the status of a video generation job. The status will be one of:

  • "inference_started": Job has been queued
  • "inference_working": Job is in progress
  • "inference_complete": Video generation is complete
  • "inference_failed": Job failed
  • "inference_error": Unknown error occurred

Note: The ID parameter should be the jobId that was returned from the video creation endpoint.

Authorizations:
ApiKeyAuth
path Parameters
id
required
string

The Job ID returned from the video creation endpoint

Responses

Response Schema: application/json
One of
result
string
Value: "success"
status
string
Enum: "inference_started" "inference_working" "inference_complete" "inference_failed" "inference_error"
progress
string

Progress percentage when status is inference_working

Response samples

Content type
application/json
Example
{
  • "result": "success",
  • "status": "inference_working",
  • "progress": "45%"
}

Create a new video

Starts a new video creation job. The specified avatar will be used, and either a speech can be created using a specified voice and script, or an uploaded audio track can be used.

Authorizations:
ApiKeyAuth
Request Body schema:
required
One of
avatarId
string
name
string
voiceId
string
text
string
im2vid_full
boolean

Responses

Response Schema: application/json
One of
result
string
Value: "success"
jobId
string

Request samples

Content type
Example
{
  • "avatarId": "cm2yaz9j10008l0qg9npyjgs3",
  • "name": "My new video",
  • "voiceId": "cm1lgilny0005m2lnvv3vgtgv",
  • "text": "This is the text of the script to be generated in the specified voice.",
  • "im2vid_full": true
}

Response samples

Content type
application/json
Example
{
  • "result": "success",
  • "jobId": "cm42ab3ou0008aggajj0jy5e2"
}

AI Images

Generate and edit images with AI

Create an image generation job

Starts a new text-to-image generation job. Provide a text prompt describing the image you want to generate.

This endpoint generates images from text descriptions without requiring any reference images.

Workflow:

  1. Call this endpoint to create a job. You'll receive a jobId in the response.
  2. Use the jobId with GET /api/image/{jobId} to check the job status.
  3. Poll the status endpoint until the job is complete (status: "inference_complete").
  4. When complete, the response will include a downloadUrl field containing the image URL.
Authorizations:
ApiKeyAuth
Request Body schema:
required
prompt
required
string

Text description of the image to generate

name
required
string

Name for the image generation job

aspectRatio
string
Enum: "1:1" "16:9" "9:16" "4:3" "3:4"

Aspect ratio for the output image

negativePrompt
string

Optional negative prompt to exclude certain elements

seed
integer

Optional seed for reproducible results

Responses

Response Schema: application/json
One of
result
string
Value: "success"
jobId
string

Request samples

Content type
{
  • "prompt": "A photorealistic portrait of an adult person with natural lighting",
  • "name": "My generated image",
  • "aspectRatio": "1:1",
  • "negativePrompt": "blurry, low quality, distorted",
  • "seed": 12345
}

Response samples

Content type
application/json
Example
{
  • "result": "success",
  • "jobId": "cm42ab3ou0008aggajj0jy5e2"
}

Create an image editing job

Starts a new image-to-image editing job. Upload one or more reference images and provide a prompt describing how you want to edit them. The AI will transform the images based on your prompt.

You can either upload files directly (multipart/form-data) or provide media IDs of previously uploaded images (application/json). You can provide a single image or multiple images.

Workflow:

  1. Call this endpoint to create a job. You'll receive a jobId in the response.
  2. Use the jobId with GET /api/image/{jobId} to check the job status.
  3. Poll the status endpoint until the job is complete (status: "inference_complete").
  4. When complete, the response will include a downloadUrl field containing the image URL.
Authorizations:
ApiKeyAuth
Request Body schema:
required
One of
referenceImageMediaId
required
string

Media ID of the previously uploaded reference image

prompt
required
string

Description of how to edit the image

name
required
string

Name for the image editing job

aspectRatio
string
Enum: "1:1" "16:9" "9:16" "4:3" "3:4"

Aspect ratio for the output image

negativePrompt
string

Optional negative prompt to exclude certain elements

seed
integer

Optional seed for reproducible results

Responses

Response Schema: application/json
One of
result
string
Value: "success"
jobId
string

Request samples

Content type
Example
{
  • "referenceImageMediaId": "cm42ab3ou0008aggajj0jy5e1",
  • "prompt": "Turn this photo into a professional business headshot",
  • "name": "My image editing job",
  • "aspectRatio": "1:1",
  • "negativePrompt": "blurry, low quality",
  • "seed": 12345
}

Response samples

Content type
application/json
Example
{
  • "result": "success",
  • "jobId": "cm42ab3ou0008aggajj0jy5e2"
}

Create an inpainting job

Starts a new image inpainting job. Upload an original image and a mask image (black and white), then specify what you want to replace in the masked areas. The mask should have white areas indicating what to replace and black areas indicating what to keep.

You can either upload files directly (multipart/form-data) or provide media IDs of previously uploaded images (application/json).

To create a mask image, you can use the frontend interface at /create-ai-image:

  1. Upload your original image
  2. Switch to Inpaint mode
  3. Draw mask areas with the blue brush
  4. Click "Download Mask" to download the black/white mask image
  5. Use the downloaded mask image in your API request

Workflow:

  1. Call this endpoint to create a job. You'll receive a jobId in the response.
  2. Use the jobId with GET /api/image/{jobId} to check the job status.
  3. Poll the status endpoint until the job is complete (status: "inference_complete").
  4. When complete, the response will include a downloadUrl field containing the image URL.
Authorizations:
ApiKeyAuth
Request Body schema:
required
originalImageMediaId
required
string

Media ID of the previously uploaded original image

maskImageMediaId
required
string

Media ID of the previously uploaded mask image

prompt
required
string

Description of what to replace the masked areas with

name
required
string

Name for the inpainting job

aspectRatio
string
Enum: "1:1" "16:9" "9:16" "4:3" "3:4"

Aspect ratio for the output image

negativePrompt
string

Optional negative prompt to exclude certain elements

seed
integer

Optional seed for reproducible results

Responses

Response Schema: application/json
One of
result
string
Value: "success"
jobId
string

Request samples

Content type
{
  • "originalImageMediaId": "cm42ab3ou0008aggajj0jy5e1",
  • "maskImageMediaId": "cm42ab3ou0008aggajj0jy5e2",
  • "prompt": "Change to blue",
  • "name": "My inpainting job",
  • "aspectRatio": "1:1",
  • "negativePrompt": "blurry, low quality",
  • "seed": 12345
}

Response samples

Content type
application/json
Example
{
  • "result": "success",
  • "jobId": "cm42ab3ou0008aggajj0jy5e2"
}

Get job status or result

Gets the status or result of any job. This is the general entry point for job status management.

When the job is in progress or failed, returns status information:

  • "inference_started": Job has been queued
  • "inference_working": Job is in progress (may include progress percentage)
  • "inference_failed": Job failed

When the job is completed:

  • For image jobs: Returns image metadata and download URL
  • For other job types: Returns completion status

Note: The jobId parameter should be the jobId that was returned from the job creation endpoint.

Authorizations:
ApiKeyAuth
path Parameters
jobId
required
string

The ID of the job

Responses

Response Schema: application/json
One of
id
string
name
string
prompt
string
createdAt
string <date-time>
downloadUrl
string <url>
mediaId
string

Response samples

Content type
application/json
Example
{}

AI Product Video Generator

Create product mockups and advertisement videos.

Workflow:

  1. Generate or upload product/logo assets
  2. Create mockups by compositing logos onto products
  3. Generate 8-second advertisement videos from mockups

Generate a product mockup

Generates a product mockup by compositing logos onto a product image.

Workflow:

  1. First upload your product and logo images using the media upload endpoints
  2. Call this endpoint with the media IDs and placement instructions
  3. The mockup is generated synchronously and returned with an image URL
Authorizations:
ApiKeyAuth
Request Body schema: application/json
required
productMediaId
required
string

Media ID of the product image

logoMediaIds
Array of strings

Array of media IDs for logo images to composite

Array of objects (LayerPlacement)

Placement data for each logo

instruction
required
string

Instructions for mockup generation

Responses

Response Schema: application/json
One of
result
string
Value: "success"
jobId
string
imageUrl
string
mediaId
string

Request samples

Content type
application/json
{
  • "productMediaId": "cm42ab3ou0008aggajj0jy5e1",
  • "logoMediaIds": [
    • "cm42ab3ou0008aggajj0jy5e2"
    ],
  • "layers": [
    • {
      }
    ],
  • "instruction": "Place the logo on the front of the t-shirt"
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "jobId": "cm42ab3ou0008aggajj0jy5e2",
  • "imageUrl": "/api/media/cm42ab3ou0008aggajj0jy5e3/view",
  • "mediaId": "cm42ab3ou0008aggajj0jy5e3"
}

Generate video from mockup

Creates an 8-second product advertisement video from a saved mockup.

Animation Styles:

  • luxury_macro: Luxury macro studio film
  • neo_noir_night: Neo-noir night street set
  • warm_lifestyle_sunset: Golden-hour lifestyle cinematic
  • futuristic_clean_studio: Ultra-clean futuristic studio
  • cyberpunk_showcase: Cyberpunk display pedestal
  • film_35mm_editorial: 35mm film editorial look
  • high_fashion_runway: High-fashion spotlight stage
  • nature_premium: Premium nature set
  • custom: Custom prompt only

Workflow:

  1. Call this endpoint with a mockup ID and animation style
  2. A job ID is returned immediately
  3. Poll /api/mockup/{jobId}/status to check progress
  4. When complete, get the video URL from /api/mockup/videos
Authorizations:
ApiKeyAuth
Request Body schema: application/json
required
mockupId
required
string

ID of the saved mockup

animationStyle
required
string
Enum: "luxury_macro" "neo_noir_night" "warm_lifestyle_sunset" "futuristic_clean_studio" "cyberpunk_showcase" "film_35mm_editorial" "high_fashion_runway" "nature_premium" "custom"

Animation style preset

userPrompt
string

Optional custom prompt (required if animationStyle is 'custom')

aspectRatio
string
Default: "9:16"
Enum: "16:9" "9:16"

Video aspect ratio

Responses

Response Schema: application/json
One of
result
string
Value: "success"
jobId
string

Request samples

Content type
application/json
{
  • "mockupId": "cm42ab3ou0008aggajj0jy5e1",
  • "animationStyle": "luxury_macro",
  • "userPrompt": "Focus on the logo details",
  • "aspectRatio": "16:9"
}

Response samples

Content type
application/json
{
  • "result": "failure",
  • "error": "string"
}

Generate logo or product asset

Generates a new logo or product image from a text prompt.

Workflow:

  1. Call this endpoint to start generation
  2. A job ID is returned immediately
  3. Poll /api/mockup/{jobId}/status to check progress
  4. When complete, retrieve the asset from /api/mockup/assets
Authorizations:
ApiKeyAuth
Request Body schema: application/json
required
prompt
required
string

Description of the asset to generate

type
required
string
Enum: "logo" "product"

Type of asset to generate

Responses

Response Schema: application/json
One of
result
string
Value: "success"
jobId
string

Request samples

Content type
application/json
{
  • "prompt": "minimalist tech company logo",
  • "type": "logo"
}

Response samples

Content type
application/json
{
  • "result": "failure",
  • "error": "string"
}

Edit existing asset

Edits an existing image using AI based on a text prompt.

You can provide the image in three ways:

  • imageMediaId: Media ID of a previously uploaded image
  • imageBase64: Base64-encoded image data
  • image: File upload (multipart/form-data)

Workflow:

  1. Call this endpoint to start editing
  2. A job ID is returned immediately
  3. Poll /api/mockup/{jobId}/status to check progress
  4. When complete, retrieve the asset from /api/mockup/assets
Authorizations:
ApiKeyAuth
Request Body schema:
required
imageMediaId
string

Media ID of the image to edit

imageBase64
string

Base64-encoded image data (alternative to imageMediaId)

prompt
required
string

Edit instructions

type
required
string
Enum: "logo" "product"

Type of asset

Responses

Response Schema: application/json
One of
result
string
Value: "success"
jobId
string

Request samples

Content type
{
  • "imageMediaId": "cm42ab3ou0008aggajj0jy5e1",
  • "imageBase64": "string",
  • "prompt": "Remove the background",
  • "type": "logo"
}

Response samples

Content type
application/json
{
  • "result": "failure",
  • "error": "string"
}

List saved mockups

Lists all saved product mockups for the authenticated user.

Authorizations:
ApiKeyAuth

Responses

Response Schema: application/json
result
string
Value: "success"
Array of objects (MockupItem)

Response samples

Content type
application/json
{
  • "result": "success",
  • "mockups": [
    • {
      }
    ]
}

List saved assets

Lists all saved logo and product assets for the authenticated user.

Authorizations:
ApiKeyAuth

Responses

Response Schema: application/json
result
string
Value: "success"
Array of objects (AssetItem)

Response samples

Content type
application/json
{
  • "result": "success",
  • "assets": [
    • {
      }
    ]
}

List mockup videos

Lists all generated product advertisement videos for the authenticated user.

Authorizations:
ApiKeyAuth

Responses

Response Schema: application/json
result
string
Value: "success"
Array of objects (MockupVideoItem)

Response samples

Content type
application/json
{
  • "result": "success",
  • "videos": [
    • {
      }
    ]
}

Check mockup job status

Checks the status of a mockup-related job (mockup generation, asset generation, or video generation).

Authorizations:
ApiKeyAuth
path Parameters
id
required
string

The job ID

Responses

Response Schema: application/json
result
string
Value: "success"
status
string
Enum: "waiting" "started" "completed" "failed"
progress
number
imageUrl
string

Available when status is completed

mediaId
string

Available when status is completed

reason
string

Error reason when status is failed

Response samples

Content type
application/json
{
  • "result": "success",
  • "status": "waiting",
  • "progress": 45,
  • "imageUrl": "string",
  • "mediaId": "string",
  • "reason": "string"
}

YouTube Thumbnail Maker

Generate eye-catching YouTube thumbnails with AI.

Basic Workflow (text prompt only):

  1. Call /api/thumbnail/generate with a prompt
  2. Poll /api/thumbnail/{jobId} until complete
  3. Download the generated thumbnail

With Reference Images (e.g., from YouTube video):

  1. Upload reference image using /api/media/initialize + /api/media/finalize
  2. Call /api/thumbnail/generate with referenceImageMediaIds
  3. Poll /api/thumbnail/{jobId} until complete

Using YouTube Video Thumbnail:

  1. Extract video ID from YouTube URL (e.g., v=abc123)
  2. Fetch thumbnail from https://img.youtube.com/vi/{videoId}/maxresdefault.jpg
  3. Upload as reference image using media endpoints
  4. Generate new thumbnail using the reference

Generate a YouTube thumbnail

Generates a YouTube thumbnail from a text prompt, optionally using reference images.

Basic Workflow:

  1. Call this endpoint with a text prompt
  2. A job ID is returned immediately
  3. Poll /api/thumbnail/{jobId} to check status
  4. When complete, the response includes the download URL

With Reference Images:

  1. Upload reference images using /api/media/initialize and /api/media/finalize
  2. Include the mediaId values in referenceImageMediaIds array
  3. The AI will use these images as style/content references

Using YouTube Video Thumbnails as Reference:

  1. Extract video ID from YouTube URL (e.g., watch?v=abc123abc123)
  2. Download thumbnail: https://img.youtube.com/vi/{videoId}/maxresdefault.jpg
  3. Upload via media endpoints to get a mediaId
  4. Pass mediaId in referenceImageMediaIds to generate a similar thumbnail
Authorizations:
ApiKeyAuth
Request Body schema: application/json
required
prompt
required
string

Description of the thumbnail to generate

name
required
string

Name for the thumbnail

aspectRatio
string
Default: "16:9"
Enum: "16:9" "9:16"

Aspect ratio (16:9 for standard, 9:16 for Shorts)

referenceImageMediaIds
Array of strings

Optional media IDs of reference images

negativePrompt
string

Elements to avoid

seed
integer

Seed for reproducible results

Responses

Response Schema: application/json
One of
result
string
Value: "success"
jobId
string

Request samples

Content type
application/json
{
  • "prompt": "Epic gaming moment with explosion and character in action pose",
  • "name": "Gaming Video Thumbnail",
  • "aspectRatio": "16:9",
  • "referenceImageMediaIds": [
    • "string"
    ],
  • "negativePrompt": "blurry, low quality",
  • "seed": 12345
}

Response samples

Content type
application/json
{
  • "result": "failure",
  • "error": "string"
}

List generated thumbnails

Lists all generated YouTube thumbnails for the authenticated user.

Authorizations:
ApiKeyAuth
query Parameters
page
integer
Default: 1

Page number for pagination

Responses

Response Schema: application/json
result
string
Value: "success"
Array of objects (ThumbnailItem)
page
integer
totalPages
integer
totalCount
integer

Response samples

Content type
application/json
{
  • "result": "success",
  • "thumbnails": [
    • {
      }
    ],
  • "page": 1,
  • "totalPages": 5,
  • "totalCount": 100
}

Get thumbnail status or details

Gets the status of a thumbnail generation job, or the thumbnail details if completed.

Authorizations:
ApiKeyAuth
path Parameters
id
required
string

The job ID

Responses

Response Schema: application/json
One of
result
string
Value: "success"
status
string
Enum: "waiting" "started"
progress
number

Response samples

Content type
application/json
Example
{
  • "result": "success",
  • "status": "started",
  • "progress": 45
}