自訂範本 API

November 27, 2026

自訂範本 API

把一組剪輯設定存成範本,再在 AI 剪輯 或 片段匯出 傳入 custom_template_id,一次套用整組設定。

範本可以包含畫幅與版面、字幕樣式、表情、B-roll、AI Hook、人聲增強、去口癖、去靜音、片頭、片尾與 Logo。

範本與網站上的 My Template 是同一份資料。在網站建立的範本,這裡可以查到;在這裡建立的範本,也會出現在網站上。

套餐限制

套餐可保存範本數
Free不可用
Starter1
Pro3
Scale10。購買 2 份及以上時,上限提高到 20。

上傳 Logo、片頭或片尾也需要付費套餐,並佔用儲存空間。參見 訂閱計劃。

使用流程

  1. 上傳素材只在範本需要 Logo、片頭或片尾時才做。字幕、畫幅和其他設定不需要上傳。
  2. 建立範本。平台會依你選擇的位置擺放 Logo、片頭和片尾。不要傳座標。
  3. 需要目前設定時,列出或讀取範本。
  4. 在 POST /api/v2/clips 或 POST /api/v2/clips/export 傳入 custom_template_id 來套用範本。
  5. 更新會整份覆蓋。請求裡沒寫的能力會從範本中移除。先讀取目前範本,改完後再提交完整設定。
  6. 不再需要時刪除範本。

端點

方法路徑說明
POST/api/v2/upload/single-file取得 Logo、片頭或片尾的上傳網址
POST/api/v2/upload/status輪詢直到檔案可用
POST/api/v2/custom-templates建立範本
GET/api/v2/custom-templates列出範本
GET/api/v2/custom-templates/{id}讀取單一範本
PUT/api/v2/custom-templates/{id}整份覆蓋範本
DELETE/api/v2/custom-templates/{id}刪除範本

所有請求都需要:

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
x-wayinvideo-api-version: v2

GET 與 DELETE 不需要 Content-Type。


上傳 Logo、片頭或片尾

先取得預簽名網址,把檔案 PUT 上去,再輪詢到 status 為 DONE。把回傳的 identity 填到範本的 resource.identify。

範本不用 Logo、片頭或片尾時,跳過這一步。一般影片上傳見 上傳 API。

POST https://wayinvideo-api.wayin.ai/api/v2/upload/single-file

請求本體

參數類型必填說明
namestring是帶副檔名的檔名。副檔名用來檢查格式。
sizeinteger否檔案大小,單位為位元組。建議傳入,以便檢查大小上限與儲存額度。
resource_typestring範本素材必填檔案用途。見下表。省略時會當成一般影片,不能用在範本裡。
resource_type用於格式大小上限時長上限
BRAND_KIT_LOGOlogo.jpg、.jpeg、.png、.webp10 MB—
BRAND_KIT_VIDEOintro、outro.mp4、.mov、.webm、.avi5 GB60 分鐘

請求範例

curl -X POST https://wayinvideo-api.wayin.ai/api/v2/upload/single-file \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2" \
  -d '{
    "name": "brand-logo.png",
    "size": 204800,
    "resource_type": "BRAND_KIT_LOGO"
  }'

回應

{
  "data": {
    "upload_url": "https://storage.example.com/upload/presigned-url...",
    "identity": "EF_up_06wguq1afbwg1"
  }
}
欄位類型說明
upload_urlstring預簽名上傳網址。會過期,請在取得後盡快上傳。
identitystring檔案 ID。建立或更新範本時,填入 resource.identify。

上傳檔案

curl -X PUT "https://storage.example.com/upload/presigned-url..." \
  --upload-file ./brand-logo.png

HTTP 200 表示檔案已收到。平台接著處理檔案。請輪詢狀態,直到處理完成。

查詢上傳狀態

每 3 到 5 秒輪詢一次,直到 status 為 DONE 或 ERROR。只有 status 為 DONE 的檔案可以放進範本。

POST https://wayinvideo-api.wayin.ai/api/v2/upload/status
參數類型必填說明
identifystring是取得上傳網址時回傳的 identity。
curl -X POST https://wayinvideo-api.wayin.ai/api/v2/upload/status \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2" \
  -d '{
    "identify": "EF_up_06wguq1afbwg1"
  }'
{
  "data": {
    "status": "DONE",
    "file_name": "brand-logo.png",
    "url": "https://cdn.example.com/user/brand-logo.png"
  }
}
欄位類型說明
statusstringSTART:尚未收到檔案,請確認 PUT 已成功。UPLOADED:已收到檔案,仍在處理。DONE:可以使用。ERROR:處理失敗,請重新上傳。
file_namestring檔名。
urlstring檔案網址。

建立範本

POST https://wayinvideo-api.wayin.ai/api/v2/custom-templates

請求本體

參數類型必填說明
namestring是範本名稱,不能為空。
configobject是要保存的能力。每個 key 是一項能力。見 設定欄位。可以是 {},不能是 null。只要還傳了其他能力,reframe 就必填。

config 裡寫了的能力,套用時會覆蓋 AI 剪輯 上的對應參數。沒寫的能力,沿用該次剪輯或匯出請求裡的值。

請求範例

curl -X POST https://wayinvideo-api.wayin.ai/api/v2/custom-templates \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2" \
  -d '{
    "name": "Brand A - Shorts",
    "config": {
      "reframe": {
        "ratio": "RATIO_9_16",
        "layout_type": "Fit",
        "auto_reframe": true
      },
      "caption_style": {
        "mode": "on",
        "template_id": "word-focus"
      },
      "emoji": { "operation": "add" },
      "broll": {
        "operation": "add",
        "resource_type": "RESOURCE_VIDEO_STOCK_BROLL"
      },
      "ai_hook": {
        "operation": "add",
        "template_id": "preset-1",
        "script_style": "casual",
        "position": "beginning"
      },
      "speech_enhance": { "operation": "clean" },
      "remove_filter": { "operation": "remove" },
      "remove_silence": {
        "operation": "remove",
        "silence_duration_ms": 500
      },
      "intro": {
        "operation": "add",
        "resource": { "identify": "EF_up_06wgintro0001" }
      },
      "outro": {
        "operation": "add",
        "resource": { "identify": "EF_up_06wgoutro0001" }
      },
      "logo": {
        "operation": "add",
        "items": [
          {
            "resource": { "identify": "EF_up_06wguq1afbwg1" },
            "position": "top_right"
          }
        ]
      }
    }
  }'

回應

回應是已保存的範本,結構與 讀取範本 相同。

{
  "data": {
    "id": "uctmpl06yf2m0m1b0pv",
    "name": "Brand A - Shorts",
    "config": {
      "reframe": {
        "ratio": "RATIO_9_16",
        "layout_type": "Fit",
        "auto_reframe": true
      }
    },
    "created": 1764057600000,
    "last_modified": 1764057600000
  }
}

列出範本

回傳目前帳號或工作區下的全部範本,最新的在前。沒有範本時 data 為 []。

GET https://wayinvideo-api.wayin.ai/api/v2/custom-templates

請求範例

curl -X GET https://wayinvideo-api.wayin.ai/api/v2/custom-templates \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2"

回應範例

{
  "data": [
    {
      "id": "uctmpl06yf2m0m1b0pv",
      "name": "Brand A - Shorts",
      "config": {
        "reframe": {
          "ratio": "RATIO_9_16",
          "layout_type": "Fit",
          "auto_reframe": true
        }
      },
      "created": 1764057600000,
      "last_modified": 1764144000000
    }
  ]
}
欄位類型說明
idstring範本 ID,以 uctmpl 開頭。
namestring範本名稱。
configobject已保存的設定。見 讀取範本。
createdinteger建立時間,毫秒 Unix 時間戳。
last_modifiedinteger最後修改時間,毫秒 Unix 時間戳。

讀取範本

GET https://wayinvideo-api.wayin.ai/api/v2/custom-templates/{id}

路徑參數

參數類型必填說明
idstring是建立或列出時回傳的範本 ID。

請求範例

curl -X GET https://wayinvideo-api.wayin.ai/api/v2/custom-templates/uctmpl06yf2m0m1b0pv \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2"

回應範例

{
  "data": {
    "id": "uctmpl06yf2m0m1b0pv",
    "name": "Brand A - Shorts",
    "config": {
      "reframe": {
        "ratio": "RATIO_9_16",
        "layout_type": "Fit",
        "auto_reframe": true
      },
      "caption_style": {
        "mode": "on",
        "template_id": "word-focus"
      },
      "intro": {
        "operation": "add",
        "resource": {
          "identify": "EF_up_06wgintro0001",
          "url": "https://cdn.example.com/user/intro.mp4",
          "name": "intro"
        }
      },
      "logo": {
        "operation": "add",
        "items": [
          {
            "resource": {
              "identify": "EF_up_06wguq1afbwg1",
              "url": "https://cdn.example.com/user/brand-logo.png",
              "name": "brand-logo"
            },
            "position": "top_right"
          }
        ]
      }
    },
    "created": 1764057600000,
    "last_modified": 1764144000000
  }
}
欄位類型說明
idstring範本 ID。
namestring範本名稱。
configobject範本設定。除了本頁列出的欄位,config 還可能帶有 transform、operation、extra 等內部欄位。更新時可以原樣帶回。帶回的 transform 會直接沿用。如果某個 Logo 同時帶了 position,該項的 transform 會被捨棄,並依 position 重新計算位置。素材物件可能帶有 url 與 name。平台只讀取 identify。
createdinteger建立時間,毫秒 Unix 時間戳。
last_modifiedinteger最後修改時間,毫秒 Unix 時間戳。

在網站上拖曳擺放的 Logo 沒有 position,該項只有 transform。原樣帶回會保持原來的位置。補上 position 則會按新位置重新擺放。


更新範本

用請求裡的 name 和 config 替換整個範本。config 裡沒寫的能力會被移除,不是局部更新。Logo、片頭和片尾會依新設定重新計算位置。

先用 讀取範本 拿到目前物件,改完後提交完整請求本體。

PUT https://wayinvideo-api.wayin.ai/api/v2/custom-templates/{id}

請求本體與 建立範本 相同。name 和 config 都必填。

請求範例

這個例子保留畫幅、字幕和 Logo,並把 Logo 移到右下角。先前保存的片頭不在這份請求裡,因此會被移除。

curl -X PUT https://wayinvideo-api.wayin.ai/api/v2/custom-templates/uctmpl06yf2m0m1b0pv \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2" \
  -d '{
    "name": "Brand A - Shorts v2",
    "config": {
      "reframe": {
        "ratio": "RATIO_9_16",
        "layout_type": "Fit",
        "auto_reframe": true
      },
      "caption_style": {
        "mode": "on",
        "template_id": "word-focus"
      },
      "logo": {
        "operation": "add",
        "items": [
          {
            "resource": { "identify": "EF_up_06wguq1afbwg1" },
            "position": "bottom_right"
          }
        ]
      }
    }
  }'

回應

更新後的範本,結構與 讀取範本 相同。


刪除範本

DELETE https://wayinvideo-api.wayin.ai/api/v2/custom-templates/{id}

刪除後不能恢復。之後再用這個 ID 讀取或套用,都會因為範本不存在而失敗。已經用這個範本生成或匯出的片段不受影響。範本引用的檔案不會被刪除。

請求範例

curl -X DELETE https://wayinvideo-api.wayin.ai/api/v2/custom-templates/uctmpl06yf2m0m1b0pv \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2"

回應

{
  "data": null
}

套用範本

在 JSON 請求本體裡加上 custom_template_id。

在 AI 剪輯 中,只有 enable_export 為 true 時才會使用 custom_template_id。在 片段匯出 中,匯出請求本身就是算圖,因此只要傳了這個 ID 就會套用。

{
  "video_url": "https://www.youtube.com/watch?v=example",
  "target_lang": "en",
  "enable_export": true,
  "custom_template_id": "uctmpl06yf2m0m1b0pv"
}
情況結果
範本和請求都設定了同一項能力以範本為準。例如範本的 caption_style 會覆蓋請求裡的 cc_style_tpl。
請求設定了範本沒有的能力使用請求裡的值。
範本設定了請求沒有的能力使用範本裡的值。

範本在任務提交當下讀取。之後再修改或刪除範本,不會影響已經提交的任務。


設定欄位

每個 key 是一項能力。不需要的能力不要寫。reframe 必填。

reframe

欄位類型必填說明
ratiostring是RATIO_16_9、RATIO_1_1、RATIO_4_5、RATIO_9_16。
layout_typestring是版面。允許值隨 ratio 改變。名稱必須完全一致,包含空格。
auto_reframeboolean否開啟 AI 主體跟隨。
ratio允許的 layout_type
RATIO_16_9Auto、Full、Fit、Grid 4、Split 2、Trio、PiP、OTS、Screen First
RATIO_9_16Auto、Full、Fit、Grid 4、Split 2、Trio、PiP、Screen First、Gameplay A、Gameplay B
RATIO_4_5Auto、Full、Fit、Grid 4、Split 2、Trio、PiP、Screen First、Gameplay A、Gameplay B
RATIO_1_1Auto、Full、Fit、Grid 4、Trio

caption_style

欄位類型必填說明
modestring是on 顯示字幕。off 不顯示字幕。inherit 把字幕留給剪輯或匯出請求。
template_idstringmode 為 on 時必填系統模板 ID。見 字幕樣式。

emoji

欄位類型必填說明
operationstring是add 自動加入表情。remove 不加入表情。

broll

欄位類型必填說明
operationstring是add 加入 B-roll。remove 不加入 B-roll,匯出時也會去掉已有的 B-roll。
resource_typestring否RESOURCE_VIDEO_AI_BROLL 由 AI 生成。RESOURCE_VIDEO_STOCK_BROLL 使用素材庫。

ai_hook

欄位類型必填說明
operationstring是add 加入 AI Hook。remove 不加入,匯出時也會去掉已有的 Hook。為 remove 時不需要其他欄位。
template_idstringoperation 為 add 時必填系統模板 ID。見 Hook 文字樣式。
script_stylestring否文案風格。預設 serious。允許值:serious、casual、informative、conversational、humorous、parody、inspirational、dramatic、empathetic、persuasive、neutral、excited、calm。
positionstring否beginning 或 end。預設 beginning。
keywordsstring否希望 Hook 圍繞的關鍵字。
text_durationinteger否Hook 文字停留時間,單位為毫秒。

speech_enhance

欄位類型必填說明
operationstring是clean 開啟人聲增強與降噪。restore 保留原聲。

remove_filter

欄位類型必填說明
operationstring是remove 去掉 "um"、"uh" 這類口頭語。restore 保留。

remove_silence

欄位類型必填說明
operationstring是remove 去掉靜音段。restore 保留。
silence_duration_msinteger否超過多長的靜音才去掉,單位為毫秒。預設 500。

intro 與 outro

兩個物件的欄位相同。片頭加在每個片段開頭,片尾加在結尾,並按範本畫幅適配。

欄位類型必填說明
operationstring是add 加入素材。remove 在套用時去掉已有的片頭或片尾。為 remove 時不需要其他欄位。
resource.identifystringoperation 為 add 時必填上傳步驟回傳的 identity。上傳時 resource_type 必須是 BRAND_KIT_VIDEO。
欄位類型必填說明
operationstring是add 加入 Logo。remove 在套用時去掉已有的 Logo。為 remove 時不需要 items。
itemsarrayoperation 為 add 時必填Logo 列表,至少 1 個。
items[].resource.identifystringoperation 為 add 時必填上傳步驟回傳的 identity。上傳時 resource_type 必須是 BRAND_KIT_LOGO。
items[].positionstring是top_left、top_right、center、bottom_left、bottom_right。更新時如果帶回詳情裡的 transform,可以不傳 position,以保持原來的位置。傳了 position 則重新擺放。

Logo 的大小與邊距使用平台預設值。