> ## Documentation Index
> Fetch the complete documentation index at: https://docs.magichour.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Video-to-Video API Reference - Magic Hour Docs

> **What this API does**

Create the same Video To Video you can make in the browser, but programmatically, so you can automate it, run it at scale, or connect it to your own app or workflow.
    
**Good for**
- Automation and batch processing  
- Adding video to video into apps, pipelines, or tools  

**How it works (3 steps)**
1) Upload your inputs (video, image, or audio) with [Generate Upload URLs](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls) and copy the `file_path`.  
2) Send a request to create a video to video job with the basic fields.  
3) Check the job status until it's `complete`, then download the result from `downloads`.

**Key options**
- Inputs: usually a file, sometimes a YouTube link, depending on project type  
- Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes  
- Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt  

**Cost**  
Credits are only charged for the frames that actually render. You'll see an estimate when the job is queued, and the final total after it's done.

For detailed examples, see the [product page](https://magichour.ai/products/video-to-video).



## OpenAPI

````yaml post /v1/video-to-video
openapi: 3.0.2
info:
  title: Magic Hour API
  version: beta
  description: >

    Magic Hour provides an API (beta) that can be integrated into your own
    application to generate videos and images using AI. 


    Webhook documentation can be found
    [here](https://magichour.ai/docs/webhook).


    If you have any questions, please reach out to us via
    [discord](https://discord.gg/JX5rgsZaJp).


    # Authentication


    Every request requires an API key.


    To get started, first generate your API key
    [here](https://magichour.ai/settings/developer).


    Then, add the `Authorization` header to the request.


    | Key | Value |

    |-|-|

    | Authorization | Bearer mhk_live_apikey |


    > **Warning**: any API call that renders a video will utilize credits in
    your account.
  termsOfService: https://magichour.ai/terms-of-service
servers:
  - url: https://api.magichour.ai
security: []
tags:
  - name: Files
    description: API related to uploading assets used for video generation
  - name: Image Projects
    description: API related to image projects
  - name: Video Projects
    description: API related to video projects
  - name: Audio Projects
    description: API related to audio projects
paths:
  /v1/video-to-video:
    post:
      tags:
        - Video Projects
      summary: Video-to-Video
      description: >-
        **What this API does**


        Create the same Video To Video you can make in the browser, but
        programmatically, so you can automate it, run it at scale, or connect it
        to your own app or workflow.
            
        **Good for**

        - Automation and batch processing  

        - Adding video to video into apps, pipelines, or tools  


        **How it works (3 steps)**

        1) Upload your inputs (video, image, or audio) with [Generate Upload
        URLs](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls)
        and copy the `file_path`.  

        2) Send a request to create a video to video job with the basic
        fields.  

        3) Check the job status until it's `complete`, then download the result
        from `downloads`.


        **Key options**

        - Inputs: usually a file, sometimes a YouTube link, depending on project
        type  

        - Resolution: free users are limited to 576px; higher plans unlock HD
        and larger sizes  

        - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or
        a text prompt  


        **Cost**  

        Credits are only charged for the frames that actually render. You'll see
        an estimate when the job is queued, and the final total after it's done.


        For detailed examples, see the [product
        page](https://magichour.ai/products/video-to-video).
      operationId: videoToVideo.createVideo
      parameters: []
      requestBody:
        required: true
        description: Body
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Give your video a custom name for easy identification.
                  example: My Video To Video video
                  default: Video To Video - dateTime
                start_seconds:
                  type: number
                  minimum: 0
                  description: Start time of your clip (seconds). Must be ≥ 0.
                  format: float
                  example: 0
                end_seconds:
                  type: number
                  minimum: 0.1
                  description: >-
                    End time of your clip (seconds). Must be greater than
                    start_seconds.
                  format: float
                  example: 15
                fps_resolution:
                  default: HALF
                  type: string
                  enum:
                    - FULL
                    - HALF
                  description: >-
                    Determines whether the resulting video will have the same
                    frame per second as the original video, or half.

                    * `FULL` - the result video will have the same FPS as the
                    input video

                    * `HALF` - the result video will have half the FPS as the
                    input video
                  example: HALF
                style:
                  type: object
                  properties:
                    art_style:
                      type: string
                      enum:
                        - Minecraft
                        - Watercolor
                        - Pixel
                        - Retro Sci-Fi
                        - Lego
                        - Origami
                        - Ghost
                        - Sub-Zero
                        - Studio Ghibli
                        - Comic
                        - Impressionism
                        - Master Chief
                        - Solid Snake
                        - Street Fighter
                        - Hologram
                        - GTA
                        - Clay
                        - Mystique
                        - Dragonball Z
                        - Mario
                        - Samurai
                        - Spartan
                        - Boba Fett
                        - 3D Render
                        - Airbender
                        - Android
                        - Anime Warrior
                        - Armored Knight
                        - Assassin's Creed
                        - Avatar
                        - Black Spiderman
                        - Bold Anime
                        - Celestial Skin
                        - Chinese Swordsmen
                        - Cyberpunk
                        - Cypher
                        - Dark Fantasy
                        - Future Bot
                        - Futuristic Fantasy
                        - Ghibli Anime
                        - Gundam
                        - Illustration
                        - Ink
                        - Ink Poster
                        - Jinx
                        - Knight
                        - Link
                        - Marble
                        - Mech
                        - Naruto
                        - Neon Dream
                        - No Art Style
                        - Oil Painting
                        - On Fire
                        - Painterly Anime
                        - Pixar
                        - Power Armor
                        - Power Ranger
                        - Radiant Anime
                        - Realistic Anime
                        - Realistic Pixar
                        - Retro Anime
                        - Samurai Bot
                        - Sharp Anime
                        - Soft Anime
                        - Starfield
                        - The Void
                        - Tomb Raider
                        - Underwater
                        - Van Gogh
                        - Viking
                        - Western Anime
                        - Wu Kong
                        - Wuxia Anime
                        - Zelda
                    version:
                      default: default
                      type: string
                      enum:
                        - v1
                        - v2
                        - default
                      example: default
                      description: >-
                        * `v1` - more detail, closer prompt adherence, and
                        frame-by-frame previews.

                        * `v2` - faster, more consistent, and less noisy.

                        * `default` - use the default version for the selected
                        art style.
                    prompt_type:
                      default: default
                      type: string
                      enum:
                        - default
                        - custom
                        - append_default
                      example: default
                      description: >-
                        * `default` - Use the default recommended prompt for the
                        art style.

                        * `custom` - Only use the prompt passed in the API.
                        Note: for v1, lora prompt will still be auto added to
                        apply the art style properly.

                        * `append_default` - Add the default recommended prompt
                        to the end of the prompt passed in the API.
                    prompt:
                      type: string
                      nullable: true
                      description: >-
                        The prompt used for the video. Prompt is required if
                        `prompt_type` is `custom` or `append_default`. If
                        `prompt_type` is `default`, then the `prompt` value
                        passed will be ignored.
                    model:
                      default: default
                      type: string
                      enum:
                        - Dreamshaper
                        - Absolute Reality
                        - Flat 2D Anime
                        - Soft Anime
                        - Kaywaii
                        - Western Anime
                        - 3D Anime
                        - default
                      example: default
                      description: >-
                        * `Dreamshaper` - a good all-around model that works for
                        both animations as well as realism.

                        * `Absolute Reality` - better at realism, but you'll
                        often get similar results with Dreamshaper as well.

                        * `Flat 2D Anime` - best for a flat illustration style
                        that's common in most anime.

                        * `default` - use the default recommended model for the
                        selected art style.
                  required:
                    - art_style
                assets:
                  type: object
                  properties:
                    video_source:
                      type: string
                      enum:
                        - file
                        - youtube
                      description: Choose your video source.
                      example: file
                    video_file_path:
                      type: string
                      description: >
                        Your video file. Required if `video_source` is `file`.
                        This value is either

                        - a direct URL to the video file

                        - `file_path` field from the response of the [upload
                        urls
                        API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).


                        See the [file upload
                        guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file)
                        for details.
                      example: api-assets/id/1234.mp4
                    youtube_url:
                      type: string
                      format: uri
                      description: YouTube URL (required if `video_source` is `youtube`).
                  required:
                    - video_source
                  description: >-
                    Provide the assets for video-to-video. For video, The
                    `video_source` field determines whether `video_file_path` or
                    `youtube_url` field is used
              required:
                - start_seconds
                - end_seconds
                - style
                - assets
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: cuid-example
                    description: >-
                      Unique ID of the video. Use it with the [Get video Project
                      API](https://docs.magichour.ai/api-reference/video-projects/get-video-details)
                      to fetch status and downloads.
                  credits_charged:
                    type: integer
                    description: >-
                      The amount of credits deducted from your account to
                      generate the video. If the status is not 'complete', this
                      value is an estimate and may be adjusted upon completion
                      based on the actual FPS of the output video. 


                      If video generation fails, credits will be refunded, and
                      this field will be updated to include the refund.
                    example: 450
                required:
                  - id
                  - estimated_frame_cost
                  - credits_charged
                description: Success
        '400':
          description: Invalid Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
                description: The request is invalid
                example:
                  message: Missing request body
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    enum:
                      - Unauthorized
                required:
                  - message
                description: The request is not properly authenticated
                example:
                  message: Unauthorized
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
                description: The request requires payment
                example:
                  message: Payment required
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    enum:
                      - Not Found
                required:
                  - message
                description: Requested resource is not found
                example:
                  message: Not Found
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Unable to create video
                required:
                  - message
                description: Unprocessable Entity
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: python
          source: |-
            from magic_hour import Client
            from os import getenv

            client = Client(token=getenv("API_TOKEN"))
            res = client.v1.video_to_video.generate(
                assets={"video_file_path": "/path/to/1234.mp4", "video_source": "file"},
                end_seconds=15.0,
                start_seconds=0.0,
                style={
                    "art_style": "3D Render",
                    "model": "default",
                    "prompt": "string",
                    "prompt_type": "default",
                    "version": "default",
                },
                fps_resolution="HALF",
                name="Video To Video video",
                wait_for_completion=True,
                download_outputs=True,
                download_directory="."
            )
        - lang: javascript
          source: |-
            import { Client } from "magic-hour";

            const client = new Client({ token: process.env["API_TOKEN"]!! });
            const res = await client.v1.videoToVideo.generate(
              {
                assets: { videoFilePath: "/path/to/1234.mp4", videoSource: "file" },
                endSeconds: 15.0,
                fpsResolution: "HALF",
                name: "Video To Video video",
                startSeconds: 0.0,
                style: {
                  artStyle: "3D Render",
                  model: "default",
                  prompt: "string",
                  promptType: "default",
                  version: "default",
                },
              },
              {
                waitForCompletion: true,
                downloadOutputs: true,
                downloadDirectory: ".",
              },
            );
        - lang: go
          source: "package main\n\nimport (\n\tos \"os\"\n\n\tsdk \"github.com/magichourhq/magic-hour-go/client\"\n\tnullable \"github.com/magichourhq/magic-hour-go/nullable\"\n\tvideo_to_video \"github.com/magichourhq/magic-hour-go/resources/v1/video_to_video\"\n\ttypes \"github.com/magichourhq/magic-hour-go/types\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\tsdk.WithBearerAuth(os.Getenv(\"API_TOKEN\")),\n\t)\n\tres, err := client.V1.VideoToVideo.Create(video_to_video.CreateRequest{\n\t\tAssets: types.V1VideoToVideoCreateBodyAssets{\n\t\t\tVideoFilePath: nullable.NewValue(\"api-assets/id/1234.mp4\"),\n\t\t\tVideoSource:   types.V1VideoToVideoCreateBodyAssetsVideoSourceEnumFile,\n\t\t},\n\t\tEndSeconds:    15.0,\n\t\tFpsResolution: nullable.NewValue(types.V1VideoToVideoCreateBodyFpsResolutionEnumHalf),\n\t\tName:          nullable.NewValue(\"My Video To Video video\"),\n\t\tStartSeconds:  0.0,\n\t\tStyle: types.V1VideoToVideoCreateBodyStyle{\n\t\t\tArtStyle:   types.V1VideoToVideoCreateBodyStyleArtStyleEnum3dRender,\n\t\t\tModel:      nullable.NewValue(types.V1VideoToVideoCreateBodyStyleModelEnumDefault),\n\t\t\tPromptType: nullable.NewValue(types.V1VideoToVideoCreateBodyStylePromptTypeEnumDefault),\n\t\t\tVersion:    nullable.NewValue(types.V1VideoToVideoCreateBodyStyleVersionEnumDefault),\n\t\t},\n\t})\n}"
        - lang: rust
          source: |-
            let client = magic_hour::Client::default()
                .with_bearer_auth(&std::env::var("API_TOKEN").unwrap());
            let res = client
                .v1()
                .video_to_video()
                .create(magic_hour::resources::v1::video_to_video::CreateRequest {
                    assets: magic_hour::models::V1VideoToVideoCreateBodyAssets {
                        video_file_path: Some("api-assets/id/1234.mp4".to_string()),
                        video_source: magic_hour::models::V1VideoToVideoCreateBodyAssetsVideoSourceEnum::File,
                        ..Default::default()
                    },
                    end_seconds: 15.0,
                    fps_resolution: Some(
                        magic_hour::models::V1VideoToVideoCreateBodyFpsResolutionEnum::Half,
                    ),
                    name: Some("My Video To Video video".to_string()),
                    start_seconds: 0.0,
                    style: magic_hour::models::V1VideoToVideoCreateBodyStyle {
                        art_style: magic_hour::models::V1VideoToVideoCreateBodyStyleArtStyleEnum::Enum3dRender,
                        model: Some(
                            magic_hour::models::V1VideoToVideoCreateBodyStyleModelEnum::Default,
                        ),
                        prompt_type: Some(
                            magic_hour::models::V1VideoToVideoCreateBodyStylePromptTypeEnum::Default,
                        ),
                        version: Some(
                            magic_hour::models::V1VideoToVideoCreateBodyStyleVersionEnum::Default,
                        ),
                        ..Default::default()
                    },
                    ..Default::default()
                })
                .await;
        - lang: curl
          source: |-
            curl --request POST \
                 --url https://api.magichour.ai/v1/video-to-video \
                 --header 'accept: application/json' \
                 --header 'authorization: Bearer <token>' \
                 --header 'content-type: application/json' \
                 --data '
            {
              "name": "My Video To Video video",
              "start_seconds": 0,
              "end_seconds": 15,
              "fps_resolution": "HALF",
              "style": {
                "art_style": "Minecraft",
                "version": "default",
                "prompt_type": "default",
                "prompt": "string",
                "model": "default"
              },
              "assets": {
                "video_source": "file",
                "video_file_path": "api-assets/id/1234.mp4",
                "youtube_url": "string"
              }
            }
            '
        - lang: php
          source: |-
            <?php

            $curl = curl_init();

            curl_setopt_array($curl, [
              CURLOPT_URL => "https://api.magichour.ai/v1/video-to-video",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_ENCODING => "",
              CURLOPT_MAXREDIRS => 10,
              CURLOPT_TIMEOUT => 30,
              CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
              CURLOPT_CUSTOMREQUEST => "POST",
              CURLOPT_POSTFIELDS => json_encode([
                'name' => 'My Video To Video video',
                'start_seconds' => 0,
                'end_seconds' => 15,
                'fps_resolution' => 'HALF',
                'style' => [
                    'art_style' => 'Minecraft',
                    'version' => 'default',
                    'prompt_type' => 'default',
                    'prompt' => 'string',
                    'model' => 'default'
                ],
                'assets' => [
                    'video_source' => 'file',
                    'video_file_path' => 'api-assets/id/1234.mp4',
                    'youtube_url' => 'string'
                ]
              ]),
              CURLOPT_HTTPHEADER => [
                "accept: application/json",
                "authorization: Bearer <token>",
                "content-type: application/json"
              ],
            ]);

            $response = curl_exec($curl);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
        - lang: java
          source: >-
            HttpResponse<String> response =
            Unirest.post("https://api.magichour.ai/v1/video-to-video")
              .header("accept", "application/json")
              .header("content-type", "application/json")
              .header("authorization", "Bearer <token>")
              .body("{\"name\":\"My Video To Video video\",\"start_seconds\":0,\"end_seconds\":15,\"fps_resolution\":\"HALF\",\"style\":{\"art_style\":\"Minecraft\",\"version\":\"default\",\"prompt_type\":\"default\",\"prompt\":\"string\",\"model\":\"default\"},\"assets\":{\"video_source\":\"file\",\"video_file_path\":\"api-assets/id/1234.mp4\",\"youtube_url\":\"string\"}}")
              .asString();
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <api_key>`, where
        `<api_key>` is your API key. To get your API key, go to [Developer
        Hub](https://magichour.ai/developer?tab=api-keys) and click "Create new
        API Key".

````