登录 注册

📋 概述

本 API 提供高性能的验证码识别服务,支持多种类型的验证码识别。

基础信息
  • 基础URL:https://captchaapi.com/api/v1/captcha.php
  • 协议: HTTP/HTTPS
  • 请求格式: JSON
  • 响应格式: JSON
  • 字符编码: UTF-8

✨ 核心特性

🔐 安全认证

API Key 认证,保障数据安全

💰 按结果计费

只有识别成功才扣费

📊 完整日志

记录所有请求,可追溯查询

🔑 认证方式

使用 API Key 进行认证,支持两种传递方式:

方式一:HTTP Header(推荐)

X-API-Key: your_api_key_here

方式二:请求体参数

{
    "api_key": "your_api_key_here",
    // 其他参数...
}
⚠️ 注意事项
  • API Key 是唯一凭证,请妥善保管
  • 不要在客户端代码中暴露 API Key
  • 建议使用 HTTPS 协议传输
  • 如 API Key 泄露,请立即在控制台重置

📡 接口说明

POST https://captchaapi.com/api/v1/captcha.php

功能:验证码识别

描述:上传验证码图片,返回识别结果

请求参数

参数名 类型 必填 说明 示例
api_key string API 密钥 ak_1234567890...
image string Base64 编码的图片 iVBORw0KGgo...
type integer 验证码类型(分组ID) 查看所有类型 → 10001

响应格式

成功响应(code = 200)

{
    "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 != 200)

{
    "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 服务器错误 服务器内部错误 稍后重试或联系技术支持

❓ 常见问题

1. 如何获取 API Key?

登录用户控制台,在"API管理"页面可以查看您的 API Key。

2. 识别失败会扣费吗?

不会。只有识别成功(code=200)才会扣费。识别失败时 cost=0。

3. 超过限流怎么办?

默认每秒最多 10 次请求。如需提高限额,请联系客服。

4. 支持哪些图片格式?

支持 JPG、PNG、BMP、GIF 等常见图片格式。图片需要 Base64 编码后传输。

5. 识别准确率是多少?

根据验证码类型不同,准确率在 95%-99.5% 之间。

🎯 验证码类型

我们提供多种验证码识别服务,价格透明,按次计费。

类型ID 名称 价格 示例图片
10200 通用滑块 ¥0.0100
示例1 示例2 示例3 示例4
50100 计算题 ¥0.0050
示例1 示例2 示例3 示例4
50200 通用数英 ¥0.0010
示例1 示例2 示例3 示例4
💡 使用提示
  • 请求时使用 type 参数传递对应的类型ID
  • 不同类型的验证码价格不同,请根据实际需求选择
  • 建议先查看示例图片,确认类型是否匹配
  • 如需定制类型,请联系客服

示例图片

示例图片