API 文档
使用我们的 REST API,轻松将 Passly 集成到您的应用中
基础 URL
所有请求都从该 URL 发出。无需密钥,无需注册。
120
请求 / 10 分钟
无需密钥
公开 API
v1
API 版本
…
响应时间
生产环境
https://passly.fr/api/v1接口
三个入口。展开其中之一即可查看参数、示例与响应。
速率限制
按 IP 地址计的配额保护着服务,响应头会告知您当前的用量。
每个 IP 的限制
每 10 分钟 120 次请求
响应头
X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-Reset
错误 429
达到限制时返回。Retry-After 响应头指示需等待的时间。
错误代码
每个错误都返回结构固定的 JSON,并附带可用于判断的代码。
400Bad Request
参数无效或缺失
{
"error": true,
"message": "长度必须在4到128个字符之间",
"code": "invalid_length"
}429Too Many Requests
已超出请求限制
{
"error": true,
"message": "已达到请求限制。请等待234秒",
"retry_after": 234,
"reset_at": "2026-01-15T10:35:00.000Z"
}500Internal Server Error
服务器内部错误
{
"error": true,
"message": "发生错误。请重试。"
}503Service Unavailable
服务维护中
{
"error": true,
"message": "网站目前正在维护中。请几分钟后再试。"
}在 code 字段中返回的代码
invalid_lengthinvalid_countinvalid_formatinvalid_wordsno_charsetempty_wordlist
集成示例
同一个调用,用您选择的语言。复制、粘贴、按需调整。
// PasslyClient.js
class PasslyClient {
constructor(baseURL = 'https://passly.fr/api/v1') {
this.baseURL = baseURL;
}
async generatePassword(options = {}) {
const response = await fetch(`${this.baseURL}/generate`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
length: options.length || 16,
count: options.count || 1,
lowercase: options.lowercase !== false,
uppercase: options.uppercase !== false,
digits: options.digits !== false,
special: options.special || false,
exclude_similar: options.excludeSimilar || false,
format: options.format || 'random'
})
});
if (!response.ok) {
throw new Error(`API Error: ${response.status}`);
}
return response.json();
}
async checkHealth() {
const response = await fetch(`${this.baseURL}/health`);
return response.json();
}
}
// Utilisation
const passly = new PasslyClient();
const result = await passly.generatePassword({
length: 24,
special: true,
excludeSimilar: true
});
console.log('Mot de passe:', result.data.passwords[0]);
console.log('Force:', result.data.strength);
console.log('Entropie:', result.data.entropy_bits, 'bits');