Add watermark
curl --request POST \
--url https://api.pdfbase.dev/v1/pdfs/watermark \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {},
"text": {},
"image": {},
"pages": "<string>",
"layer": "<string>",
"output": "<string>"
}
'import requests
url = "https://api.pdfbase.dev/v1/pdfs/watermark"
payload = {
"source": {},
"text": {},
"image": {},
"pages": "<string>",
"layer": "<string>",
"output": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: {},
text: {},
image: {},
pages: '<string>',
layer: '<string>',
output: '<string>'
})
};
fetch('https://api.pdfbase.dev/v1/pdfs/watermark', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pdfbase.dev/v1/pdfs/watermark",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
],
'text' => [
],
'image' => [
],
'pages' => '<string>',
'layer' => '<string>',
'output' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pdfbase.dev/v1/pdfs/watermark"
payload := strings.NewReader("{\n \"source\": {},\n \"text\": {},\n \"image\": {},\n \"pages\": \"<string>\",\n \"layer\": \"<string>\",\n \"output\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pdfbase.dev/v1/pdfs/watermark")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {},\n \"text\": {},\n \"image\": {},\n \"pages\": \"<string>\",\n \"layer\": \"<string>\",\n \"output\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/pdfs/watermark")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {},\n \"text\": {},\n \"image\": {},\n \"pages\": \"<string>\",\n \"layer\": \"<string>\",\n \"output\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyEdit
Add watermark
Add a text or image watermark to an existing PDF.
POST
/
v1
/
pdfs
/
watermark
Add watermark
curl --request POST \
--url https://api.pdfbase.dev/v1/pdfs/watermark \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {},
"text": {},
"image": {},
"pages": "<string>",
"layer": "<string>",
"output": "<string>"
}
'import requests
url = "https://api.pdfbase.dev/v1/pdfs/watermark"
payload = {
"source": {},
"text": {},
"image": {},
"pages": "<string>",
"layer": "<string>",
"output": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: {},
text: {},
image: {},
pages: '<string>',
layer: '<string>',
output: '<string>'
})
};
fetch('https://api.pdfbase.dev/v1/pdfs/watermark', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pdfbase.dev/v1/pdfs/watermark",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
],
'text' => [
],
'image' => [
],
'pages' => '<string>',
'layer' => '<string>',
'output' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pdfbase.dev/v1/pdfs/watermark"
payload := strings.NewReader("{\n \"source\": {},\n \"text\": {},\n \"image\": {},\n \"pages\": \"<string>\",\n \"layer\": \"<string>\",\n \"output\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pdfbase.dev/v1/pdfs/watermark")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {},\n \"text\": {},\n \"image\": {},\n \"pages\": \"<string>\",\n \"layer\": \"<string>\",\n \"output\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/pdfs/watermark")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {},\n \"text\": {},\n \"image\": {},\n \"pages\": \"<string>\",\n \"layer\": \"<string>\",\n \"output\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyPhase
Phase 2Request
object
required
The PDF to watermark. One of:
{ "pdf_id": "pdf_abc123" }{ "url": "https://example.com/doc.pdf" }{ "base64": "JVBERi0x..." }
object
Text watermark config. Mutually exclusive with
image.content(string, required) — The watermark text, e.g., “CONFIDENTIAL”, “DRAFT”.font_size(integer, default: 48) — Font size in points.color(string, default: “#00000020”) — Color with alpha, hex format.rotation(number, default: -45) — Rotation in degrees.position(string, default: “center”) — One of:center,top-left,top-right,bottom-left,bottom-right.
object
Image watermark config. Mutually exclusive with
text.url(string) — URL to the watermark image (PNG, JPEG, SVG).base64(string) — Base64-encoded image. Use this orurl, not both.width(string, default: “200px”) — Image width.opacity(number, default: 0.1) — Range: 0.0 to 1.0.position(string, default: “center”) — Same options as text watermark.
string
default:"all"
Which pages to watermark.
"all", "1-3", "1,3,5", or "odd"/"even".string
default:"over"
over — watermark renders on top of content. under — watermark renders behind content.string
default:"url"
url or base64.Response
{
"id": "pdf_watermarked1",
"object": "pdf",
"status": "completed",
"url": "https://files.pdfbase.dev/pdf_watermarked1.pdf?token=sig_abc",
"pages": 10,
"bytes": 1280000,
"watermark": {
"type": "text",
"content": "CONFIDENTIAL",
"pages_applied": 10
},
"created_at": "2026-05-19T12:15:00Z",
"expires_at": "2026-05-20T12:15:00Z"
}
Example
curl -X POST https://api.pdfbase.dev/v1/pdfs/watermark \
-H "Authorization: Bearer pk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"source": { "pdf_id": "pdf_contract" },
"text": {
"content": "DRAFT",
"font_size": 72,
"color": "#FF000015",
"rotation": -45,
"position": "center"
},
"pages": "all",
"layer": "over",
"output": "url"
}'