由种子的 SHA-256 决定对称图案和颜色,公开缓存 1 天。 访问类别:匿名 API,可携带 Token 使用独立额度
请求参数
seedquery必填- string · 最短:1 字符 · 最长:64 字符
sizequery- integer · 默认值:80 · 最小值:16 · 最大值:512
_formatquery- 响应格式为 svg、json 或 text。/color 默认 JSON,带 curl* 标记的接口默认 SVG。plain 是 text 的别名。未识别的值继续按 Accept 协商。
- string · 可选:svg、json、text
_colorquery- 控制 text 响应的 ANSI 颜色。0、false、off、no 关闭;省略或其他值保留。
- string · 可选:0、false、off、no
路径兼容入口
GET /identicon/{seed}
将 seed 的值进行 URL 编码后填入路径。
响应
image/svg+xml
{
"type": "string"
}application/json
{
"type": "object",
"properties": {
"svg": {
"type": "string"
}
},
"required": [
"svg"
],
"additionalProperties": {}
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}响应示例
默认响应是 SVG。下面另有 _format=json 的 JSON 响应。
成功响应
curl -sS https://oit.sh/identicon/octocatHTTP 200 content-type: image/svg+xml; charset=utf-8 content-encoding: gzip cache-control: public, max-age=86400 <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 7 7" role="img" aria-label="identicon octocat"><title>octocat</title><rect width="7" height="7" fill="#f4f4f5"/><g fill="hsl(80.5 55% 42%)" shape-rendering="crispEdges"><rect x="2" y="1" width="1" height="1"/><rect x="4" y="1" width="1" height="1"/><rect x="3" y="1" width="1" height="1"/><rect x="3" y="1" width="1" height="1"/><rect x="3" y="2" width="1" height="1"/><rect x="3" y="2" width="1" height="1"/><rect x="2" y="3" width="1" height="1"/><rect x="4" y="3" width="1" height="1"/><rect x="3" y="3" width="1" height="1"/><rect x="3" y="3" width="1" height="1"/><rect x="2" y="4" width="1" height="1"/><rect x="4" y="4" width="1" height="1"/><rect x="2" y="5" width="1" height="1"/><rect x="4" y="5" width="1" height="1"/><rect x="3" y="5" width="1" height="1"/><rect x="3" y="5" width="1" height="1"/></g></svg>
JSON 响应
curl -sS 'https://oit.sh/identicon/octocat?_format=json'HTTP 200
content-type: application/json
content-encoding: gzip
cache-control: public, max-age=86400
{
"seed": "octocat",
"size": 80,
"color": "hsl(80.5 55% 42%)",
"svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"80\" height=\"80\" viewBox=\"0 0 7 7\" role=\"img\" aria-label=\"identicon octocat\"><title>octocat</title><rect width=\"7\" height=\"7\" fill=\"#f4f4f5\"/><g fill=\"hsl(80.5 55% 42%)\" shape-rendering=\"crispEdges\"><rect x=\"2\" y=\"1\" width=\"1\" height=\"1\"/><rect x=\"4\" y=\"1\" width=\"1\" height=\"1\"/><rect x=\"3\" y=\"1\" width=\"1\" height=\"1\"/><rect x=\"3\" y=\"1\" width=\"1\" height=\"1\"/><rect x=\"3\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"3\" y=\"2\" width=\"1\" height=\"1\"/><rect x=\"2\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"4\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"3\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"3\" y=\"3\" width=\"1\" height=\"1\"/><rect x=\"2\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"4\" y=\"4\" width=\"1\" height=\"1\"/><rect x=\"2\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"4\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"3\" y=\"5\" width=\"1\" height=\"1\"/><rect x=\"3\" y=\"5\" width=\"1\" height=\"1\"/></g></svg>"
}错误示例
curl -sS -X PUT 'https://oit.sh/identicon?_format=json'HTTP 405
content-type: application/json
content-encoding: gzip
cache-control: no-store
{
"error": {
"code": "METHOD_NOT_ALLOWED",
"message": "接口不支持该请求方法"
}
}curl 访问示例
命令行默认返回 SVG,_format=text 得到纯文本。示例展示纯文本输出。
命令与输出
curl -sS 'https://oit.sh/identicon/octocat?_color=0&_format=text'HTTP 200 content-type: text/plain; charset=utf-8 content-encoding: gzip cache-control: public, max-age=86400 seed: octocat size: 80 color: hsl(80.5 55% 42%) svg: <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 7 7" role="img" aria-label="identicon octocat"><title>octocat</title><rect width="7" height="7" fill="#f4f4f5"/><g fill="hsl(80.5 55% 42%)" shape-rendering="crispEdges"><rect x="2" y="1" width="1" height="1"/><rect x="4" y="1" width="1" height="1"/><rect x="3" y="1" width="1" height="1"/><rect x="3" y="1" width="1" height="1"/><rect x="3" y="2" width="1" height="1"/><rect x="3" y="2" width="1" height="1"/><rect x="2" y="3" width="1" height="1"/><rect x="4" y="3" width="1" height="1"/><rect x="3" y="3" width="1" height="1"/><rect x="3" y="3" width="1" height="1"/><rect x="2" y="4" width="1" height="1"/><rect x="4" y="4" width="1" height="1"/><rect x="2" y="5" width="1" height="1"/><rect x="4" y="5" width="1" height="1"/><rect x="3" y="5" width="1" height="1"/><rect x="3" y="5" width="1" height="1"/></g></svg>
在线调试
curl -X GET 'https://oit.sh/identicon?seed=octocat'
响应
等待发送请求