{
  "name": "Make video vertical for TikTok with KinoPipe",
  "nodes": [
    {
      "parameters": {},
      "id": "b1a7c2d0-0001-4db4-8885-00d6c3f7f600",
      "name": "When clicking Execute workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [-720, 0]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b1a7c2d0-0002-4fc5-95ea-993060bfa001",
              "name": "sourceUrl",
              "value": "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "b1a7c2d0-0003-4148-954c-0d166e2d1802",
      "name": "Set source URL",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [-500, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://kinopipe.com/api/v1/tools/video-to-vertical",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer REPLACE_WITH_KINOPIPE_API_KEY" },
            { "name": "Idempotency-Key", "value": "=n8n-vertical-{{$execution.id}}" }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { inputs: [{ id: 'main', url: $json.sourceUrl }], options: { background: 'blur' } } }}",
        "options": {}
      },
      "id": "b1a7c2d0-0004-488a-b1b7-8feb4793c003",
      "name": "Make it vertical",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-260, 0]
    },
    {
      "parameters": { "amount": 5 },
      "id": "b1a7c2d0-0005-4035-a453-cc985cd4b404",
      "name": "Wait 5 seconds",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [-20, 0],
      "webhookId": "b1a7c2d0-0006-429f-979b-d67c6476c105"
    },
    {
      "parameters": {
        "url": "=https://kinopipe.com{{$node['Make it vertical'].json.statusUrl}}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer REPLACE_WITH_KINOPIPE_API_KEY" }
          ]
        },
        "options": {}
      },
      "id": "b1a7c2d0-0007-43c7-90fc-905878ec9a06",
      "name": "Get job status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [220, 0]
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 },
          "conditions": [
            {
              "id": "b1a7c2d0-0008-4247-a416-1d8516243107",
              "leftValue": "={{ ['succeeded', 'failed'].includes($json.job.status) }}",
              "rightValue": true,
              "operator": { "type": "boolean", "operation": "true", "singleValue": true }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "b1a7c2d0-0009-411b-b5dc-2ff96aa5d408",
      "name": "Job finished?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [460, 0]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "b1a7c2d0-000a-46aa-872b-27130c760c09", "name": "status", "value": "={{ $json.job.status }}", "type": "string" },
            { "id": "b1a7c2d0-000b-4cf9-8097-18dbef2b80f0", "name": "downloadUrl", "value": "={{ $json.result?.output?.downloadUrl || '' }}", "type": "string" },
            { "id": "b1a7c2d0-000c-4399-806c-717ac432541a", "name": "error", "value": "={{ $json.job.error?.message || '' }}", "type": "string" }
          ]
        },
        "options": {}
      },
      "id": "b1a7c2d0-000d-4b99-af99-d16b8d640810",
      "name": "Finished output",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [700, -100]
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking Execute workflow": { "main": [[{ "node": "Set source URL", "type": "main", "index": 0 }]] },
    "Set source URL": { "main": [[{ "node": "Make it vertical", "type": "main", "index": 0 }]] },
    "Make it vertical": { "main": [[{ "node": "Wait 5 seconds", "type": "main", "index": 0 }]] },
    "Wait 5 seconds": { "main": [[{ "node": "Get job status", "type": "main", "index": 0 }]] },
    "Get job status": { "main": [[{ "node": "Job finished?", "type": "main", "index": 0 }]] },
    "Job finished?": { "main": [[{ "node": "Finished output", "type": "main", "index": 0 }], [{ "node": "Wait 5 seconds", "type": "main", "index": 0 }]] }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "versionId": "b1a7c2d0-000e-43db-a962-57245785fc56",
  "meta": { "templateCredsSetupCompleted": false },
  "tags": []
}
