Automate Dynamic Illustration & Video Creation with n8n and PiAPI

Struggling to create engaging motion illustrations quickly? This n8n workflow leverages Midjourney and Kling APIs to generate stunning images and videos automatically, saving content creators hours of manual effort and boosting creative output efficiently.
httpRequest
manualTrigger
code
+3
Workflow Identifier: 2183
NODES in Use: Manual Trigger, HTTP Request, Code, If, Wait, Sticky Note
Automate illustrations with n8n and Midjourney

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow helps create moving videos from text prompts automatically inside n8n.
It fixes the problem of making pictures and videos by hand, which takes too much time and mistakes happen easily.
When you run this, you get a ready video made from an AI picture without doing many steps yourself.


Tools and services used

  • n8n: Automates the workflow steps and manages data flow.
  • PiAPI: Provides API access to Midjourney and Kling video generation.
  • Midjourney API: Creates AI-generated images from text.
  • Kling API: Builds videos based on images and prompts.

Inputs, processing steps, and outputs

Inputs

  • Text prompt that describes the desired image and video scenes.
  • API key for PiAPI access.

Processing Steps

  • Send a POST request to Midjourney with the prompt to start image generation.
  • Check the image generation status repeatedly using an If node and a Wait node until it is done.
  • Extract a random temporary image URL from the AI results.
  • Send this image URL with a video prompt to Kling’s video generation API.
  • Wait and check Kling video generation status until the video is completed.
  • Extract final video URLs, including high quality and watermark-free versions.

Outputs

  • Direct URLs of completed AI motion videos for download or embedding.
  • Watermark-free video URLs for professional use.

Who should use this workflow

Anyone who wants to create AI-driven illustrations that move from simple text instead of doing slow manual steps.

Especially creators who want to save time and avoid syncing mistakes while keeping quality.


Beginner step-by-step: How to use this workflow in n8n production

Step 1: Import the workflow

  1. Download the workflow file using the “Download” button on this page.
  2. Inside the n8n editor, click on “Import from File” and select the downloaded workflow.

Step 2: Configure required settings

  1. Add your PiAPI API key into the HTTP Request node headers where “x-api-key” is required.
  2. Check any node that has IDs, emails, channel names, or folder links and update them if needed.
  3. If code or prompts are inside nodes, review and change prompt text to fit your project.

Step 3: Test and activate

  1. Run the Manual Trigger node by clicking “Test workflow” to ensure it starts and runs without errors.
  2. Watch the workflow execution to make sure images and videos generate as expected.
  3. Once testing works, activate the workflow by toggling the activation button at the top-right corner.

This setup runs on demand but can be linked to automated triggers.

For users running their own instance, consider self-host n8n for full control.


Detailed step-by-step workflow function

Input

The main input is a text description for the image and separate prompt for the video.

Step 1: Submit image generation request

Send a POST request to Midjourney’s API via PiAPI with the text prompt in JSON.

This creates an asynchronous task that starts generating AI images.

Step 2: Wait and check image status

Use an If node to test if the image generation status is “completed.”

If not done, the Wait node pauses the workflow for a set time before checking again.

Step 3: Get a random image URL

After images are ready, a Code node picks one temporary image URL from the list randomly.

Step 4: Start Kling video generation

Send this image URL with a video prompt to Kling’s API via HTTP POST.

The workflow again polls status using an If node and waits until the video is finished.

Step 5: Extract final video links

A Code node grabs the video URL and watermark-free URL from the response.

This final output can be used in social media or websites.


Common issues and troubleshooting

  • 401 Unauthorized error: Check the “x-api-key” header in all HTTP requests. Make sure it is correct and active.
  • Workflow stuck waiting: Confirm the If node checks the right JSON path for data.status. Wrong path causes endless wait.
  • Random image URL undefined: Verify the initial Midjourney response contains images. Connection errors or empty outputs cause this.

Customization ideas

  • Change prompt text inside the Basic Prompt node to make different images.
  • Adjust video prompt in the Kling Video Generator node for mood or scene changes.
  • Change wait times in Wait nodes to better fit internet speed or API delays.
  • Add Slack or Email nodes to automatically send video links when ready.
  • Use loops or multiple triggers to generate batches of videos automatically.

Summary

✓ Saves many manual steps by making AI images and videos automatically.
✓ Reduces wait time and syncing problems.
✓ Gives easy URLs for immediate use.
✓ Runs inside n8n with no extra software.
✓ Good for creators wanting fast multimedia outputs.


Automate illustrations with n8n and Midjourney

Visit through Desktop to Interact with the Workflow.

Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.
Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.

Frequently Asked Questions

A 401 error happens when the API Key “x-api-key” in HTTP request headers is missing or incorrect.
This means the status check in the uses the wrong JSON path and cannot detect completion, causing infinite wait.
Ensure Midjourney generated images successfully and the input of the Get Image node is connected to the right output.
Yes, by editing the model parameter in HTTP requests, other PiAPI-supported AI models can replace Midjourney.

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.