API Reference

Complete REST API documentation for TruthMark watermarking service.

Base URL

https://api.truthmark.com

For development: http://localhost:8000

Authentication

Include your API key in the Authorization header for paid plans:

Authorization: Bearer YOUR_API_KEY

Free tier doesn't require authentication.

POST /v1/encode

Embed an invisible watermark into an image.

Request Parameters

ParameterTypeRequiredDescription
filemultipart/form-dataYesImage file (PNG, JPG, JPEG)
messagestringYesText 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

ParameterTypeRequiredDescription
filemultipart/form-dataYesWatermarked 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

CodeMeaning
400Bad Request - Invalid parameters or file format
401Unauthorized - Invalid or missing API key
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Server-side error

Rate Limits

PlanLimit
Free10 requests/minute, 100 images/month
Starter60 requests/minute, 2,500 images/month
Professional300 requests/minute, 10,000 images/month
Business+Custom limits