You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Bright watermark
PutVideoWatermarkTemplate
Copy page
Download PDF
PutVideoWatermarkTemplate
Description​
This API uploads visible watermark templates.​
Notes​
  • The maximum size of a single rule body is 20KB, and up to 100 custom templates are allowed.​
  • When used by a sub-account, the current bucket must have PutDataProcessTemplate permission granted.​
Request syntax​
Text watermark ​
​
PUT /?process_template&tag=Watermark HTTP/1.1​
Host: {BucketName}.tos-cn-beijing.volces.com​
Date: Fri, 30 Jul 2021 08:05:36 +0000​
Content-Type: application/json​
Content-Length: <length>​
Authorization: authorization string​
​
{​
"Tag": "Watermark", // fixed identifier​
"Name": "my-test-watermark", // user-defined name​
"WatermarkConfig": {​
"Type": "Text", // text watermark parameters;​
"Pos": "TopRight", // reference position​
"LocMode": "Relative", // offset mode​
"Dx": 10, // horizontal offset​
"Dy": 10, // vertical offset​
"StartTime": 0, // text watermark start time in milliseconds, default 0​
"EndTime": 10000, // text watermark end time in milliseconds, default 0 means video end time​
"Text": { // text watermark settings, effective when Type is Text​
"FontSize": 100, // font size​
"FontType": "fangzhengheiti", // font type​
"FontColor": "#FF0000", // font color​
"Transparency": 20, // opacity, unit %​
"Text": "hello world" // watermark content​
}​
}​
}​
​
Image watermark​
​
PUT /?process_template&tag=Watermark HTTP/1.1​
Host: {BucketName}.tos-cn-beijing.volces.com​
Date: Fri, 30 Jul 2021 08:05:36 +0000​
Content-Type: application/json​
Content-Length: <length>​
Authorization: authorization string​
​
{​
"Tag": "Watermark", // Fixed identifier​
"Name": "my-test-watermark", // User-defined name​
"WatermarkConfig": {​
"Type": "Image", // Image watermark​
"Pos": "TopRight", // Reference position​
"LocMode": "Relative", // Offset method​
"Dx": 10, // Horizontal offset​
"Dy": 10, // vertical offset​
"StartTime": 0, // watermark start time in milliseconds, default 0​
"EndTime": 10000, // watermark end time in milliseconds, default 0 means video end time​
"Image": { // image watermark settings, effective when Type is Image​
"Url": "http://myhost.com/my-watermark-img", // watermark image URL​
"Mode": "Fixed", // size mode​
"Width": 3200, // watermark image width​
"Height": 800, // watermark image height​
"Transparency": 20, // opacity in %​
"Background": false // background image enabled​
}​
}​
}​
​
Request parameters and headers ​
​
Name​
​
Type​
Required​
Example value​
Description​
process_template​
Query​
String​
Yes​
-​
Watermark template identifier, fixed as process_template, no value needed.​
tag​
Query​
String​
Yes​
Watermark​
Template type, the value is Watermark only in transparent watermark scenarios.​
​
Request body elements​
​
Name​
Type​
Required​
Example value​
Description​
Tag​
String​
Yes​
Watermark​
Fixed identifier. The watermark template value can only be Watermark, and it must match the Query parameter tag.​
Name​
String​
Yes​
​
my-test-watermark​
User-defined template name:​
  • Supports only a-z, A-Z, 0-9, _, -, and ., with a maximum length of 64 characters; must start and end with a-z, A-Z, or 0-9.​
  • No duplicate rules allowed.​
WatermarkConfig​
Container​
Yes​
-​
Watermark template detail information.​
Type​
String​
Yes​
Text​
Watermark type:​
  • Text: text watermark.​
  • Image: image watermark.​
Parent node: Watermark.​
Pos​
String​
Yes​
​
TopRight​
Reference position (see watermark position description in the image below):​
  • TopRight.​
  • TopLeft.​
  • BottomRight.​
  • BottomLeft.​
  • Left.​
  • Right.​
  • Top.​
  • Bottom.​
  • Center.​
Parent node: Watermark.​
LocMode​
String​
Yes​
Relative​
watermark offset mode, options are:​
  • Relativity: proportional.​
  • Absolute: fixed position.​
parent node: Watermark .​
Dx​
Integer​
Yes​
10​
Horizontal offset.​
  • For image watermarks, if Background is true, when locMode is Relativity, the value is a percentage within [-300 0]; when locMode is Absolute, the value is in pixels within [-4096 0].​
  • For image watermarks, if Background is false, when locMode is Relativity, the value is a percentage within [0 100]; when locMode is Absolute, the value is in pixels within [0 4096].​
  • For text watermarks, when locMode is Relativity, the value is a percentage within [0 100]; when locMode is Absolute, the value is in pixels within [0 4096].​
  • This parameter is invalid when Pos is Top, Bottom, or Center.​
Parent node: Watermark.​
Dy​
Integer​
Yes​
10​
Vertical offset.​
  • For image watermarks, if Background is true and locMode is Relativity, the value is a percentage ranging from [-300 0]; if locMode is Absolute, the value is in pixels ranging from [-4096 0].​
  • For image watermarks, if Background is false and locMode is Relativity, the value is a percentage ranging from [0 100]; if locMode is Absolute, the value is in pixels ranging from [0 4096].​
  • For text watermarks, when locMode is Relativity, the value is a percentage ranging from [0 100]; when locMode is Absolute, the value is in pixels ranging from [0 4096].​
  • When Pos is Left, Right, or Center, this parameter is invalid.​
Parent node: Watermark.​
StartTime​
Integer​
No​
0​
Watermark start time in milliseconds, default is 0.​
Parent node: Watermark.​
EndTime​
Integer​
No​
10000​
Watermark end time in milliseconds. Default is 0 (indicating it follows the video end time). Must be ≥ StartTime.​
Parent node: Watermark.​
Text​
Container​
No​
-​
Text watermark details. Required when Type is Text.​
Parent node: Watermark.​
FontSize​
Integer​
Yes​
100​
Font size in px, value range [5, 100].​
Parent node: Text.​
FontType​
​
String​
Yes​
fangzhengheiti​
Font types, supporting the following fonts:​
  • wqy-zenhei: WenQuanYi Zen Hei.​
  • wqy-microhei: WenQuanYi Micro Hei.​
  • fangzhengshusong: Fangzheng Shusong.​
  • fangzhengkaiti: Fangzheng KaitI.​
  • fangzhengheiti: Fangzheng HeiTi.​
  • fangzhengfangsong: Fangzheng Fangsong.​
  • droidsansfallback:DroidSansFallback.​
Parent node: Text.​
FontColor​
String​
Yes​
#FF0000​
Font color, hexadecimal RGB.​
Parent node: Text.​
Transparency​
Integer​
Yes​
20​
watermark opacity, unit %, range [1, 100].​
parent node: Text.​
Text​
String​
Yes​
hello world​
​
Watermark text content, no more than 64 characters, supports Chinese, English, numbers, underscore (_), hyphen (-), and asterisk (*).​
Parent node: Text.​
Image​
Container​
No​
-​
Image watermark details information. Type is required when Image .​
Parent node: Watermark .​
Url​
String​
Yes​
http://myhost.com/my-watermark-img​
The watermark image URL cannot be empty.​
Parent node: Image.​
Mode​
String​
Yes​
Fixed​
Size mode:​
  • Original: original size.​
  • Proportion: scale proportionally.​
  • Fixed: fixed size.​
Parent node: Image.​
Width​
​
Integer​
No​
3200​
Watermark image width:​
  • When Mode is Original, setting watermark image width is not supported.​
  • When Mode is Proportion, unit is %, background image range: [100 300]; foreground image range: [1 100], relative to video width, max not exceeding 4096 px.​
  • When Mode is Fixed, unit is px, value range: [8, 4096].​
  • If only Width is set, then Height is calculated based on the watermark image ratio.​
Parent node: Image.​
Height​
Integer​
No​
800​
Watermark image height:​
  • When Mode is Original, setting the watermark image height is not supported.​
  • When Mode is Proportion, the unit is %, background image value range: [100 300]; foreground image value range: [1 100], relative to video height, max not exceeding 4096 px.​
  • When Mode is Fixed, the unit is px, value range: [8, 4096].​
  • If only Height is set, Width is calculated according to the watermark image ratio.​
Transparency​
Integer​
Yes​
20​
Watermark opacity, in %, value range [1, 100].​
Parent node: Image.​
Background​
Bool​
No​
false​
Whether it is a background image, the values are as follows:​
  • true.​
  • false .​
Parent node: Image.​
​
Watermark location description​
​​​
Response headers​
The response contains common headers. For more information, see Common Parameters.​
Response body elements​
​
Name​
Type​
Example value​
Description​
template_id​
String​
393161343761366633396119012ee2450b08​
Unique ID for creating audio transcoding templates.​
​
Sample request​
Text watermark ​
​
PUT /?process_template&tag=Watermark HTTP/1.1​
Host: {BucketName}.tos-cn-beijing.volces.com​
Date: Fri, 30 Jul 2021 08:05:36 +0000​
Content-Type: application/json​
Content-Length: <length>​
Authorization: authorization string​
​
{​
"Tag": "Watermark", // fixed identifier​
"Name": "my-test-watermark", // user-defined name​
"WatermarkConfig": {​
"Type": "Text", // text watermark​
"Pos": "TopRight", // reference position​
"LocMode": "Relative", // offset method​
"Dx": 10, // horizontal offset​
"Dy": 10, // vertical offset​
"StartTime": 0, // watermark start time in milliseconds, default is 0​
"EndTime": 10000, // watermark end time in milliseconds, default 0 means video end time​
"Text": { // text watermark settings, effective when Type is Text​
"FontSize": 100, // font size​
"FontType": "fangzhengheiti", // font type​
"FontColor": "#FF0000", // font color​
"Transparency": 20, // opacity in %,​
"Text": "hello world" // watermark content​
}​
}​
}​
​
Image watermark​
​
PUT /?process_template&tag=Watermark HTTP/1.1​
Host: {BucketName}.tos-cn-beijing.volces.com​
Date: Fri, 30 Jul 2021 08:05:36 +0000​
Content-Type: application/json​
Content-Length: <length>​
Authorization: authorization string​
​
{​
"Tag": "Watermark", // fixed identifier​
"Name": "my-test-watermark", // user-defined name​
"WatermarkConfig": {​
"Type": "Image", // adding watermarks​
"Pos": "TopRight", // reference position​
"LocMode": "Relative", // offset method​
"Dx": 10, // horizontal offset​
"Dy": 10, // vertical offset​
"StartTime": 0, // watermark start time in milliseconds, default 0​
"EndTime": 10000, // watermark end time in milliseconds, default 0 means video end time​
"Image": { // image watermark settings, effective when Type is Image​
"Url": "http://myhost.com/my-watermark-img", // watermark image URL​
"Mode": "Fixed", // size mode​
"Width": 3200, // watermark image width​
"Height": 800, // watermark image height​
"Transparency": 20,// opacity, unit %​
"Background": false // whether background image​
}​
}​
}​
​
Sample response​
​
HTTP/1.1 200 OK​
Date: Fri, 30 Jul 2021 13:53:55 GMT​
Content-Type: application/json​
Content-Length: <length>​
Server: TosServer​
x-tos-id-2: 1e89f203jld00006-a444fd0​
x-tos-request-id: 1e89f203b2d00006-a444ed0​
​
393161343761366633396119012ee2450b08​
​
​
Last updated: 2026.06.24 15:01:30