If your website or app handles images, whether uploaded by users, pulled from external sources, or stored in your database, you’ve likely run into one recurring problem: watermarks. They can make images look unprofessional, distract from content, or even cause legal concerns when used without permission.
Instead of removing watermarks manually or asking users to use external tools, you can now offer a smarter, faster solution – integrate Dewatermark API directly into your platform.
In this guide, we’ll walk you through everything you need to know to successfully integrate the Dewatermark API into your website or app – from setup and authentication to code examples, and deployment tips.
The Dewatermark API is a lightweight, developer-friendly REST API that uses AI to detect and remove watermarks from images automatically. With just a few lines of code, you can process images on the fly, return clean results, and enhance the visual quality of your app’s content, without breaking your existing workflow.
What you need before you start: API setup essentials
Before you begin integrating the Dewatermark API into your website or app, make sure you have the following in place:
API key from Dewatermark
To use the API, you’ll need an API key. You can get one by signing up at https://dewatermark.ai. After logging in, go to your account dashboard to generate your API token.
Dewatermark offers free credits to help you test the API before committing to a paid plan.
Basic knowledge of APIs and HTTP requests
The Dewatermark API follows the REST architecture, which means you’ll interact with it using standard HTTP methods like POST. You should be comfortable making API calls from your backend or frontend (via a server-side proxy).
A working website or app
You’ll need a web or mobile application where image uploads or image links are available. This could be:
- A photo editor
- A CMS
- An e-commerce platform
- A custom dashboard or portal
- A development environment or backend stack
While you can use any tech stack, here are common ones that work well with Dewatermark API:
- Node.js (Express)
- Python (Flask, Django)
- PHP (Laravel, plain PHP)
- JavaScript (with server-side handling for API key protection)
- React / Vue (for frontend + backend interaction)
Once you’ve got your API key and dev setup ready, you’re all set to start integrating Dewatermark into your workflow.
Get your Dewatermark API key
To start using Dewatermark API in your project, the first step is to obtain your API key, which acts as your secure access token for making requests.
Where to get your API key ?
- Go to https://dewatermark.ai
- Sign up or log in to your account
- Navigate to your dashboard → Find your API key, then copy and save it securely
You may get free credits upon sign-up, allowing you to test the API without committing to a paid plan.
How the API key works ?
You’ll need to include the API key in your request headers when calling the Dewatermark endpoint. This key authenticates your requests and ensures only authorized users can access the API.
Here’s a sample of what the header looks like:
Authorization: YOUR_API_KEY_HERE
(Replace YOUR_API_KEY_HERE with your actual key)
You should keep your key safe:
- Never expose your API key in frontend code (JavaScript running in the browser).
- Always call the API from your backend server to protect your credentials.
- Rotate your key regularly if you suspect misuse.
Dewatermark API overview
Before jumping into implementation, it’s helpful to understand the structure of the Dewatermark API. Here’s a quick look at the core components you’ll be working with:
Base URL & main endpoint
All requests to the Dewatermark API should be sent to this base URL:
https://dewatermark.ai/api/object_removal/v1/erase_watermark
This endpoint handles both detection and removal of watermarks using AI, and returns a cleaned version of the image.
Supported image formats
The API supports the most common image file types: .jpg, .jpeg, .png
Authentication method
To authenticate, include your API key in the request headers using this format:
X-Api-Key: YOUR_API_KEY
Common parameters
You can send images to the API in two ways:
- Using an image URL:
{ “image_url”: “https://example.com/photo.jpg“}
- Using a base64-encoded image: {“image_base64″:”data:image/jpeg;base64,/9j/4AAQSk…”}
Only one of these fields is required per request.
Response format
On success, the API returns a JSON object like this:
{ “request_id”: “12345”,
“status”: “success”,
“result_url”: “https://dewatermark.ai/results/cleaned-image.jpg”}
You can use result_url to display the cleaned image in your app or download it directly.
Watermark API Integration step-by-step guide
Integrating the Dewatermark API into your website or app is straightforward. Depending on how you collect images from users or your system, you can choose one of the two most common integration flows.
Option 1: Upload from user device
This approach is ideal for platforms where users upload images directly (e.g., photo editors, CMS platforms, or dashboards).
Workflow:
- User uploads an image through a form or file input.
- The frontend sends the image (as base64 or a file buffer) to your backend.
- The backend sends a POST request to Dewatermark’s /erase_watermark endpoint, using the image_base64 parameter.
- The API processes the image and returns a result_url.
- Your backend returns that URL to the frontend to display or store.
Backend responsibilities:
- Accept file uploads
- Convert to base64 (if needed)
- Add your API key to request headers
- Return result_url from the Dewatermark API response
Option 2: Use image URL directly
If your app handles images hosted on cloud storage, social media, or external sources, you can pass the image URL directly to the API.
Workflow:
- Collect the direct URL of the image from the user or your database.
- Send the image URL to the API using the image_url parameter in the request body.
- Receive the result_url in the API response.
- Return it to your UI or save it as needed.
Best for: Admin tools; Image automation scripts; Content pipelines; Internal tooling
Feature | Upload method | Image URL method |
Image source | User-uploaded files | Hosted/external images |
Payload | image_base64 | image_url |
File handling | Required on backend | Lightweight |
Use case | Forms, editors | Scripts, auto-tasks |
Dewatermark API Sample code snippets
Below are working examples to help you connect to the Dewatermark API using different languages and frameworks. Each one shows how to send an image (via URL or base64) and receive a watermark-free result.
cURL (Quick test via terminal)
curl -X POST “https://dewatermark.ai/api/object_removal/v1/erase_watermark” \
-H “X-Api-Key: YOUR_API_KEY” \ -H “Content-Type: application/json” \ -d ‘{“image_url”:”https://example.com/sample.jpg”}’ |
Python (requests)
import requests
api_key = “YOUR_API_KEY” url = “https://dewatermark.ai/api/object_removal/v1/erase_watermark” payload = {“image_url”: “https://example.com/sample.jpg”} headers = { “X-Api-Key”: api_key, “Content-Type”: “application/json” } response = requests.post(url, json=payload, headers=headers) print(response.json()) |
Node.js (Express + Axios)
const express = require(‘express’);
const axios = require(‘axios’); const app = express(); app.use(express.json()); app.post(‘/api/remove-watermark’, async (req, res) => { const { imageUrl } = req.body; try { const apiRes = await axios.post( ‘https://dewatermark.ai/api/object_removal/v1/erase_watermark’, { image_url: imageUrl }, { headers: { ‘X-Api-Key’: process.env.DEWATERMARK_API_KEY } } ); res.json(apiRes.data); } catch (error) { res.status(500).json({ error: error.message }); } }); |
React (Frontend + backend connection)
// Frontend – sends image URL to your backend API
const removeWatermark = async () => { const res = await fetch(‘/api/remove-watermark’, { method: ‘POST’, headers: { ‘Content-Type’: ‘application/json’ }, body: JSON.stringify({ imageUrl: ‘https://example.com/sample.jpg’ }) }); const data = await res.json(); console.log(‘Clean image:’, data.result_url); }; |
Using base64 instead of URL
If you’re uploading an image directly and converting it to base64
{
“image_base64”: “data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA…” } |
Be sure to include the full data URI prefix (data:image/png;base64,) before the base64 string.
Error handling & best practices
To ensure a smooth and stable integration with Dewatermark API, it’s important to anticipate common errors and follow key best practices. This helps maintain performance, security, and user experience as your app scales.
Error code | Meaning | Fix |
401 Unauthorized | API key is missing or invalid | Double-check the X-Api-Key header |
415 Unsupported Media Type | Image format or request body is invalid | Use .jpg, .jpeg, or .png and ensure correct payload |
429 Too Many Requests | Rate limit exceeded | Wait and retry with backoff logic or request quota upgrade |
500 Internal Server Error | API issue or invalid input | Try again later; if persistent, contact support |
Example (Node.js)
try {
const res = await axios.post(apiUrl, payload, { headers }); return res.data; } catch (err) { if (err.response && err.response.status === 401) { console.error(“Invalid API key.”); } else if (err.response && err.response.status === 429) { console.error(“Rate limit hit. Please retry later.”); } else { console.error(“Something went wrong:”, err.message); } } |
Best practices for integration
- Never expose your API key on the frontend
Use a backend proxy or middleware to keep your key secure.
- Validate image input before sending
Make sure users aren’t uploading corrupted, oversized, or unsupported files.
- Add fallback logic for failed requests
Let users know if watermark removal fails and offer retry or manual cleanup options.
- Optimize for async workflows if handling batches
For large volumes of images, consider using a queue-based or asynchronous processing system to avoid timeouts and rate limits.
- Log request status and monitor API responses
Track errors and response times so you can spot issues early and adjust your usage pattern.
- Respect user privacy
Only send images users have consented to process. Dewatermark auto-deletes files within 1 hour, but always follow ethical file handling practices.
Testing & deployment tips
Before you roll out your Dewatermark API integration to real users, make sure you’ve thoroughly tested your setup and built it with stability, privacy, and scale in mind.
Testing checklist
- Test with multiple image types
Try a variety of images, different sizes, formats, lighting, and watermark styles, to ensure the API performs consistently across use cases.
- Validate both image_url and image_base64 methods
Make sure both payload options work if you support them. Confirm that files render correctly after processing.
- Simulate failures
Force scenarios like invalid URLs, missing headers, and unsupported file types to check how your app responds.
- Monitor response times
Track how quickly images are processed and how long the API takes under different conditions (e.g., large files, peak hours).
Deployment tips
Use environment variables for your API key
Never hardcode your key into your codebase. Store it in .env files or cloud service secrets (e.g., AWS Secrets Manager, Vercel environment variables).
Add background job handling (optional)
If you’re processing a large number of images or building a bulk-processing tool, use a job queue like:
- Bull (Node.js)
- Celery (Python)
- Laravel Queues (PHP)
This avoids blocking requests and improves UX.
Set up logging & usage tracking
Log every Dewatermark request (status, request ID, timestamps) to help with debugging, usage tracking, and optimizing API credit use.
Implement retry logic
In case of temporary errors (like rate limits), use exponential backoff retry logic to automatically reattempt the request.
Integrating the Dewatermark API into your website or app unlocks a powerful, AI-driven solution for automatic watermark removal—without the need for manual editing or third-party tools. Whether you’re building an image editor, a content platform, or an automation tool, Dewatermark helps you streamline your workflow and deliver cleaner visuals to your users.
With just a few lines of code, you can send images via URL or base64, receive high-quality results in seconds, and maintain full control over your integration—all while keeping user data secure and respecting privacy.
Ready to give it a try?
- Explore the full documentation: https://dewatermark.ai/api-document
- Check pricing and free credit limits: https://dewatermark.ai/api-pricing