Apply watermarks
Last updated Oct 12, 2026 You can add watermarks to videos uploaded using the Stream API.
To add watermarks to your videos, first create a watermark profile. A watermark profile describes the image you would like to be used as a watermark and the position of that image. Once you have a watermark profile, you can use it as an option when uploading videos.
Quick start
Watermark profile has many customizable options. However, the default parameters generally work for most cases. Please see "Profiles" below for more details.
Step 1: Create a profile
curl -X POST -H 'Authorization: Bearer <API_TOKEN>' \
-F file=@/Users/rchen/cloudflare.png \
https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/stream/watermarks
const client = new Cloudflare({
apiEmail: process.env['CLOUDFLARE_EMAIL'],
apiKey: process.env['CLOUDFLARE_API_KEY'],
});
const watermark = await client.stream.watermarks.create({
account_id: '<ACCOUNT_ID>',
file: '@/path/to/image.png',
name: 'marketing videos',
});
See the full Stream REST API and SDK reference for details on using REST API from external applications, with pre-generated SDK's for external TypeScript, Python, or Go applications.
export default {
async fetch(request, env, ctx): Promise<Response> {
const response = await fetch("https://example.com/cloudflare.png");
const readableStream = response.body!;
const watermark = await env.STREAM.watermarks.generate(readableStream, {
name: "marketing videos",
});
return new Response(JSON.stringify({ watermark }));
},
} satisfies ExportedHandler<{ STREAM: StreamBinding }>;
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "<ENTER_WORKER_NAME>",
"main": "src/index.ts",
"upload_source_maps": true,
"compatibility_date": "$today",
"observability": {
"enabled": true
},
"stream": {
"binding": "STREAM"
}
}
See the full Workers Stream binding API reference.
Step 2: Specify the profile UID at upload
tus-upload --chunk-size 5242880 \
--header Authentication 'Bearer <API_TOKEN>' \
--metadata watermark <WATERMARK_UID> \
/Users/rchen/cat.mp4 https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/stream
const client = new Cloudflare({
apiEmail: process.env['CLOUDFLARE_EMAIL'],
apiKey: process.env['CLOUDFLARE_API_KEY'],
});
const video = await client.stream.copy.create({
account_id: '<ACCOUNT_ID>',
url: 'https://example.com/video.mp4',
watermark: { uid: '<WATERMARK_UID>' },
});
See the full Stream REST API and SDK reference for details on using REST API from external applications, with pre-generated SDK's for external TypeScript, Python, or Go applications.
export default {
async fetch(request, env, ctx): Promise<Response> {
const video = await env.STREAM.upload(
"https://example.com/video.mp4",
{ watermarkId: "<WATERMARK_UID>" },
);
return new Response(JSON.stringify({ video }));
},
} satisfies ExportedHandler<{ STREAM: StreamBinding }>;
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "<ENTER_WORKER_NAME>",
"main": "src/index.ts",
"upload_source_maps": true,
"compatibility_date": "$today",
"observability": {
"enabled": true
},
"stream": {
"binding": "STREAM"
}
}
See the full Workers Stream binding API reference.
Step 3: Done

Profiles
To create, list, delete, or get information about the profile, you will need your Cloudflare API token ↗︎.
Optional parameters
namestring default: empty string- A short description for the profile. For example, "marketing videos."
opacityfloat default: 1.0- Translucency of the watermark. 0.0 means completely transparent, and 1.0 means completely opaque. Note that if the watermark is already semi-transparent, setting this to 1.0 will not make it completely opaque.
paddingfloat default: 0.05- Blank space between the adjacent edges (determined by position) of the video and the watermark. 0.0 means no padding, and 1.0 means padded full video width or length.
- Stream will make sure that the watermark will be at about the same position across videos with different dimensions.
scalefloat default: 0.15- The size of the watermark relative to the overall size of the video. This parameter will adapt to horizontal and vertical videos automatically. 0.0 means no scaling (use the size of the watermark as-is), and 1.0 fills the entire video.
- The algorithm will make sure that the watermark will look about the same size across videos with different dimensions.
positionstring (enum) default: "upperRight"- Location of the watermark. Valid positions are:
upperRight,upperLeft,lowerLeft,lowerRight, andcenter.
Note
Note that center will ignore the padding parameter.
Creating a Watermark profile
Use Case 1: Upload a local image file directly
To upload the image directly, please send a POST request using multipart/form-data as the content-type and specify the file under the file key. All other fields are optional.
curl -X POST -H "Authorization: Bearer <API_TOKEN>" \
-F file=@{path-to-image-locally} \
-F name='marketing videos' \
-F opacity=1.0 \
-F padding=0.05 \
-F scale=0.15 \
-F position=upperRight \
https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/stream/watermarks
const client = new Cloudflare({
apiEmail: process.env['CLOUDFLARE_EMAIL'],
apiKey: process.env['CLOUDFLARE_API_KEY'],
});
const watermark = await client.stream.watermarks.create({
account_id: '<ACCOUNT_ID>',
file: '@/path/to/image.png',
name: 'marketing videos',
opacity: 1.0,
padding: 0.05,
scale: 0.15,
position: 'upperRight',
});
See the full Stream REST API and SDK reference for details on using REST API from external applications, with pre-generated SDK's for external TypeScript, Python, or Go applications.
export default {
async fetch(request, env, ctx): Promise<Response> {
const response = await fetch("https://example.com/cloudflare.png");
const readableStream = response.body!;
const watermark = await env.STREAM.watermarks.generate(readableStream, {
name: "marketing videos",
opacity: 1.0,
padding: 0.05,
scale: 0.15,
position: "upperRight",
});
return new Response(JSON.stringify({ watermark }));
},
} satisfies ExportedHandler<{ STREAM: StreamBinding }>;
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "<ENTER_WORKER_NAME>",
"main": "src/index.ts",
"upload_source_maps": true,
"compatibility_date": "$today",
"observability": {
"enabled": true
},
"stream": {
"binding": "STREAM"
}
}
See the full Workers Stream binding API reference.
Use Case 2: Pass a URL to an image
To specify a URL for upload, please send a POST request using application/json as the content-type and specify the file location using the url key. All other fields are optional.
export default {
async fetch(request, env, ctx): Promise<Response> {
const watermark = await env.STREAM.watermarks.generate(
"https://example.com/logo.png",
{
name: "marketing videos",
opacity: 1.0,
padding: 0.05,
scale: 0.15,
position: "upperRight",
},
);
return new Response(JSON.stringify({ watermark }));
},
} satisfies ExportedHandler<{ STREAM: StreamBinding }>;
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "<ENTER_WORKER_NAME>",
"main": "src/index.ts",
"upload_source_maps": true,
"compatibility_date": "$today",
"observability": {
"enabled": true
},
"stream": {
"binding": "STREAM"
}
}
See the full Workers Stream binding API reference.
curl -X POST -H "Authorization: Bearer <API_TOKEN>" \
-H 'Content-Type: application/json' \
-d '{
"url": "{url-to-image}",
"name": "marketing videos",
"opacity": 1.0,
"padding": 0.05,
"scale": 0.15,
"position": "upperRight"
}' \
https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/stream/watermarks
const client = new Cloudflare({
apiEmail: process.env['CLOUDFLARE_EMAIL'],
apiKey: process.env['CLOUDFLARE_API_KEY'],
});
// The TypeScript SDK does not support URL-based watermark creation.
// Use the file-based approach instead:
const watermark = await client.stream.watermarks.create({
account_id: '<ACCOUNT_ID>',
file: '@/path/to/image.png',
name: 'marketing videos',
opacity: 1.0,
padding: 0.05,
scale: 0.15,
position: 'upperRight',
});
See the full Stream REST API and SDK reference for details on using REST API from external applications, with pre-generated SDK's for external TypeScript, Python, or Go applications.
Example response to creating a watermark profile
{
"result": {
"uid": "d6373709b7681caa6c48ef2d8c73690d",
"size": 11248,
"height": 240,
"width": 720,
"created": "2020-07-29T00:16:55.719265Z",
"downloadedFrom": null,
"name": "marketing videos",
"opacity": 1.0,
"padding": 0.05,
"scale": 0.15,
"position": "upperRight"
},
"success": true,
"errors": [],
"messages": []
}
downloadedFrom will be populated if the profile was created via downloading from URL.
Using a watermark profile on a video
Once you created a watermark profile, you can now use the profile at upload time for watermarking videos.
Basic uploads
Unfortunately, Stream does not currently support specifying watermark profile at upload time for Basic Uploads.
Upload video with a link
export default {
async fetch(request, env, ctx): Promise<Response> {
const video = await env.STREAM.upload(
"https://example.com/video.mp4",
{ watermarkId: "<WATERMARK_UID>" },
);
return new Response(JSON.stringify({ video }));
},
} satisfies ExportedHandler<{ STREAM: StreamBinding }>;
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "<ENTER_WORKER_NAME>",
"main": "src/index.ts",
"upload_source_maps": true,
"compatibility_date": "$today",
"observability": {
"enabled": true
},
"stream": {
"binding": "STREAM"
}
}
See the full Workers Stream binding API reference.
curl -X POST -H "Authorization: Bearer <API_TOKEN>" \
-H 'Content-Type: application/json' \
-d '{
"url": "{url-to-video}",
"watermark": {
"uid": "<WATERMARK_UID>"
}
}' \
https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/stream/copy
const client = new Cloudflare({
apiEmail: process.env['CLOUDFLARE_EMAIL'],
apiKey: process.env['CLOUDFLARE_API_KEY'],
});
const video = await client.stream.copy.create({
account_id: '<ACCOUNT_ID>',
url: 'https://example.com/video.mp4',
watermark: { uid: '<WATERMARK_UID>' },
});
See the full Stream REST API and SDK reference for details on using REST API from external applications, with pre-generated SDK's for external TypeScript, Python, or Go applications.
