API Reference
Complete REST API documentation for TruthMark watermarking service.
Base URL
https://api.truthmark.comFor development: http://localhost:8000
Authentication
Include your API key in the Authorization header for paid plans:
Authorization: Bearer YOUR_API_KEYFree tier doesn't require authentication.
POST /v1/encode
Embed an invisible watermark into an image.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file | multipart/form-data | Yes | Image file (PNG, JPG, JPEG) |
message | string | Yes | Text to embed (max 500 chars) |
Example Request
curl -X POST https://api.truthmark.com/v1/encode \
-F "file=@image.png" \
-F "message=Copyright 2025 - My Company"Response
{
"status": "success",
"metadata": {
"psnr": 42.5, // Quality metric (higher = better)
"bits_embedded": 256 // Number of bits embedded
},
"download_url": "https://api.truthmark.com/download/watermarked_abc123.png"
}POST /v1/decode
Extract watermark from an image.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file | multipart/form-data | Yes | Watermarked image file |
Example Request
curl -X POST https://api.truthmark.com/v1/decode \
-F "file=@watermarked.png"Response (Watermark Found)
{
"found": true,
"message": "Copyright 2025 - My Company",
"confidence": 0.85 // 0.0 to 1.0 (higher = more confident)
}Response (No Watermark)
{
"found": false,
"message": null,
"confidence": 0.0
}Error Handling
All errors return HTTP status codes with a JSON error response:
{
"detail": "Error message description"
}Common Error Codes
| Code | Meaning |
|---|---|
400 | Bad Request - Invalid parameters or file format |
401 | Unauthorized - Invalid or missing API key |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Server-side error |
Rate Limits
| Plan | Limit |
|---|---|
| Free | 10 requests/minute, 100 images/month |
| Starter | 60 requests/minute, 2,500 images/month |
| Professional | 300 requests/minute, 10,000 images/month |
| Business+ | Custom limits |