← Back to Home

API Documentation

Simple, fast, and free avatar API for your applications.

Getting Started

MyAvatar provides a simple HTTP API to generate consistent avatars based on email addresses. It's a drop-in replacement for Gravatar.

API Endpoint

GET https://myavatar.onlc.eu/avatar/{hash}

Parameters

Usage Examples

HTML Example

<img src="https://myavatar.onlc.eu/avatar/205e460b479e2e5b48aec07710c08d50" alt="MyAvatar" />

PHP Example

$email = "[email protected]";
$hash = md5(strtolower(trim($email)));
$avatarUrl = "https://myavatar.onlc.eu/avatar/" . $hash;

echo '<img src="' . $avatarUrl . '" />';

JavaScript Example

import md5 from 'md5'; // You need an MD5 library

const email = "[email protected]";
const hash = md5(email.trim().toLowerCase());
const avatarUrl = `https://myavatar.onlc.eu/avatar/${hash}`;

const img = document.createElement('img');
img.src = avatarUrl;
document.body.appendChild(img);

Performance & Caching

Avatars are cached by the browser for 1 hour and by our CDN for 1 month. They are generated as optimized SVGs for infinite scalability.