Image-to-video in n8n: reliable Magic Hour API workflow

Runbo Li
Runbo Li
·
· 4 min read
Magic Hour AI x N8n

An n8n Image-to-Video workflow needs five steps: upload an image, submit one Magic Hour job, store the returned video-project ID, poll that same ID, and download only after status is complete. Put the API key in an n8n credential. A failed status request should retry the GET request; it must never loop back and submit a second paid generation.

Test one Image-to-Video API job

Create an API key, upload one rights-cleared image through the documented signed-URL flow, and submit one short job. Save its project ID before adding waits, webhooks or downstream publishing.

Open Image-to-Video API Docs
  • Trigger: manual, schedule, form, webhook or an upstream image event.

  • Upload: request a signed Magic Hour upload URL, PUT the image bytes, and retain the returned file_path.

  • Submit: POST one /v1/image-to-video request with that path, a prompt and settings supported by the selected model.

  • Wait and poll: GET /v1/video-projects/{id} until a terminal state.

  • Download and store: fetch the completed output without forwarding API authorization to its signed URL.

1. Store the Magic Hour API credential

Magic Hour's API quickstart uses bearer authentication. In n8n, create one HTTP Header Auth credential with header name Authorization and value Bearer followed by your API key. Select that credential only on Magic Hour API requests.

n8n's HTTP Request documentation covers credentials, cURL import and file responses. If you import a cURL example, remove its placeholder authorization header and attach the saved credential so only one value is sent.

2. Upload the image bytes

Magic Hour's input and output guide requires three actions: request an asset upload URL, PUT the binary file to that signed URL, then use the returned file_path in the generation request. A local path from the n8n host is not a Magic Hour asset path.

  • Request the correct file type and extension. Preserve the real MIME type and extension from the upstream binary.

  • PUT the file bytes to upload_url. Do not attach the Magic Hour bearer credential to the signed storage request.

  • Save file_path. Requesting an upload URL alone does not upload the image.

3. Submit exactly one Image-to-Video job

Open the current Image-to-Video API reference and import the cURL request into a new HTTP Request node. Use POST https://api.magichour.ai/v1/image-to-video, JSON content type and the saved credential.

Pass assets.image_file_path from the upload step. Choose end_seconds, model, resolution, audio and any optional ending image according to the current schema. Supported durations and fields vary by model; do not copy settings from another model and assume they apply.

Save the response id immediately. Keep the estimated credits_charged value for display or logging, then reconcile the final value after completion.

4. Poll the video project safely

After a Wait node, call Get Video Details with GET https://api.magichour.ai/v1/video-projects/{id}. Insert the saved submit response ID and use the same Magic Hour credential.

  • draft: inspect the submit path; rendering has not begun.

  • queued or rendering: wait, then poll the same ID.

  • complete: continue when the required download is present.

  • error: stop, store the error object and follow the documented failure behavior.

  • canceled: stop; do not automatically create a replacement job.

Use a bounded polling interval, backoff for temporary 429, 500 or network failures, and an overall workflow timeout. Keep submission outside the loop.

5. Download before the signed URL expires

When the project is complete, send downloads[0].url to a separate HTTP Request node configured to return a file. Do not select the Magic Hour API credential on the signed download request.

Store the binary in your own destination with the Magic Hour project ID and expires_at value. If the URL expires, fetch the same project details again instead of regenerating the video.

Polling, webhooks and recovery

Polling is easiest for a first workflow and detects canceled projects. For higher volume, use Magic Hour webhooks for started, completed and errored events, deduplicate by project ID, and retain a recovery poll for missed deliveries. Canceled projects do not emit a webhook in the current contract.

Production checklist

  • Rights: the image, prompt, voice and intended publication are authorized.

  • Input validation: file type, aspect ratio, size and selected model fields meet the live endpoint schema.

  • Idempotency: one internal request owns one Magic Hour project ID.

  • Quality: subject identity, geometry, text, motion, background, audio and duration pass review.

  • Cost: estimate is visible before submission and final credits are recorded after completion.

  • Privacy: retention is defined for source images, generated video, n8n execution data and downstream storage.

  • Observability: log internal job ID, provider project ID, state changes, elapsed time and terminal error.

Frequently asked questions

No. Upload the binary through Magic Hour's signed upload flow and pass the returned file_path. A path meaningful to the n8n host is not automatically readable by the API.

Use default to follow the account tier's current recommendation, or select an explicit model when its duration, resolution, audio and input contract match the job. Record the exact model because defaults and supported options can change.

Retry only GET /v1/video-projects/{id} with backoff. Never route a polling failure to POST /v1/image-to-video.

Use the browser Image-to-Video tool for a source-quality check or open the Magic Hour API for programmatic access. The text-to-video n8n guide and video face-swap n8n guide cover adjacent job types.

Runbo Li
Runbo Li
CEO of Magic Hour
Runbo Li is the Co-founder and CEO of Magic Hour, where he builds AI video and image tools for content creation. He is a Y Combinator W24 founder and former Data Scientist at Meta, where he worked on 0-1 consumer social products in New Product Experimentation. He writes about AI video generation, AI image creation, creative workflows, and creator tools.
View author →

Continue Reading

Magic Hour AI x N8n
Video face swap in n8n: reliable Magic Hour API workflow
Magic Hour AI x N8n
Text-to-video in n8n: Magic Hour API workflow
N8n
How to automate photo face swaps in n8n
 6 AI APIs to Build a SaaS in a Weekend
6 AI APIs for a weekend SaaS: architecture and launch checks
Extend a Video With AI for Free
How to extend a video with AI for free (no sign-up, step-by-step)
Magic Hour vs Runway vs Pika
Magic Hour vs Runway vs Pika API: 2026 Integration Guide