{
  "name": "万川 API｜显式删除媒体输入（手动确认）",
  "nodes": [
    {
      "parameters": {},
      "id": "378603fa-f025-4c5d-a3d6-4088fd7787de",
      "name": "手动触发",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -560,
        220
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "148a98b8-1df2-436b-ac53-c920aa576028",
              "name": "input_id",
              "value": "REPLACE_WITH_MEDIA_INPUT_ID",
              "type": "string"
            },
            {
              "id": "c173be87-d6ad-4166-a18c-114f3c93de8c",
              "name": "confirm_delete",
              "value": false,
              "type": "boolean"
            }
          ]
        },
        "options": {}
      },
      "id": "e0e7b09e-26b6-43c1-ab54-b606b1984713",
      "name": "万川｜删除配置",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -340,
        220
      ]
    },
    {
      "parameters": {
        "jsCode": "const config = $node['万川｜删除配置'].json;\nif (config.confirm_delete !== true) {\n  throw new Error('删除默认关闭：核对 input_id 后，必须把 confirm_delete 明确改为 true 才会请求万川');\n}\nconst inputId = String(config.input_id || '').trim();\nif (!/^media_input_[A-Za-z0-9_-]{8,64}$/.test(inputId)) {\n  throw new Error('input_id 必须是万川上传接口返回的完整不透明媒体输入 ID，不能填写 URL、路径或自行猜测的值');\n}\nreturn [{ json: { input_id: inputId } }];"
      },
      "id": "eb7d15c2-5f87-40f0-8d29-d7d98c34e916",
      "name": "万川｜核对删除确认与 ID",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -100,
        220
      ]
    },
    {
      "parameters": {
        "method": "DELETE",
        "url": "={{ 'https://api.wanchuanapi.com/v1/media/inputs/' + encodeURIComponent($json.input_id) }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {
          "timeout": 45000
        }
      },
      "id": "0d7dd25b-ad76-4644-80fb-bce7606a613a",
      "name": "万川｜显式删除媒体输入",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        160,
        220
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "REPLACE_WITH_WANCHUAN_CREDENTIAL_ID",
          "name": "万川 API Bearer（导入后选择）"
        }
      }
    },
    {
      "parameters": {
        "content": "## 这是独立的破坏性操作\n\n- 工作流保持未激活，只能由操作者手动触发。\n- 先复制上传响应中的完整 `input.id`，再把 `confirm_delete` 改为 `true`。\n- 活跃任务仍引用该输入时，万川返回 `409 media_input_in_use`，不会绕过占用检查。\n- `204` 表示万川已接受删除流程；只有私有对象清理确认且记录进入 `deleted` 后，共享的 10 GiB 占用才会释放。\n- 本工作流没有定时、Webhook 或成功任务后的自动删除分支。",
        "height": 260,
        "width": 460
      },
      "id": "45138a68-b106-44b3-91e1-73414303d235",
      "name": "删除前必读",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -560,
        -120
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "手动触发": {
      "main": [
        [
          {
            "node": "万川｜删除配置",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "万川｜删除配置": {
      "main": [
        [
          {
            "node": "万川｜核对删除确认与 ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "万川｜核对删除确认与 ID": {
      "main": [
        [
          {
            "node": "万川｜显式删除媒体输入",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "saveDataErrorExecution": "none",
    "saveDataSuccessExecution": "none",
    "saveManualExecutions": false,
    "saveExecutionProgress": false,
    "redactionPolicy": "all"
  },
  "versionId": "2d8ecdad-0f94-4c4a-af77-4d7768617a84",
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
