API Endpoints
Explore and test our RESTful endpoints that provide random avatar images for your applications.
Random Avatar
Returns a random avatar image from all available avatars.
https://avaris.hackslab.uz/all
Example:
fetch('https://avaris.hackslab.uz/all')
.then(response => response.blob())
.then(blob => {
const imgUrl = URL.createObjectURL(blob);
document.querySelector('img').src = imgUrl;
});JavaScript
Male Avatar
Returns a random male avatar image.
https://avaris.hackslab.uz/male
Example:
fetch('https://avaris.hackslab.uz/male')
.then(response => response.blob())
.then(blob => {
const imgUrl = URL.createObjectURL(blob);
document.querySelector('img').src = imgUrl;
});JavaScript
Female Avatar
Returns a random female avatar image.
https://avaris.hackslab.uz/female
Example:
fetch('https://avaris.hackslab.uz/female')
.then(response => response.blob())
.then(blob => {
const imgUrl = URL.createObjectURL(blob);
document.querySelector('img').src = imgUrl;
});JavaScript
HTML Usage
You can directly use the API endpoints as image sources in your HTML projects:
<img src="https://avaris.hackslab.uz/all" alt="Random Avatar">
<img src="https://avaris.hackslab.uz/male" alt="Male Avatar">
<img src="https://avaris.hackslab.uz/female" alt="Female Avatar">HTML
Tip: For production use, you may want to add error handling to handle cases when the API might be unavailable.
Notes
- All images are returned in PNG format
- If an invalid endpoint is provided, a 404 error will be returned
- If there's an error generating the avatar, a 500 error will be returned