cURL
curl "https://api.ruseo.cn/api/captcha?type=mix&length=4&width=150&height=50&format=base64&key=login_123"
生成图形验证码,支持数字、字母、混合、算术题等多种类型,可自定义尺寸和长度。返回Base64编码的图片,可用于登录、注册等场景的验证码功能。
https://api.ruseo.cn/api/captcha
接口调用前需要确认的核心配置。
/api/captchacaptcha必填参数必须传入,示例值可直接用于联调。
免费API不强制要求API Key,但如果您希望统计个人调用次数,请在请求时附加参数 key=您的API_KEY。
注册账号后即可获得API Key。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
key |
否 | string | 可选参数:携带此参数可统计您的个人调用次数。请注册账号获取API Key。 | YOUR_API_KEY |
type |
否 | string | 验证码类型:num(纯数字)、alpha(纯字母)、mix(数字+字母)、math(算术题) | mix |
length |
否 | int | 验证码长度,范围1-10 | 4 |
width |
否 | int | 图片宽度,范围60-500像素 | 150 |
height |
否 | int | 图片高度,范围20-200像素 | 50 |
format |
否 | string | 返回格式:base64(默认)、json | base64 |
key |
否 | string | 验证码标识,用于后续验证,建议传入唯一标识如用户ID或session | login_123 |
优先使用示例地址测试请求参数是否正确。
https://api.ruseo.cn/api/captcha?type=mix&length=4&width=150&height=50&format=base64&key=login_123
curl "https://api.ruseo.cn/api/captcha?type=mix&length=4&width=150&height=50&format=base64&key=login_123"
$url = 'https://api.ruseo.cn/api/captcha?type=mix&length=4&width=150&height=50&format=base64&key=login_123';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('https://api.ruseo.cn/api/captcha?type=mix&length=4&width=150&height=50&format=base64&key=login_123')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "captcha",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
code |
integer | 业务状态码,0 表示请求成功。 | 0 |
msg |
string | 接口调用结果说明。 | success |
data |
object | 接口返回的业务数据。 | {} |
点击左侧“发送请求”查看结果...