Skip to content

apply_draft_preset ​

POST /preset/apply

口径:本页参数表最后核对于 v23.9(2026-10-27)。v24.0~v24.8 的改动(add_video 的 timeline_start/timeline_end 别名、apply_edl 批内失败计数、resource/search 的 limit 与 count 等价、/agent/route 类型分诊等)以 llms-full.txt 与 GET /agent/capabilities 为准。

接口说明 ​

复制一个草稿预设为新草稿,并按 replacements 替换文字关键字或素材 URL。原预设不会被修改,每次应用都会生成新的 draft_id。

桌面下载器默认只需要填写新草稿名称,然后生成一份新草稿。需要手工替换文字或素材 URL 时,再展开「高级替换项」。下面的 replacements 是服务端接口格式,大模型或调用方可以按需传入,日常不需要手写 JSON。

替换是显式的:文字用 keyword 匹配,图片、视频和音频用 target 匹配素材名或路径关键字。没有写替换项时,就是复制一份完整草稿。

请求参数 ​

参数必填说明
preset_id是草稿预设 ID
replacements否替换项数组,不填时只复制预设
name否新草稿的名称备注

文字替换 ​

json
{
  "type": "text",
  "keyword": "原标题",
  "value": "今天分享",
  "all": true
}

all 默认为 true,表示替换所有匹配位置;设为 false 时只替换第一处。

素材替换 ​

json
{
  "type": "image",
  "target": "cover.png",
  "url": "https://example.com/new-cover.png",
  "new_name": "new-cover.png"
}

type 可取 image、video 或 audio。target 是预设元素清单里的 material_name 或 path 关键字,url 是新的素材地址。

完整示例 ​

json
{
  "preset_id": "pst_1790000000_ab12cd34",
  "replacements": [
    {
      "type": "text",
      "keyword": "原标题",
      "value": "今天分享"
    },
    {
      "type": "image",
      "target": "cover.png",
      "url": "https://example.com/new-cover.png"
    }
  ]
}

返回:

json
{
  "success": true,
  "output": {
    "preset_id": "pst_1790000000_ab12cd34",
    "draft_id": "dfd_cat_demo_001",
    "draft_url": "https://your-domain.example/api/draft/downloader?draft_id=dfd_cat_demo_001&is_capcut=0&token=<签名令牌>",
    "applied": [
      {
        "type": "text",
        "segment_id": "segment_demo_text",
        "from": "原标题",
        "to": "今天分享"
      },
      {
        "type": "image",
        "segment_id": "segment_demo_image",
        "from": "cover.png",
        "to": "https://example.com/new-cover.png"
      }
    ],
    "applied_count": 2
  },
  "error": ""
}

注意事项 ​

  • 预设只保存工程结构,素材仍由 URL 或本地下载器处理。
  • 素材 URL 必须由调用方明确提供,服务端不会自动上传或下载素材。
  • 本机剪映草稿如果是加密格式,不能直接作为预设上传;组合预设可通过 POST /preset/upload 导入。

个人自建服务