Docs
Skip to content

Avatars

User initials_

Generate avatar images from user names or initials with customizable appearance and dimensions.

2 min read

Raw

The user initials endpoint generates avatar images from names or initials. This is particularly useful for displaying user profiles when no profile picture is available, creating a consistent visual identity across your application.

Generate initials

Generate an avatar image from a user's name. The service automatically extracts initials from the name and displays them on a colored background.

Parameters

The getInitials method accepts the following parameters:

ParameterTypeDescription
namestringThe name to generate initials from. The service extracts the first letter of each word.
widthintegerThe width of the output image in pixels. Accepts values between 0-2000.
heightintegerThe height of the output image in pixels. Accepts values between 0-2000.
backgroundstringThe background color in hexadecimal format without the leading #. Defaults to a random color if not provided.

Customization

You can customize the appearance of the initials avatar by adjusting the dimensions and background color. The service automatically selects appropriate text color based on the background for optimal contrast.

Use cases

User initials avatars are commonly used in:

  • User profiles: Display avatars in user lists, comments, and profile pages when no profile picture is available
  • Team members: Show team member avatars in collaboration interfaces
  • Notifications: Display sender avatars in notification systems
  • Activity feeds: Show user avatars in activity and timeline views

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.