← 开发者工具

生成头像

GET /avatars/generate

从种子字符串(如用户名或邮箱)生成唯一头像图片 URL。返回来自三种不同服务的 URL:DiceBear(17 种艺术风格,SVG/PNG)、UI Avatars(基于首字母)和 RoboHash(机器人/怪物)。相同的种子始终生成相同的头像,非常适合作为用户资料默认头像。

参数

seed 必填

Seed string (username, email, any text)

style 可选 默认: avataaars

DiceBear style name

size 可选 默认: 200

Image size in pixels

请求示例

基本用法
curl "https://nordapi.ee/api/v1/avatars/generate?seed=john_doe"
Avatar for a username
curl "https://nordapi.ee/api/v1/avatars/generate?seed=john_doe"
Pixel art style, large
curl "https://nordapi.ee/api/v1/avatars/generate?seed=jane&style=pixel-art&size=400"
Robot avatar from email
curl "https://nordapi.ee/api/v1/avatars/generate?seed=user@example.com&style=bottts"

实时响应

{
  "data": {
    "dicebear": "https://api.dicebear.com/9.x/avataaars/svg?seed=john_doe&size=200",
    "dicebear_png": "https://api.dicebear.com/9.x/avataaars/png?seed=john_doe&size=200",
    "robohash": "https://robohash.org/john_doe?size=200x200",
    "robohash_monster": "https://robohash.org/john_doe?set=set2&size=200x200",
    "robohash_robot_head": "https://robohash.org/john_doe?set=set3&size=200x200",
    "seed": "john_doe",
    "size": 200,
    "style": "avataaars",
    "ui_avatar": "https://ui-avatars.com/api/?name=john_doe&size=200&background=random&color=fff"
  },
  "success": true
}