---
title: "Generate Media Asset"
method: POST
path: "/media/generate"
tags: ["Media"]
---

# Generate Media Asset

`POST /media/generate`

Starts an AI media generation job billed from the account's balance. Generation is asynchronous — poll `GET /media/{id}` until the asset is `ready`, then use `file.id` anywhere attachments are accepted.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `account_id` string — Account ID, prefixed `biz_`. Defaults to the account the API key belongs to.
  - `duration_seconds` 5 | 10 | 15 — Video length in seconds. Video only; defaults to 5.
  - `prompt` string, required — What to generate. Up to 2,000 characters.
  - `reference_media` string[] — Optional reference image file IDs (`file_` prefixed), up to 4. For video, a single reference seeds the opening frame; multiple references guide subject and style instead.
  - `resolution` '480p' | '720p' | '1080p' | '4k' — Video resolution. Video only; defaults to `1080p`. `1080p` is not supported by Seedance 2.0 Fast or Mini; `4k` is only supported by Seedance 2.0.
  - `type` 'video' | 'image', required — The kind of media to generate.

## Response `201`

Generation started.

- MediaAsset
  - `amount_charged` number, nullable, required — USD amount charged to the account's balance for this generation. `null` if the generation wasn't billed.
  - `completed_at` string, nullable, required — ISO 8601 timestamp when the asset reached a terminal state. `null` while `processing`.
  - `created_at` string, required — ISO 8601 timestamp when the generation was requested.
  - `currency` string, required — Currency of `amount_charged`. Always `usd`.
  - `error_message` string, nullable, required — Why generation failed. `null` unless status is `failed`.
  - `file` MediaAssetFile, required
    - `id` string, required — File ID, prefixed `file_`.
    - `url` string, required — CDN URL for downloading the file.
  - `generation` MediaAssetGeneration, required
    - `duration_seconds` number, nullable, required — Requested video length in seconds. `null` for images.
    - `prompt` string, required — What the asset was generated from.
    - `reference_media` string[], required
    - `resolution` '480p' | '720p' | '1080p' | '4k' | 'null', nullable, required — Requested video resolution. `null` for images. `1080p` is not supported by Seedance 2.0 Fast or Mini; `4k` is only supported by Seedance 2.0.
  - `id` string, required — Media asset ID, prefixed `media_`.
  - `media_type` 'video' | 'image', required — The kind of media this asset holds.
  - `source` 'generated', required — How the asset was created. Always `generated`.
  - `status` 'processing' | 'ready' | 'failed', required — Lifecycle state: `processing` while generation runs, `ready` when the file is available, `failed` when generation failed and the charge was refunded.

## Other responses

- `400` — Invalid generation parameters.
- `401` — Unauthorized
- `402` — Insufficient balance.
- `403` — Forbidden

---

[API](https://skmtc.net/whop/apis/whop-api.md) · [All operations](https://skmtc.net/whop/apis/whop-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/whop/whop-api/versions/db0883548bc5/schema)
