本 API 提供高性能的验证码识别服务,支持多种类型的验证码识别。
https://captchaapi.com/api/v1/captcha.phpAPI Key 认证,保障数据安全
只有识别成功才扣费
记录所有请求,可追溯查询
使用 API Key 进行认证,支持两种传递方式:
X-API-Key: your_api_key_here
{
"api_key": "your_api_key_here",
// 其他参数...
}
功能:验证码识别
描述:上传验证码图片,返回识别结果
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
api_key |
string | 是 | API 密钥 | ak_1234567890... |
image |
string | 是 | Base64 编码的图片 | iVBORw0KGgo... |
type |
integer | 是 | 验证码类型(分组ID) 查看所有类型 → | 10001 |
{
"code": 200,
"msg": "识别成功",
"data": {
"result": "8", // 识别结果
"log_id": "LOG20241101000001", // 日志ID
"cost": 0.05, // 本次消费
"balance": 95.50, // 剩余余额
"response_time": 245, // 响应时间(ms)
"group_name": "图像识别" // 分组名称
},
"timestamp": 1699999999
}
{
"code": 400,
"msg": "识别失败",
"data": {
"log_id": "LOG20241101000002",
"cost": 0, // 失败不扣费
"balance": 95.50,
"response_time": 523
},
"timestamp": 1699999999
}
curl -X POST https://captchaapi.com/api/v1/captcha.php \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key_here" \
-d '{
"image": "base64_encoded_image_here",
"type": 10001
}'
<?php $apiKey = 'your_api_key_here'; $image = base64_encode(file_get_contents('captcha.png')); $data = [ 'api_key' => $apiKey, 'image' => $image, 'type' => 10001 ]; $ch = curl_init('https://captchaapi.com/api/v1/captcha.php'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'X-API-Key: ' . $apiKey ]); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); echo "识别结果: " . $result['data']['result']; ?>
import requests import base64 api_key = 'your_api_key_here' # 读取图片并转为 base64 with open('captcha.png', 'rb') as f: image_base64 = base64.b64encode(f.read()).decode('utf-8') # 发送请求 response = requests.post( 'https://captchaapi.com/api/v1/captcha.php', headers={ 'Content-Type': 'application/json', 'X-API-Key': api_key }, json={ 'image': image_base64, 'type': 10001 } ) result = response.json() print(f"识别结果: {result['data']['result']}")
const apiKey = 'your_api_key_here'; const imageBase64 = 'base64_encoded_image_here'; fetch('https://captchaapi.com/api/v1/captcha.php', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': apiKey }, body: JSON.stringify({ image: imageBase64, type: 10001 }) }) .then(response => response.json()) .then(data => { console.log('识别结果:', data.data.result); }) .catch(error => { console.error('错误:', error); });
| 状态码 | 说明 | 原因 | 解决方案 |
|---|---|---|---|
| 200 | 请求成功 | 识别成功 | - |
| 400 | 参数错误 | 缺少必填参数或参数格式错误 | 检查请求参数是否完整和正确 |
| 401 | 认证失败 | API Key 无效或账户已禁用 | 检查 API Key 是否正确,账户是否正常 |
| 402 | 余额不足 | 账户余额不足以支付本次调用 | 充值后再试 |
| 429 | 请求过于频繁 | 超过限流限制(10次/秒) | 降低请求频率或联系客服提高限额 |
| 500 | 服务器错误 | 服务器内部错误 | 稍后重试或联系技术支持 |
我们提供多种验证码识别服务,价格透明,按次计费。
| 类型ID | 名称 | 价格 | 示例图片 |
|---|---|---|---|
10200 |
通用滑块 | ¥0.0100 |
|
50100 |
计算题 | ¥0.0050 |
|
50200 |
通用数英 | ¥0.0010 |
|
type 参数传递对应的类型ID