API for Brokers
Lightweight watermarking tool
Endpoints
Choose one endpoint based on how you want to receive your watermarked file:
Get File Back
MOST POPULARReturns watermarked PDF directly
Get Link Back
Returns secure link to access file
Authentication & Headers
Include the API key in your Authorization header:
Authorization: Bearer aqua-api-watermark-10182013040420111015
Request Format
The API accepts files in three ways:
Method 1: File Upload - Send multipart/form-data with your file
Method 2: File URL (Form Data) - Send multipart/form-data with file_url field
Method 3: File URL (JSON) - Send application/json with file_url in body
POST https://aquamark-decrypt.onrender.com/watermark Method 1 - File Upload: • file: PDF file (multipart/form-data) • user_email: [email protected] Method 2 - File URL (Form Data): • file_url: Publicly accessible URL (multipart/form-data) • user_email: [email protected] Method 3 - File URL (JSON): • file_url: Publicly accessible URL (application/json body) • user_email: [email protected] Required authentication: • Authorization: Bearer aqua-api-watermark-10182013040420111015 Supported formats: PDF only
Usage Examples
Method 1: File Upload
Browser/Frontend:
const formData = new FormData(); formData.append('file', yourPdfFile); formData.append('user_email', '[email protected]'); const response = await fetch('https://aquamark-decrypt.onrender.com/watermark', { method: 'POST', headers: { 'Authorization': 'Bearer aqua-api-watermark-10182013040420111015' // Content-Type is automatically set by browser for FormData }, body: formData }); if (response.ok) { const watermarkedFile = await response.blob(); // This blob IS your watermarked file - use it however needed } else { const errorMessage = await response.text(); console.error('Error:', errorMessage); }
Node.js Server:
const FormData = require('form-data'); const form = new FormData(); form.append('file', fs.createReadStream('document.pdf')); form.append('user_email', '[email protected]'); const response = await fetch('https://aquamark-decrypt.onrender.com/watermark', { method: 'POST', headers: { 'Authorization': 'Bearer aqua-api-watermark-10182013040420111015', ...form.getHeaders() // Required: Include form headers in Node.js }, body: form }); if (response.ok) { const watermarkedFile = await response.buffer(); // This buffer IS your watermarked file - use it however needed }
Method 2: File URL (Form Data)
Browser/Frontend:
const formData = new FormData(); formData.append('file_url', 'https://example.com/document.pdf'); formData.append('user_email', '[email protected]'); const response = await fetch('https://aquamark-decrypt.onrender.com/watermark', { method: 'POST', headers: { 'Authorization': 'Bearer aqua-api-watermark-10182013040420111015' // Content-Type is automatically set by browser for FormData }, body: formData }); if (response.ok) { const watermarkedFile = await response.blob(); // This blob IS your watermarked file - use it however needed } else { const errorMessage = await response.text(); console.error('Error:', errorMessage); }
Node.js Server:
const FormData = require('form-data'); const form = new FormData(); form.append('file_url', 'https://example.com/document.pdf'); form.append('user_email', '[email protected]'); const response = await fetch('https://aquamark-decrypt.onrender.com/watermark', { method: 'POST', headers: { 'Authorization': 'Bearer aqua-api-watermark-10182013040420111015', ...form.getHeaders() // Required: Include form headers in Node.js }, body: form }); if (response.ok) { const watermarkedFile = await response.buffer(); // This buffer IS your watermarked file - use it however needed }
Method 3: File URL (JSON)
Browser/Frontend:
const response = await fetch('https://aquamark-decrypt.onrender.com/watermark', { method: 'POST', headers: { 'Authorization': 'Bearer aqua-api-watermark-10182013040420111015', 'Content-Type': 'application/json' }, body: JSON.stringify({ file_url: 'https://example.com/document.pdf', user_email: '[email protected]' }) }); if (response.ok) { const watermarkedFile = await response.blob(); // This blob IS your watermarked file - use it however needed } else { const errorMessage = await response.text(); console.error('Error:', errorMessage); }
Node.js Server:
const response = await fetch('https://aquamark-decrypt.onrender.com/watermark', { method: 'POST', headers: { 'Authorization': 'Bearer aqua-api-watermark-10182013040420111015', 'Content-Type': 'application/json' }, body: JSON.stringify({ file_url: 'https://example.com/document.pdf', user_email: '[email protected]' }) }); if (response.ok) { const watermarkedFile = await response.buffer(); // This buffer IS your watermarked file - use it however needed }
Response Handling
File Endpoint (/watermark): Returns watermarked PDF as binary data
Link Endpoint (/watermark-link): Returns JSON with shareable link that expires in 14 days
File Endpoint Response
// Browser - File endpoint returns binary data if (response.ok) { const pdfBlob = await response.blob(); // Option 1: Download the file const url = URL.createObjectURL(pdfBlob); const a = document.createElement('a'); a.href = url; a.download = 'watermarked-document.pdf'; a.click(); // Option 2: Display in iframe document.getElementById('pdfViewer').src = url; // Option 3: Upload to your server const formData = new FormData(); formData.append('watermarked_pdf', pdfBlob, 'document.pdf'); // ... send to your backend } // Node.js - File endpoint returns binary data if (response.ok) { const pdfBuffer = await response.buffer(); // Save to file system fs.writeFileSync('watermarked-document.pdf', pdfBuffer); // Or send as response in your API res.setHeader('Content-Type', 'application/pdf'); res.send(pdfBuffer); }
Link Endpoint JSON Response
{ "success": true, "links": [ { "linkId": "12345", "fileName": "document-protected-LenderName.pdf", "originalName": "document.pdf", "shareableUrl": "https://aquamark-decrypt.onrender.com/view/12345", "expiresAt": "2025-09-28T14:30:00.000Z", "fileType": "pdf" } ], "message": "Successfully created 1 shareable link" }
Response Codes
API returns appropriate HTTP status codes with plain text error messages:
Success: 200 OK - Returns watermarked PDF as binary data (application/pdf) Errors: 401 Unauthorized - "Invalid API key." 400 Bad Request - "Missing user_email" or "Missing file or file_url" 402 Payment Required - "Free trial has expired" 500 Internal Server Error - "Failed to process watermark: [error details]"
Important Notes
- Response format: File endpoint returns binary PDF data (use .blob() or .buffer()), Link endpoint returns JSON
- Error responses: Plain text messages (use .text() to read errors)
- Content-Type headers: Browser sets automatically for form data; Node.js needs form.getHeaders(); JSON method requires setting Content-Type manually
- File sources: Supports uploads, URLs, CRM attachments, database blobs
- File URLs: Must be publicly accessible (no authentication required)
- Format support: PDF files only - other formats not supported
- Branding: Testing uses Aquamark branding; replace user_email with your registered email to use your brand
- Request flexibility: Both endpoints support file uploads AND file URLs