Avatar API Documentation

This API generates SVG avatars based on initials and custom parameters.

📌 Usage

Make a GET request to:

/avatar?name=Full+Name&backgroundColor=008080

🔹 Example Response

Request:

GET /avatar?name=Full+Name&backgroundColor=008080

Response: An SVG image URL with initials.

⚙️ Query Parameters

Parameter Default Description Example
name (Required) The text used for initials. Full Name
backgroundColor Random Background color (hex, rgb). 008080
backgroundOpacity 1 Opacity of background (0 to 1). 0.5
fontFamily Verdana Font used for initials. Arial
fontSize 50 Font size in percentage. 60
fontWeight 400 Font weight (100-900). 700
chars 2 Number of initials (1-2). 1
radius 0 Corner radius (0 = square, 50 = rounded). 50
size 100 Image size in pixels. 200

🎨 Example Image

Generated image for name=Full Name:

Generated Avatar

🚀 How to Integrate

Use it in an img tag:

<img src="/avatar?name=Full+Name&backgroundColor=008080" />

Or fetch it via JavaScript:


fetch('/avatar?name=Full+Name&backgroundColor=008080')
    .then(response => response.blob())
    .then(imageBlob => {
        const imageURL = URL.createObjectURL(imageBlob);
        document.getElementById("avatar").src = imageURL;
    });
    

📩 Support

If you have any issues, feel free to contact support.