Magic Hour
  • Pricing
Video

Start your first video in under 60 seconds

Generate or edit video, image, and audio - free to start.
Start Creating Free
No credit card requiredFree daily creditsNo signup required
Join the Discord
Video
Company
PricingAboutBlogAPIAll ToolsTemplatesAI ModelsPrivacy PolicyTerms of ServiceRefund Policy
Video Products
AI Avatar GeneratorAI UGC Ad GeneratorAI Video DubbingAI Video EditorAI Video ExpanderAI Video ExtenderAI Video TranslatorAI Video UpscalerAnimationAudio-to-VideoCharacter ReplaceColor GraderFace Swap VideoImage-to-VideoLip SyncMusic Video GeneratorSubtitle GeneratorTalking PhotoText-to-VideoVideo ColorizerVideo-to-Video
Image Products
AI Clothes ChangerAI Face EditorAI GIF GeneratorAI Headshot GeneratorAI Image EditorAI Image ExpanderAI Image GeneratorAI Image UpscalerAI Influencer GeneratorAI Meme GeneratorAI Selfie GeneratorAI Storyboard GeneratorBackground RemoverBody SwapFace Swap PhotoHead SwapPhoto ColorizerQR Code GeneratorCharactersMoodboards
Audio Products
AI Audio TranslatorAI Music GeneratorVideo-to-AudioVoice ChangerVoice ClonerVoice Generator
Support
CommunityFAQHelp CenterContact UsStatus
Social
Instagram
X
TikTok
Facebook
YouTube
LinkedIn
support@magichour.ai
Backed byCombinator

© 2026 Magic Hour AI, Inc.

Back to Blog
  1. Blog
  2. Guides

Text-to-video in n8n: Magic Hour API workflow

Runbo Li
Runbo Li
·
CEO of Magic Hour
·
Sep 07, 2025· 5 min read
AI Summary:
ChatGPTClaudeGeminiPerplexity
Magic Hour AI x N8n

Contents

Create with Magic Hour
Make videos and images with AI.

To automate text-to-video in n8n, send one POST request to Magic Hour, save the returned video-project ID, and poll that same project until its status is complete. Download the first output URL only after completion. A delayed status response is not a reason to submit another paid generation.

This workflow was checked against the current Magic Hour and n8n documentation on September 13, 2026. Model names, supported durations, aspect ratios, resolution and credit estimates can change, so copy the current schema before deploying a workflow.

Build one text-to-video API job

Copy the current request schema, create one short job, preserve its project ID, and prove the complete polling and download path before scaling the workflow.

Open Text-to-Video API Docs
Quick Answer

The n8n workflow at a glance

  1. Trigger and validate. Require a non-empty prompt and any job-specific settings.

  2. Submit once. POST one text-to-video request and capture the returned id.

  3. Preserve the project ID. Keep it with the workflow execution before any wait or retry.

  4. Wait, then poll. GET the same video project until it reaches a terminal status.

  5. Route the result. Download complete jobs; stop and report error or canceled jobs.

  6. Store the file and metadata. Persist the video, project ID, prompt, settings, final status and credits charged.

1. Create the Magic Hour credential in n8n

Open the Magic Hour API page to run a sample and create an API key in the Developer Hub. In n8n, create a generic Header Auth credential with the header name Authorization and the value Bearer followed by the API key. Select the same saved credential on both Magic Hour HTTP Request nodes. Do not paste the real key into a shared workflow export.

n8n’s HTTP Request documentation supports generic Header Auth and importing cURL. Importing the Magic Hour example is a useful starting point, but n8n imports parameter values as strings. Switch the body to JSON and keep numbers and booleans as their actual types.

2. Validate the trigger data

Use a Manual Trigger while building. Before the POST node, add an If or Edit Fields node that requires a non-empty prompt. Set explicit defaults for duration, aspect ratio, resolution, model and audio instead of accepting arbitrary incoming values.

Validate those settings against the selected model. The current Text-to-Video API reference lists different supported durations, aspect ratios and resolutions by model. An allowed value for one model can be rejected by another.

3. Submit one text-to-video job

Add an HTTP Request node named Submit Text-to-Video with method POST and URL https://api.magichour.ai/v1/text-to-video. Select the saved Header Auth credential, send Content-Type application/json, choose a JSON body, and start with a short request:

unknown node

The example uses a current documented model and a five-second landscape output. Replace the prompt with your trigger field and choose model-specific values from the live reference. The successful POST response includes id and credits_charged. Treat the initial credit value as an estimate until the project completes.

4. Save the project ID before waiting

Immediately after the POST, add an Edit Fields node named Keep Project ID. Store the response id as project_id and retain any business key needed to connect the finished video to the source record. If the workflow stops later, resume from project_id rather than submitting a new job.

This is the main duplicate-charge guard. Disable automatic retries on the POST unless your surrounding system can prove that no project was created. A network timeout after submission is ambiguous: check your stored state and Magic Hour projects before sending another POST.

5. Wait and poll the same video project

Add an n8n Wait node after Keep Project ID, then add a second HTTP Request node with method GET:

unknown node

Select the same Magic Hour credential. The Get Video Details endpoint returns draft, queued, rendering, complete, error or canceled. Route them explicitly:

  • queued or rendering: wait again, then GET the same project ID.

  • complete: continue only when downloads contains an output.

  • error: stop, record the error object and do not resubmit automatically.

  • canceled: stop and record that the job was canceled.

  • draft or an unknown value: send the execution to manual review.

Keep a poll counter or elapsed-time deadline and stop cleanly when it is exceeded. Processing time depends on the model, duration and queue; consult the current processing-time guidance instead of assuming one fixed delay proves completion.

6. Download and store the completed video

For a complete job, read downloads[0].url. Use a separate HTTP Request node configured to download a file. Do not attach the Magic Hour API Authorization header to the output URL; it is a separate signed download location.

The project response includes expires_at for each download. Save the file promptly to your own storage, then persist the project ID, final status, prompt, model, duration, aspect ratio, resolution, credits charged and destination URL or object key.

Failure and retry rules

  • 401 unauthorized: verify the saved Header Auth credential and the Bearer prefix.

  • 402 insufficient credits: stop before polling and route the execution for account action.

  • 400 or 422 request error: compare every field with the current selected-model schema.

  • 429 or temporary 5xx while polling: wait and retry the GET request within a bounded policy.

  • timeout after POST: treat the result as ambiguous; do not assume the job was never created.

  • error or canceled project: record the terminal state and require an intentional new submission.

Production checklist

  • Keep the API key only in an n8n credential.

  • Validate model, duration, aspect ratio, resolution and audio before the POST.

  • Store the project ID immediately after submission.

  • Bound the polling interval, attempt count and total elapsed time.

  • Never turn a delayed GET into an automatic second POST.

  • Download completed outputs before the signed URL expires.

  • Keep the source prompt and settings beside the output for audit and reruns.

  • Review the complete video before any automated publication step.

For broader API selection, input types and cost comparison, use the multimodal video API guide. If a workflow later needs uploaded image, video or audio inputs, follow Magic Hour’s input and output workflow and use the returned file_path rather than assuming an arbitrary public URL is accepted.

Frequently asked questions

No. The generic HTTP Request, Edit Fields, Wait and If nodes are enough to submit, track and download a Magic Hour video project.

Submit once, persist the returned project ID, and retry only the GET status request. A timeout or temporary polling failure does not establish that the original POST failed.

Only complete means the render succeeded and downloads should contain the output. queued and rendering are non-terminal; error and canceled are terminal failure paths.

Polling is the simplest n8n workflow. Magic Hour also documents video.started, video.completed and video.errored events. Even with webhooks, reconcile stored project IDs because a canceled job does not emit a cancellation webhook.

Text-to-video starts from a prompt. For image-led or audio-led generation, use the corresponding API and its current schema. Upload required assets through the documented upload flow and pass the returned file_path.

Runbo Li
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.
See all articles

Continue Reading

Editorial face-swap business workflow with source video, approved campaign frame, human review, and performance chart
Recommended next
Face Swap
Face swap video for business: use cases, safeguards and ROI

Evaluate consented face-swap video use cases with an eight-step pilot, rights and disclosure controls, quality checks, and cost-per-approved-asset metrics.

Jan 20, 2025
AI-generated sports highlight image of two basketball players using Magic Hour.
Guides
How to make a sports highlight reel: recruiting & social
Sep 18, 2025
Prompting AI Videos Cover
Videos
How to prompt AI videos: a practical 10-step guide
May 21, 2024
video editing software
Videos
Best free video editing software: 8 editors and export limits
Feb 05, 2025
Me and David Working
Content Creation
How we got our first 100 paid users (with no marketing budget)
Jan 14, 2025