Virtual Try-On 360° Video Generator with Kling API - n8n Workflow

Automate 360° virtual try-on video creation for clothing using the Kling API via this comprehensive n8n workflow. Learn how to set up this powerful n8n template for e-commerce media generation.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

E-commerce managers looking to scale product visualization.
Fashion brands needing realistic, high-fidelity virtual models.
Content creators and influencers leveraging AI for fashion media.
Automation specialists seeking advanced n8n templates for generative AI.

Overview

This specialized n8n workflow leverages generative AI technology, specifically the Kling model accessed through the PiAPI platform, to create dynamic 360° virtual try-on videos. Traditional media generation is slow and expensive; this n8n automation provides a rapid, programmatic solution. The structured n8n node arrangement handles the multi-step, asynchronous nature of AI task execution—first generating the static try-on image based on model and clothing URLs, and then using that output to generate a short, looping 360° video based on a specified prompt. This entire process is encapsulated within a reliable n8n workflow, making sophisticated AI accessible even without deep coding knowledge. Implementing this n8n template dramatically accelerates media production for online retail.

How it Works

This robust n8n workflow operates as an automated polling system to handle long-running AI generation tasks:


  1. Trigger & Setup: The n8n trigger starts the process (currently manual, but adaptable). The Preset Parameters n8n node defines the necessary API keys and input URLs (model, dress, or separate upper/lower clothing inputs).

  2. Image Task Submission: The Kling Virtual Try-On Task n8n node submits the request for the initial AI try-on image.

  3. Image Polling Loop: The n8n workflow enters a polling sequence using the Wait for Image Generation n8n node and the subsequent Get Kling Virtual Try-On Task n8n node. The Check Data Status n8n node determines if the image generation is complete. If the status is pending, the n8n workflow loops back to wait, demonstrating efficient asynchronous handling.

  4. Video Task Submission: Once the image status is completed, the Switch n8n node directs execution to the Generate kling video n8n node. This submits the second AI task, requesting video generation using the newly generated try-on image URL and the predefined movement prompt.

  5. Video Polling Loop: A second, identical polling sequence begins, managed by the Wait for Video Generation n8n node and the Get Kling Video Task n8n node. The Get Video Data Status n8n node checks for completion, looping until the task finishes successfully.

  6. Final Output: Upon successful completion of the video generation (verified by the final Check Video Data Status n8n node), the Get Final Video URL n8n node extracts and presents the publicly accessible URL of the 360° virtual try-on video. This final n8n node completes the automation.

Installation Guide

To use this n8n template, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON code and paste it into your n8n instance via the Workflows section (New -> Import from JSON).

  2. Activate Credentials: This n8n workflow requires connectivity to the Kling API via PiAPI. Obtain your x-api-key from that service.

  3. Configure Parameters: Locate the Preset Parameters n8n node and update the following fields:

x-api-key: Insert your API key here.
modelinput: URL of the model image.
dressinput, upperinput, or lowerinput: URLs for the specific clothing items. Ensure you supply the correct combination based on the clothing type.
generatevideoprompt: Customize the action prompt (e.g., "Walk on the catwalk, turn around...").

  1. Test and Deploy: Execute the n8n workflow manually using the When clicking ‘Test workflow’ n8n trigger to ensure connectivity and correct output before activating the workflow for production use.

Node Details

This n8n workflow relies heavily on the HTTP Request and core logic nodes to manage the asynchronous API calls:

When clicking ‘Test workflow’ (n8n trigger):
Function: Initiates this specific n8n workflow for manual execution.
Key Configuration: Standard manual n8n trigger.
Preset Parameters (Set n8n node):
Function: Defines and passes all necessary API keys, model URLs, clothing URLs, and the video prompt used throughout the n8n workflow.
Key Configuration: Raw JSON output defining dynamic input variables.
Kling Virtual Try-On Task (HTTP Request n8n node):
Function: Submits the initial POST request to PiAPI to start the aitryon image generation task, passing the necessary input URLs.
Key Configuration: POST request using expressions to dynamically access inputs and the x-api-key header.
Wait for Image Generation / Wait for Video Generation (Wait n8n node):
Function: Introduces intentional delays (polling intervals) in the n8n workflow to handle the latency of the long-running AI generation tasks.
Key Configuration: Simple wait functionality.
Check Data Status / Get Video Data Status (If n8n node):
Function: Implements the core logic of the polling loop. It checks if the task status is completed or failed. If neither, the n8n workflow loops back to the previous Wait n8n node.
Key Configuration: Checks {{ $json.data.status }} for specific completion values.
Generate kling video (HTTP Request n8n node):
Function: Submits the second POST request to start the videogeneration task, leveraging the successful image resource URL generated by the preceding steps of the n8n workflow.
Key Configuration: POST request using the image URL output and the generate
videoprompt.
Get Final Video URL (Set n8n node):
Function: The final n8n node in the successful path, extracting the generated video URL for downstream use or reporting.
Key Configuration*: Raw JSON output setting the video
url variable.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by
PiAPI
PiAPI

Featured*