WebConv

API Documentation

Use our API to convert your images to WebP with optional watermark

Authentication required

An API token is required to use the service. Create an account to get your token.

Endpoint

POST /convert?token=YOUR_API_TOKEN&quality=85

Base parameters

token(required)

Your personal API token. Get it from your dashboard.

quality(optional, default: 85)

WebP image quality (0-100).

Watermark parameters

Option 1: Text watermark

watermark(optional)

Watermark text. E.g: "© MySite.com"

watermark_size(default: 24)

Font size (8-200).

watermark_color(default: white)

Color: white, black, red, blue, yellow, gray or hex (#FFFFFF).

Option 2: Image watermark

watermark_image(optional)

URL of an image to use as watermark (PNG, JPG). Transparent images are recommended.

Common parameters (text and image)

watermark_position(default: bottomRight)

Position: topLeft, topRight, bottomLeft, bottomRight, center

watermark_opacity(default: 50)

Opacity (0-100).

Required headers

  • - Content-Type: image/png, image/jpeg, image/jpg, image/gif, ou image/bmp

cURL Example - Simple conversion

curl -X POST "/convert?token=YOUR_API_TOKEN&quality=90" \
  -H "Content-Type: image/png" \
  --data-binary @image.png \
  -o converted.webp

cURL Example - Text watermark

curl -X POST "/convert?token=YOUR_API_TOKEN&quality=85\
&watermark=©%20MySite.com\
&watermark_position=bottomRight\
&watermark_size=32\
&watermark_color=white\
&watermark_opacity=70" \
  -H "Content-Type: image/png" \
  --data-binary @image.png \
  -o watermarked.webp

cURL Example - Image watermark

curl -X POST "/convert?token=YOUR_API_TOKEN&quality=85\
&watermark_image=https://example.com/logo.png\
&watermark_position=bottomRight\
&watermark_opacity=60" \
  -H "Content-Type: image/png" \
  --data-binary @image.png \
  -o watermarked.webp

JavaScript Example

const file = document.querySelector('input[type="file"]').files[0];
const apiToken = 'YOUR_API_TOKEN';

const params = new URLSearchParams({
  token: apiToken,
  quality: '85',
  watermark: '© MySite.com',
  watermark_position: 'bottomRight',
  watermark_size: '28',
  watermark_color: 'white',
  watermark_opacity: '60'
});

const response = await fetch(`/convert?${params}`, {
  method: 'POST',
  headers: { 'Content-Type': file.type },
  body: file,
});

const webpBlob = await response.blob();
const url = URL.createObjectURL(webpBlob);

Python Example

import requests
from urllib.parse import urlencode

params = {
    'token': 'YOUR_API_TOKEN',
    'quality': 90,
    'watermark': '© MySite.com',
    'watermark_position': 'bottomRight',
    'watermark_size': 32,
    'watermark_color': 'white',
    'watermark_opacity': 60
}

with open('image.png', 'rb') as f:
    response = requests.post(
        f'/convert?{urlencode(params)}',
        headers={'Content-Type': 'image/png'},
        data=f
    )

with open('watermarked.webp', 'wb') as f:
    f.write(response.content)

Responses

200 OK

Returns the converted WebP image (with watermark if requested)

400 Bad Request

Unsupported image format or invalid data

401 Unauthorized

Missing or invalid API token

405 Method Not Allowed

Only POST method is accepted

500 Internal Server Error

Conversion error

Important notes

  • - Authentication required: You must create an account to get an API token
  • - Quality values are automatically capped between 0 and 100
  • - High quality (90-100) produces better but heavier images
  • - A quality of 85 is a good quality/size compromise
  • - Supported formats: PNG, JPEG, JPG, GIF, BMP
  • - Watermark is optional and doesn't affect existing requests
  • - Conversion uses ImageMagick for optimal quality and watermark support
  • - Each conversion is tracked in your usage history