AI Watermark Removal API: curl, Python and Node.js Examples
· 5 min read
If you’re still deciding whether you need an API at all, start with the bulk removal overview. This page is the code. The Unmarkr API has one endpoint and two modes: standard strips the metadata and answers right away, and full also removes the visible logo and SynthID as a background job you poll.
What you need
- An API key from your dashboard. Keys start with
unmarkr_live_and go in anAuthorization: Bearerheader. - Credits. A standard clean costs 1 credit and a full removal costs 4. If a full removal fails, the credits come back automatically.
- PNG, JPG or WebP files up to 25 MB.
Strip the metadata (standard mode)
This is the cheap call. It removes C2PA Content Credentials, the “Made with AI” tag and EXIF/XMP data, leaves the pixels alone, and sends the cleaned image back in the response body.
curl -X POST https://unmarkr.io/api/remove \
-H "Authorization: Bearer $UNMARKR_KEY" \
-F image=@photo.png \
-F mode=standard \
-o photo-clean.pngThe X-Unmarkr-Removed response header lists what came off, or says none if the file was already clean.
Remove SynthID too (full mode)
Full mode takes 15 to 90 seconds, so the request doesn’t wait for it. You get a 202 with a job id straight away. Poll /api/jobs/<id> until the status is done, then download the image from /api/jobs/<id>/result. Use the same key for all three calls.
Python
import os, time, requests
API = "https://unmarkr.io"
H = {"Authorization": "Bearer " + os.environ["UNMARKR_KEY"]}
with open("gemini.png", "rb") as f:
r = requests.post(API + "/api/remove", headers=H,
files={"image": f}, data={"mode": "full"})
r.raise_for_status()
job = r.json() # {"jobId", "status": "processing", "poll", "result"}
while True:
s = requests.get(API + job["poll"], headers=H).json()
if s["status"] == "done":
break
if s["status"] == "error":
raise RuntimeError(s.get("error")) # credits were refunded
time.sleep(5)
out = requests.get(API + job["result"], headers=H)
with open("gemini-clean.png", "wb") as f:
f.write(out.content)Node.js (18 or later)
import { readFile, writeFile } from "node:fs/promises";
const API = "https://unmarkr.io";
const headers = { Authorization: "Bearer " + process.env.UNMARKR_KEY };
const form = new FormData();
form.append("image", new Blob([await readFile("gemini.png")]), "gemini.png");
form.append("mode", "full");
const res = await fetch(API + "/api/remove", { method: "POST", headers, body: form });
const job = await res.json();
let status = "processing";
while (status === "processing") {
await new Promise((r) => setTimeout(r, 5000));
const s = await (await fetch(API + job.poll, { headers })).json();
status = s.status;
if (status === "error") throw new Error(s.error); // credits were refunded
}
const out = await fetch(API + job.result, { headers });
await writeFile("gemini-clean.png", Buffer.from(await out.arrayBuffer()));The errors you’ll actually hit
401: the key is missing, mistyped or revoked.402: not enough credits. Full mode needs 4.413: the file is over 25 MB.429: you went over the per-key rate limit. Wait the number of seconds inRetry-After. TheRateLimitheader on every response tells you how close you are.
Every field is documented in the API docs, and there’s a machine-readable OpenAPI spec if you’d rather generate a client. Only send images you own or have the right to edit.
Try one image in the browser first
Drop an image into Unmarkr to see what it carries before you wire up the API. The check is free.
Check an image — free