Basics
A random avatar, 150px (the default size):
https://avatarmelayu.com/i
Set the size in pixels (16 to 1000, always square):
https://avatarmelayu.com/i/300
Parameters
| Parameters | Values | Effect |
|---|---|---|
img | 1, 2, … | A specific avatar by its public ID (see the gallery). |
u | any text | The same text always gives the same avatar. |
g | lelaki, perempuan, gabungan | Filter by gender. |
cat | bertudung, bersongkok, profesional, pelajar, kanak-kanak, warga-emas, baju-melayu | Filter by category. |
fmt | jpg, webp, png | Image format. Default: WebP for browsers that support it, JPG otherwise. |
shape | circle | A round avatar with a transparent background (PNG or WebP). |
Combined example:
https://avatarmelayu.com/i/200?g=perempuan&cat=tudung&fmt=webp&shape=circle
If no avatar matches the filters, a random one is returned so your design never breaks.
Consistent avatars
For user lists in a mockup, use the email or user ID as u. Everyone gets their own face, and it stays the same on every page load.
https://avatarmelayu.com/i/64?u=aina@contoh.my
https://avatarmelayu.com/i/64?u=user-42
Initials avatars
Need an avatar without a photo? Generate an SVG initials avatar from a name:
https://avatarmelayu.com/i/initials/Ali%20Bakar?size=150&bg=2563eb&color=ffffff&shape=circle
Code examples
HTML
<img src="https://avatarmelayu.com/i/150?img=3" width="150" height="150" alt="Avatar">
Laravel Blade
<img src="https://avatarmelayu.com/i/64?u={{ urlencode($user->email) }}" alt="{{ $user->name }}">
React
const Avatar = ({ user }) => (
<img src={`https://avatarmelayu.com/i/64?u=${encodeURIComponent(user.email)}`} alt={user.name} />
);
Vue
<img :src="`https://avatarmelayu.com/i/64?u=${user.id}`" :alt="user.name" />
CSS
.hero { background-image: url("https://avatarmelayu.com/i/600?img=4"); }
JSON API
A paginated list of published avatars. Supports g, cat and per_page (up to 100).
GET https://avatarmelayu.com/api/avatars?g=lelaki&per_page=10
GET https://avatarmelayu.com/api/avatars/3
{
"data": [
{ "id": 3, "name": "…", "gender": "lelaki", "category": "songkok",
"url": "https://avatarmelayu.com/i/300?img=3", "license": "CC0-1.0" }
],
"meta": { "current_page": 1, "last_page": 3, "per_page": 10, "total": 26 }
}
Limits & caching
- A rate limit applies per IP. Go over it and you get HTTP 429 for a moment.
- URLs with img or u are cached for a day and revalidated with an ETag, so an updated picture shows within a day. Random URLs are not cached, so each img tag gets a different face. ID numbers are never reused.
- Partners can ask for an API key with a higher limit; send it as the X-Api-Key header or ?key=.
License & ethics
Every avatar is AI-generated and does not depict a real person. Avatars are licensed CC0 for use as placeholders in mockups, prototypes and demos. Do not use them to impersonate anyone or in a misleading context. If an avatar resembles a real person, it can be reported for removal.