Welcome to the TextWatermark Quickstart Guide! This document will walk you through the essential steps to begin embedding and decoding watermarks using our API.
1. Prerequisites
- TextWatermark Account & API Key: You'll need an active account and an API key. If you don't have one, please sign up. Your API key can be found in your account dashboard.
- HTTP Client: A tool capable of making HTTP requests, such as
cURL
, Postman, or an HTTP library in your preferred programming language (e.g., Python'srequests
, Node.js'saxios
).
2. Authentication
All TextWatermark API requests must be authenticated. We use API keys passed as Bearer
tokens in the Authorization
header.
Include the following header in your requests, replacing YOUR_API_KEY
with your actual API key:
Authorization: Bearer YOUR_API_KEY
Refer to the Authentication section for more details.
3. Encoding Your First Watermark
Let's embed a secret message (payload) into a piece of visible text.
- Endpoint:
POST /api/v1/encode
- Content-Type:
application/json
Example Request Body:
{
"original_text": "This is a public document that needs to be tracked.",
"payload": "user_id:XYZ123_doc_id:ABC789"
}
Example cURL
Command:
curl -X POST https://api.textwatermark.com/api/v1/encode \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"original_text": "This is a public document that needs to be tracked.",
"payload": "user_id:XYZ123_doc_id:ABC789"
}'
Expected Successful Response (200 OK):
{
"status": "success",
"watermarked_text": "Thįs įs a pųblįc dőcųmęnt thåt nęęds tő bę tråckęd."
}
Note: The watermarked_text
above is illustrative. The
actual output will contain invisible zero-width characters encoding your payload. It
might appear identical or very similar to the original text.
4. Decoding a Watermark
Now, let's extract the hidden payload from the watermarked text you received.
- Endpoint:
POST /api/v1/decode
- Content-Type:
application/json
Example Request Body: (Use the watermarked_text
from the encode response)
{
"watermarked_text": "Thįs įs a pųblįc dőcųmęnt thåt nęęds tő bę tråckęd."
}
Example cURL
Command:
curl -X POST https://api.textwatermark.com/api/v1/decode \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"watermarked_text": "Thįs įs a pųblįc dőcųmęnt thåt nęęds tő bę tråckęd."
}'
Expected Successful Response (200 OK):
{
"status": "success",
"payload": "user_id:XYZ123_doc_id:ABC789",
"payload_detected": true
}
If no watermark is found, or it's corrupted, the payload
might be null
and
payload_detected
will be false
.
5. Next Steps
Congratulations! You've successfully encoded and decoded your first watermark.
To further explore the TextWatermark API, check out these resources:
- API Endpoints: Detailed descriptions of all available endpoints.
- Authentication: In-depth guide on API key management and security.
- SDKs: Find client libraries for your favorite programming languages.
- API Overview & Concepts: Revisit the core concepts behind our watermarking technology.