This workflow corresponds to n8n.io template #12202 — we link there as the canonical source.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "d482017f-5ecf-4ad1-85b1-4e728c090720",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1312,
2176
],
"parameters": {
"color": 5,
"width": 528,
"height": 640,
"content": "## Muhammad Farooq Iqbal - Automation Expert & n8n Creator\n\nI am a passionate automation expert and recognized n8n Creator specializing in intelligent workflow automation. With extensive experience in n8n, AI automation, Zapier, and Make.com, I have created innovative workflow templates with 2500+ downloads across the global automation community\n\n### Expertise\n- **Workflow Automation**: n8n, Zapier, Make.com, AI automation\n- **AI Integration**: Gemini AI, API integration, data processing\n- **Platform Mastery**: Google Sheets, Google Drive, custom scripts\n\n## Need Help with This Workflow?\n\nIf you face any issues with this workflow or need customization support, feel free to reach out:\n\n**\ud83d\udce7 Email**: mfarooqiqbal143@gmail.com \n**\ud83d\udcf1 Phone**: +923036991118 \n**\ud83d\udcbc LinkedIn**: [Connect with me](https://linkedin.com/in/muhammadfarooqiqbal) \n**\ud83c\udf10 Portfolio**: [View my work](https://mfarooqone.github.io/n8n/)\n**UpWork**: [Upwork Profile](https://www.upwork.com/freelancers/~011aeba159896e2eba)\n\n*I'm always excited to help with automation challenges and workflow optimization!*\n"
},
"typeVersion": 1
},
{
"id": "7c629ad9-0f73-4680-8c7f-59add65251d0",
"name": "Submit Video Generation Request",
"type": "n8n-nodes-base.httpRequest",
"position": [
-256,
1872
],
"parameters": {
"url": "https://api.kie.ai/api/v1/jobs/createTask",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"kling-2.6/text-to-video\",\n \"input\": {\n \"prompt\": \"{{ $json.prompt }}\",\n \"sound\": {{ $json.sound }},\n \"duration\": {{ $json.duration }},\n \"aspect_ratio\":{{ $json.aspect_ratio }}\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "4ed40627-6579-4722-9603-2b0ca56c6a94",
"name": "Switch Video Generation Status",
"type": "n8n-nodes-base.switch",
"onError": "continueRegularOutput",
"position": [
368,
1824
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "fail",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "fail-state-condition",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "fail"
}
]
},
"renameOutput": true
},
{
"outputKey": "success",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "success-state-condition",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "success"
}
]
},
"renameOutput": true
},
{
"outputKey": "generating",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "generating-state-condition",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "generating"
}
]
},
"renameOutput": true
},
{
"outputKey": "queuing",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "queuing-state-condition",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "queuing"
}
]
},
"renameOutput": true
},
{
"outputKey": "waiting",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "waiting-state-condition",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "waiting"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"retryOnFail": true,
"typeVersion": 3.2
},
{
"id": "a29e2578-9cd9-4d2f-b53f-af731511ce4b",
"name": "Check Video Generation Status",
"type": "n8n-nodes-base.httpRequest",
"position": [
144,
1872
],
"parameters": {
"url": "https://api.kie.ai/api/v1/jobs/recordInfo",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"queryParameters": {
"parameters": [
{
"name": "taskId",
"value": "={{ $json.data.taskId }}"
}
]
}
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "2ae971a7-238c-44d2-9a71-9cec1591119a",
"name": "Wait for Video Generation",
"type": "n8n-nodes-base.wait",
"position": [
-16,
1872
],
"parameters": {
"unit": "seconds",
"amount": 5
},
"retryOnFail": true,
"typeVersion": 1
},
{
"id": "6028de3e-a7e2-4113-b44b-aa97ccd5cc17",
"name": "Extract Video URL",
"type": "n8n-nodes-base.code",
"position": [
608,
1840
],
"parameters": {
"jsCode": "// n8n Function node\nconst items = $input.all();\nconst out = [];\n\nfor (const item of items) {\n // Your HTTP node sometimes returns an array at top-level\n const payload = item.json;\n const first = Array.isArray(payload) ? payload[0] : payload;\n\n // Get the stringified resultJson safely\n const resultJsonStr = first?.data?.resultJson ?? '';\n\n // Parse and extract\n let resultUrls = [];\n try {\n const parsed = JSON.parse(resultJsonStr);\n resultUrls = parsed?.resultUrls ?? [];\n } catch (e) {\n // leave resultUrls as []\n }\n\n out.push({ json: { resultUrls } });\n}\n\nreturn out;\n"
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "3ca50a60-21f1-4293-bdd7-008889ad5751",
"name": "Download Video File",
"type": "n8n-nodes-base.httpRequest",
"position": [
784,
1840
],
"parameters": {
"url": "={{ $json.resultUrls[0] }}",
"options": {}
},
"typeVersion": 4.3
},
{
"id": "6a4ca7b4-22d9-4933-a718-4f424caef0a0",
"name": "When clicking \u2018Execute workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-656,
1872
],
"parameters": {},
"typeVersion": 1
},
{
"id": "feb75d00-4bb1-464e-a7ff-d29ab8ff8f1f",
"name": "Text-to-Video Section",
"type": "n8n-nodes-base.stickyNote",
"position": [
-720,
1664
],
"parameters": {
"width": 1728,
"height": 512,
"content": "**Text-to-Video Workflow**\n\nGenerates videos from text prompts using Kling 2.6. Set your parameters, submit the request, and the workflow polls for completion before downloading."
},
"typeVersion": 1
},
{
"id": "82c41430-32a5-420f-a5d7-57956db1b894",
"name": "Image-to-Video Section",
"type": "n8n-nodes-base.stickyNote",
"position": [
-720,
2224
],
"parameters": {
"width": 1728,
"height": 512,
"content": "**Image-to-Video Workflow**\n\nAnimates existing images into videos using Kling 2.6. Provide an image URL and prompt, then the workflow handles generation and download."
},
"typeVersion": 1
},
{
"id": "ef1bcfbb-cd2a-4bc9-9c72-de50e566917a",
"name": "Set Prompt & Image Url",
"type": "n8n-nodes-base.set",
"position": [
-432,
2384
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "774ed91a-11bd-4584-ad9c-418e9caf88df",
"name": "prompt",
"type": "string",
"value": "=YOUR_VIDEO_PROMPT_DESCRIPTION"
},
{
"id": "f810bb1e-e54d-4fc8-9be7-72426902de3f",
"name": "duration",
"type": "string",
"value": "=5"
},
{
"id": "eac7bc3a-db33-4a87-b073-c6cb7a67ac5f",
"name": "image_urls",
"type": "string",
"value": "=YOUR_IMAGE_URL"
},
{
"id": "c43f5f72-882c-4060-8aad-50996ce2c9b0",
"name": "sound",
"type": "boolean",
"value": true
}
]
}
},
"typeVersion": 3.4
},
{
"id": "f7cbe6e7-8fcc-4fa2-9ad2-4c5de8356fbd",
"name": "Wait for Image-to-Video Generation",
"type": "n8n-nodes-base.wait",
"position": [
16,
2384
],
"parameters": {
"unit": "seconds",
"amount": 5
},
"retryOnFail": true,
"typeVersion": 1
},
{
"id": "c99b20a8-4d83-4e86-9937-0d84b8055b60",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"onError": "continueRegularOutput",
"position": [
400,
2336
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "fail",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "fail-state-condition",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "fail"
}
]
},
"renameOutput": true
},
{
"outputKey": "success",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "success-state-condition",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "success"
}
]
},
"renameOutput": true
},
{
"outputKey": "generating",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "generating-state-condition",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "generating"
}
]
},
"renameOutput": true
},
{
"outputKey": "queuing",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "queuing-state-condition",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "queuing"
}
]
},
"renameOutput": true
},
{
"outputKey": "waiting",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "waiting-state-condition",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "waiting"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"retryOnFail": true,
"typeVersion": 3.2
},
{
"id": "38e93477-a4b6-4c7a-8a4a-d2fbb3ae9efc",
"name": "Check Video Status",
"type": "n8n-nodes-base.httpRequest",
"position": [
176,
2384
],
"parameters": {
"url": "https://api.kie.ai/api/v1/jobs/recordInfo",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"queryParameters": {
"parameters": [
{
"name": "taskId",
"value": "={{ $json.data.taskId }}"
}
]
}
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "1049f828-f12f-474e-b715-fda858d50150",
"name": "Download Video1",
"type": "n8n-nodes-base.httpRequest",
"position": [
800,
2352
],
"parameters": {
"url": "={{ $json.resultUrls[0] }}",
"options": {}
},
"typeVersion": 4.3
},
{
"id": "f29e65fa-87b0-4c3c-b562-22501b2133bb",
"name": "Submit Video Generation1",
"type": "n8n-nodes-base.httpRequest",
"position": [
-208,
2384
],
"parameters": {
"url": "https://api.kie.ai/api/v1/jobs/createTask",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"kling-2.6/image-to-video\",\n \"input\": {\n \"prompt\": \"{{ $json.prompt }}\",\n \"image_urls\": [\n \"{{ $json.image_urls }}\"\n ],\n \"sound\": {{ $json.sound }},\n \"duration\": {{ $json.duration }}\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "968aab5d-95fe-4d13-9621-a61f2f45f128",
"name": "Video URL",
"type": "n8n-nodes-base.code",
"position": [
640,
2352
],
"parameters": {
"jsCode": "// n8n Function node\nconst items = $input.all();\nconst out = [];\n\nfor (const item of items) {\n // Your HTTP node sometimes returns an array at top-level\n const payload = item.json;\n const first = Array.isArray(payload) ? payload[0] : payload;\n\n // Get the stringified resultJson safely\n const resultJsonStr = first?.data?.resultJson ?? '';\n\n // Parse and extract\n let resultUrls = [];\n try {\n const parsed = JSON.parse(resultJsonStr);\n resultUrls = parsed?.resultUrls ?? [];\n } catch (e) {\n // leave resultUrls as []\n }\n\n out.push({ json: { resultUrls } });\n}\n\nreturn out;\n"
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "dfcfe5d1-9976-4417-9d4d-77224081c44f",
"name": "Set Text to Video Parameters",
"type": "n8n-nodes-base.set",
"position": [
-448,
1872
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "774ed91a-11bd-4584-ad9c-418e9caf88df",
"name": "prompt",
"type": "string",
"value": "=YOUR_VIDEO_PROMPT_DESCRIPTION"
},
{
"id": "b170f8a2-4c85-409f-95a5-bfe78fb1a865",
"name": "sound",
"type": "boolean",
"value": false
},
{
"id": "f810bb1e-e54d-4fc8-9be7-72426902de3f",
"name": "duration",
"type": "string",
"value": "=10"
},
{
"id": "fa5280c1-3e23-427f-b64a-6b049f47a123",
"name": "aspect_ratio",
"type": "string",
"value": "9:16"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7adca58b-95b7-4155-b3e3-1d00cf895cc3",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1424,
1664
],
"parameters": {
"width": 640,
"height": 480,
"content": "## How it works\n\nThis workflow generates videos using Kling 2.6 AI through the KIE.AI API. You can create videos in two ways: text-to-video (describe a scene) or image-to-video (animate an existing image). The workflow submits your request, waits for processing (typically 1-5 minutes), checks status every 5 seconds, and downloads the completed video when ready.\n\n## Setup steps\n\n1. Get your KIE.AI API key from https://kie.ai/\n2. In n8n, create an HTTP Bearer Auth credential named \"KIE.AI\" and paste your API key\n3. Choose your workflow type and update the corresponding 'Set' node:\n - Text-to-Video: Update 'Set Text to Video Parameters' (prompt, duration, sound, aspect_ratio)\n - Image-to-Video: Update 'Set Prompt & Image Url' (prompt, image_urls, duration, sound)\n4. Click \"Execute Workflow\" to test. The workflow automatically polls for completion and downloads your video.\n"
},
"typeVersion": 1
}
],
"connections": {
"Switch": {
"main": [
[
{
"node": "Submit Video Generation1",
"type": "main",
"index": 0
}
],
[
{
"node": "Video URL",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait for Image-to-Video Generation",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait for Image-to-Video Generation",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait for Image-to-Video Generation",
"type": "main",
"index": 0
}
]
]
},
"Video URL": {
"main": [
[
{
"node": "Download Video1",
"type": "main",
"index": 0
}
]
]
},
"Extract Video URL": {
"main": [
[
{
"node": "Download Video File",
"type": "main",
"index": 0
}
]
]
},
"Check Video Status": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Set Prompt & Image Url": {
"main": [
[
{
"node": "Submit Video Generation1",
"type": "main",
"index": 0
}
]
]
},
"Submit Video Generation1": {
"main": [
[
{
"node": "Wait for Image-to-Video Generation",
"type": "main",
"index": 0
}
]
]
},
"Wait for Video Generation": {
"main": [
[
{
"node": "Check Video Generation Status",
"type": "main",
"index": 0
}
]
]
},
"Set Text to Video Parameters": {
"main": [
[
{
"node": "Submit Video Generation Request",
"type": "main",
"index": 0
}
]
]
},
"Check Video Generation Status": {
"main": [
[
{
"node": "Switch Video Generation Status",
"type": "main",
"index": 0
}
]
]
},
"Switch Video Generation Status": {
"main": [
[
{
"node": "Submit Video Generation Request",
"type": "main",
"index": 0
}
],
[
{
"node": "Extract Video URL",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait for Video Generation",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait for Video Generation",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait for Video Generation",
"type": "main",
"index": 0
}
]
]
},
"Submit Video Generation Request": {
"main": [
[
{
"node": "Wait for Video Generation",
"type": "main",
"index": 0
}
]
]
},
"Wait for Image-to-Video Generation": {
"main": [
[
{
"node": "Check Video Status",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Execute workflow\u2019": {
"main": [
[
{
"node": "Set Text to Video Parameters",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
httpBearerAuth
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
**This n8n template provides a comprehensive suite of Kling 2.6 video generation capabilities through the KIE.AI API. The workflow includes two independent video generation workflows: text-to-video and image-to-video. Each workflow can be used independently to create videos from…
Source: https://n8n.io/workflows/12202/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow allows you to import any workflow from a file or another n8n instance and map the credentials easily. A multi-form setup guides you through the entire process At the beginning you have t
[n8n] Advanced URL Parsing and Shortening Workflow - Switchy.io Integration. Uses splitInBatches, stickyNote, httpRequest, html. Event-driven trigger; 56 nodes.
[](https://youtu.be/c7yCZhmMjtI)
This automation organizes your n8n workflows files into categorizes (Active, Template, Done, Archived) and uploads them directly to a categorized Google Drive folders. It is designed to help users man
Create Animated Stories using GPT-4o-mini, Midjourney, Kling and Creatomate API. Uses httpRequest. Event-driven trigger; 51 nodes.