To automate image-to-video in n8n, submit a supported image and prompt to the generation API, save the returned project ID, wait for the job to finish, then retrieve the output URL. Poll the existing job instead of submitting another generation when a status request fails. Use Magic Hour’s current API documentation for request fields and the selected model’s limits.
Connecting Magic Hour AI with n8n
Welcome! In this post, we’ll show you how to integrate Magic Hour AI with n8n to automate image to video. Whether you're a seasoned automation expert or just starting your journey with no-code tools and APIs, this guide is designed to help you seamlessly connect Magic Hour AI's powerful video generation capabilities with your n8n workflows.
What to Expect
This guide will walk you through the entire process, from setting up your Magic Hour AI account and obtaining your API key to building and testing various API requests within n8n and we attached a video at the end for your understanding, to guide you
How to Best Use This Guide
This document is structured to allow you to quickly find the information most relevant to your needs.
For a complete overview: Start from the beginning and follow the steps sequentially to understand the foundational setup and connection process.
Troubleshooting: Throughout the guide, you'll find important tips and common error messages to help you troubleshoot any issues you might encounter.
By the end of this guide, you'll be able to leverage the power of Magic Hour AI directly within your n8n workflows, automating creative tasks and bringing your ideas to life!
Some tips when connecting Magic Hour and n8n
Store the API key in an n8n HTTP Header Auth credential: header name Authorization, value Bearer followed by your key. Select that credential on the submit and status-request nodes. Keep real keys out of shared workflow JSON. See n8n HTTP Request authentication.
Before you dive into using any Magic Hour API to create videos or images, you'll want to check out their documentation (docs.magichour.ai). It'll tell you all the fields you need to fill in. For example, if you're using the Image Background Remover API, you'll first need to figure out what parameters it requires.
Just to give you an idea, the image_file_path field would be a must-have. If you don't provide that, you'll end up with a server error.
{"message": "Missing Request Body"}
Create an Account on Magic Hour AI and Obtain API Key
Go to n8n , add a HTTP Request and import the curL you copied from doc.
Prepare your workflow in n8n
Open n8n and start a new workflow.
Choose a trigger (something that starts the workflow, e.g., manual or scheduled trigger), I am choosing manual.
Add the API request
In the workflow, add a new node from Core → HTTP Request (or cURL request).
Paste the cURL code you copied earlier into the import curl box.
Remove any imported example Authorization header and select your saved Header Auth credential. Keep only one Authorization header on the request.
Add Wait Nodeafter POST request
Use a Wait node between status checks, then loop back to GET the same project. A fixed delay does not establish that generation is complete. Set an overall timeout appropriate to your workflow.
Check the chosen endpoint’s documented formats and input fields. For uploaded media, use the asset-upload workflow and returned file_path; a third-party URL or file extension alone does not establish that the input is accepted.
Use a Wait node between status checks, then loop back to GET the same project. A fixed delay does not establish that generation is complete. Set an overall timeout appropriate to your workflow.
Now , go to n8n node panel and add GET request from HTTP Request ( after wait )
Select the same saved Header Auth credential on this GET request. Use the project ID returned by the original POST; keep it available across the polling loop.
Run the status request and inspect status before reading downloads. Continue polling queued or rendering jobs; stop and inspect error or canceled jobs.
Only when status is complete and downloads contains an item, pass {{ $json.downloads[0].url }} to a separate GET node configured to return a file. Do not send your Magic Hour Authorization header to the download URL.
And now you can see your generated Video
Basic Workflow
Video For Reference
Handle completion, failure and expiring downloads
Get video details returns the project status. Keep polling the existing ID while it is queued or rendering. Download only after complete; route error or canceled to a failure branch. A temporary status-request failure is not a reason to submit another paid generation.
Save the downloaded file to your destination storage. Output URLs expire: if a completed job's link has expired, fetch its details again for a fresh download link. Keep the project ID with the workflow record so you can recover the output without generating it again.
The earlier screenshots and reference video below illustrate the workflow's original interface. Follow the current authentication and status-handling instructions above when building a new automation.
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.