Adorable Avatars Public API - Generate Unique Avatars for Your Applications

Adorable Avatars is a public API that helps you generate unique avatars for your applications. The API is simple to use and requires no authentication or registration. Simply make use of the API endpoint and specify a unique identifier, and the API will generate a unique avatar for you.

How to Use the Adorable Avatars Public API

Basic Usage

To use the Adorable Avatars public API, include the following endpoint in your code:

https://api.adorable.io/avatars/[size]/[identifier].png

Replace [size] with the desired size of the avatar (max size 512). Replace [identifier] with a unique identifier that represents the user or entity for which you want to generate the avatar.

For example:

const avatarImg = document.createElement('img');
const identifier = 'johndoe';

avatarImg.src = `https://api.adorable.io/avatars/256/${identifier}.png`;

document.body.appendChild(avatarImg);

This code creates a new img element, specifies an identifier of "johndoe", sets the src attribute to the Adorable Avatars API endpoint, and adds the img element to the DOM.

Avatar Shapes

By default, the Adorable Avatars API will generate rounded avatars. If you want to generate avatars with different shapes, simply append /shape to the endpoint https://api.adorable.io/avatars/[size]/[identifier].png.

For example, to generate an avatar with a square shape, use:

const avatarImg = document.createElement('img');
const identifier = 'janedoe';

avatarImg.src = `https://api.adorable.io/avatars/256/${identifier}/square.png`;

document.body.appendChild(avatarImg);

Avatar Colors

You can also specify a custom background color for your avatars. To do this, append /[color] to the endpoint https://api.adorable.io/avatars/[size]/[identifier].png.

For example, to generate an avatar with a blue background, use:

const avatarImg = document.createElement('img');
const identifier = 'janedoe';

avatarImg.src = `https://api.adorable.io/avatars/256/${identifier}/blue.png`;

document.body.appendChild(avatarImg);

Avatar Sets

In addition to generating avatars using unique identifiers, Adorable Avatars also allows you to generate sets of avatars. To do this, append /set/[set_number] to the endpoint https://api.adorable.io/avatars/[size]/[identifier].png.

For example, to generate a set of 10 avatars in random colors, use:

for (let i = 1; i <= 10; i++) {
    const avatarImg = document.createElement('img');
    avatarImg.src = `https://api.adorable.io/avatars/256/set${i}.png`;

    document.body.appendChild(avatarImg);
}

Conclusion

The Adorable Avatars public API is a simple and effective way to generate unique avatars for your applications. By leveraging the API's endpoint and various optional parameters, you can customize and generate avatars in a variety of styles and colors to fit your application's needs.

Related APIs