企业专用
支持身份证、银行卡、驾驶证、营业执照等三十多种证件的OCR识别。
申请赠送05次
约¥0/次
一元试用150次
约¥0.02/次
体验价99309次
约¥0.3204/次
新客户首购特惠4993327次
约¥0.15/次
优惠价4992376次
约¥0.21/次
限时价12996495次
约¥0.2/次
采购价299915784次
约¥0.19/次
证件图片识别Base64
证件图片识别File版
请求Header:
请求参数说明:
请求代码示例:
curl -k -i -d "key=key&cardType=xxx&base64=xxx&userid=&orderid=" "http://v.juhe.cn/certificates/queryBase64"
<?php /** * 1851-证件图片识别Base64 - 代码参考(根据实际业务情况修改) */ // 基本参数配置 $apiUrl = "http://v.juhe.cn/certificates/queryBase64"; // 接口请求URL $method = "POST"; // 接口请求方式 $headers = ["Content-Type: application/x-www-form-urlencoded"]; // 接口请求header $apiKey = "您申请的调用APIkey"; // 在个人中心->我的数据,接口名称上方查看 // 接口请求入参配置 $requestParams = [ 'key' => $apiKey, 'cardType'=> 'xxx', 'base64'=> 'xxx', 'userid'=> '', 'orderid'=> '', ]; $requestParamsStr = http_build_query($requestParams); // 发起接口网络请求 $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $apiUrl); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); if (1 == strpos("$" . $apiUrl, "https://")) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); } curl_setopt($curl, CURLOPT_POSTFIELDS, $requestParamsStr); $response = curl_exec($curl); $httpInfo = curl_getinfo($curl); curl_close($curl); // 解析响应结果 $responseResult = json_decode($response, true); if ($responseResult) { // 网络请求成功。可依据业务逻辑和接口文档说明自行处理。 var_dump($responseResult); } else { // 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。 // var_dump($httpInfo); var_dump("请求异常"); }
import requests # 1851-证件图片识别Base64 - 代码参考(根据实际业务情况修改) # 基本参数配置 apiUrl = 'http://v.juhe.cn/certificates/queryBase64' # 接口请求URL apiKey = '您申请的调用APIkey' # 在个人中心->我的数据,接口名称上方查看 # 接口请求入参配置 requestParams = { 'key': apiKey, 'cardType': 'xxx', 'base64': 'xxx', 'userid': '', 'orderid': '', } # 发起接口网络请求 response = requests.post(apiUrl, requestParams) # 解析响应结果 if response.status_code == 200: responseResult = response.json() # 网络请求成功。可依据业务逻辑和接口文档说明自行处理。 print(responseResult) else: # 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。 print('请求异常')
package main import ( "encoding/json" "fmt" "net/http" "net/url" "strings" ) func main() { // 基本参数配置 apiUrl := "http://v.juhe.cn/certificates/queryBase64" apiKey := "您申请的调用APIkey" // 接口请求入参配置 requestParams := url.Values{} requestParams.Set("key", apiKey) requestParams.Set("cardType", "xxx") requestParams.Set("base64", "xxx") requestParams.Set("userid", "") requestParams.Set("orderid", "") // 发起接口网络请求 resp, err := http.Post(apiUrl, "application/x-www-form-urlencoded", strings.NewReader(requestParams.Encode())) if err != nil { fmt.Println("网络请求异常:", err) return } defer resp.Body.Close() var responseResult map[string]interface{} err = json.NewDecoder(resp.Body).Decode(&responseResult) if err != nil { fmt.Println("解析响应结果异常:", err) return } fmt.Println(responseResult) }
using System; using System.Text; using System.Net; using Newtonsoft.Json; using System.Collections.Specialized; namespace Common_API_Test.Test_Demo { class Csharp_post { static void Main(string[] args) { string url = "http://v.juhe.cn/certificates/queryBase64"; string apiKey = "您申请的调用APIkey"; using (WebClient client = new WebClient()) { var data = new NameValueCollection(); // 添加元素到 NameValueCollection data.Add("key", apiKey); data.Add( "cardType", "xxx"); data.Add( "base64", "xxx"); data.Add( "userid", ""); data.Add( "orderid", ""); try { byte[] response = client.UploadValues(url, "POST", data); string responseContent = Encoding.UTF8.GetString(response); dynamic responseData = JsonConvert.DeserializeObject(responseContent); if (responseData != null) { Console.WriteLine("Return Code: " + responseData["error_code"]); Console.WriteLine("Return Message: " + responseData["reason"]); } else { Console.WriteLine("json解析异常!"); } } catch (Exception) { Console.WriteLine("请检查其它错误"); } } } } }
const axios = require('axios'); // npm install axios // 基本参数配置 const apiUrl = 'http://v.juhe.cn/certificates/queryBase64'; // 接口请求URL const apiKey = '您申请的调用APIkey'; // 在个人中心->我的数据,接口名称上方查看 // 接口请求入参配置 const requestParams = { key: apiKey, cardType: 'xxx', base64: 'xxx', userid: '', orderid: '', }; // 发起接口网络请求 axios.post(apiUrl, requestParams, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) .then(response => { // 解析响应结果 if (response.status === 200) { const responseResult = response.data; // 网络请求成功。可依据业务逻辑和接口文档说明自行处理。 console.log(responseResult); } else { // 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。 console.log('请求异常'); } }) .catch(error => { // 网络请求失败,可以根据实际情况进行处理 console.log('网络请求失败:', error); });
package cn.juhe.test; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; public class JavaPost { public static void main(String[] args) throws Exception { String apiKey = "你申请的key"; String apiUrl = "http://v.juhe.cn/certificates/queryBase64"; HashMap<String, String> map = new HashMap<>(); map.put("key", apiKey); map.put("cardType", "xxx"); map.put("base64", "xxx"); map.put("userid", ""); map.put("orderid", ""); URL url = new URL(apiUrl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setDoOutput(true); String urlParameters = params(map); try (OutputStream os = connection.getOutputStream()) { byte[] input = urlParameters.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); } BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); // 打印响应 System.out.println(response); } public static String params(Map<String, String> map) { return map.entrySet().stream() .map(entry -> { try { return entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString()); } catch (Exception e) { e.printStackTrace(); return entry.getKey() + "=" + entry.getValue(); } }) .collect(Collectors.joining("&")); } }
// 基本参数配置 NSString *apiUrl = @"http://v.juhe.cn/certificates/queryBase64"; // 接口请求URL NSString *apiKey = @"您申请的调用APIkey"; // 在个人中心->我的数据,接口名称上方查看 // 接口请求入参配置 NSDictionary *requestParams = @{ @"key": apiKey, @"cardType": @"xxx", @"base64": @"xxx", @"userid": @"", @"orderid": @"", }; // 将请求参数转换成字符串形式 NSMutableString *postString = [NSMutableString string]; [requestParams enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL *stop) { [postString appendFormat:@"%@=%@&", key, value]; }]; [postString deleteCharactersInRange:NSMakeRange(postString.length - 1, 1)]; // 删除最后一个"&" // 发起接口网络请求 NSURL *url = [NSURL URLWithString:apiUrl]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; request.HTTPMethod = @"POST"; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; request.HTTPBody = [postString dataUsingEncoding:NSUTF8StringEncoding]; // 设置HTTPBody为转换后的参数字符串 NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { // 网络请求异常处理 NSLog(@"请求异常"); } else { NSError *jsonError; NSDictionary *responseResult = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError]; if (!jsonError) { // 网络请求成功处理 NSLog(@"%@", [responseResult objectForKey:@"error_code"]); NSLog(@"%@", [responseResult objectForKey:@"reason"]); NSLog(@"%@", responseResult); } else { // 解析结果异常处理 NSLog(@"解析结果异常"); } } }]; [task resume];
返回参数说明:
其他使用说明:
JSON返回示例:JSON在线格式化工具 >
//身份证识别返回示例 { "error_code": 0, "reason": "操作成功", "result": { "住址": "武汉市江岸区永清路****", "保留": "", "公民身份号码": "42010619510609****", "出生": "1951-06-09", "头像": "",/*Base64字符串*/ "姓名": "彭*", "性别": "男", "民族": "汉", "orderid":"JH1531180126114835937669", "userid":"1234567" } } //车牌识别返回示例 { "reason": "操作成功", "result": { "车牌号": "粤N0***81", "车牌颜色": "1", "车牌类型": "1", "整牌可信度": "86", "亮度评价": "215", "车牌运动方向": "0", "车牌位置(left_top_right_bottom)": "30_118_498_222", "orderid":"JH1531180126114835937669", "userid":"1234567" }, "error_code": 0 } //港澳台居民居住证正面 { "reason": "操作成功", "result":{ "保留" : "", "姓名" : "", "性别" : "", "民族" : "", "住址" : "", "出生" : "", "公民身份号码" : "", "复印件判别" : "", "头像" : "" } } //港澳台居民居住证反面 { "reason": "操作成功", "result":{ "保留" : "", "签发机关" : "", "有效期限" : "", "签发日期" : "", "有效期至" : "", "通行证号码" : "" } } //港澳居民来往内地通行证-照片页 { "reason": "操作成功", "result":{ "保留" : "", "证件号码" : "", "中文姓名" : "", "英文姓名" : "", "性别" : "", "出生日期" : "", "本证有效期至" : "", "英文姓" : "", "英文名" : "", "港澳证件号码" : "", "签发日期" : "", "有效期限" : "", "签发机关" : "", "换证次数" : "", "其他姓名" : "", "归属地" : "", "头像" : "", } } //中国台湾居民来往内地通行证照片页 { "reason": "操作成功", "result":{ "保留" : "", "中文姓名" : "", "英文姓名" : "", "出生日期" : "", "性别" : "", "有效期限" : "", "签发地点" : "", "证件号码" : "", "签发次数" : "", "签发机关" : "", "头像" : "", } } //针对车牌的信息: 1.车牌颜色类型: 0 //未知车牌 1 //蓝牌 2 //黑牌 3 //单排黄牌 4 //双排黄牌(大车尾牌,农用车) 5 //警车车牌 6 //武警车牌 7 //个性化车牌 8 //单排军车 9 //双排军车 10 //使馆牌 11 //香港牌 12 //拖拉机 13 //澳门牌 14 //厂内牌 15 //民航牌 16 //领事馆车牌 17 //新能源车牌-小型车 18 //新能源车牌-大型车 2.车牌可信度: 当前识别结果的分数,分数越高识别对的可能越大 3.车牌位置: 是指车牌在图像中的坐标值 4.车牌运动方向: 0 unknown, 1 left, 2 right, 3 up , 4 down //行驶证查询返回: { "保留": "", "号牌号码": "粤A4****", "车辆类型": "小型轿车", "所有人": "黄**", "住址": "广东省从化市城郊街东风***********", "品牌型号": "别克1B*******71801S", "车辆识别代号": "LSGJ********44832", "发动机号码": "T18S********C", "注册日期": "2000-06-13", "发证日期": "2020-07-11", "使用性质": "非营运", "orderid":"JH1531180126114835937669", "userid":"1234567" } //VIN识别 { "vin": "WBAFR7103BC727722", "orderid": "JH1531180524123006771818" } //营业执照 { "reason": "操作成功", "result":{ "统一社会信用代码": "91110105MA01AMC6Q", "组织机构代码": "", "税务登记证号": "", "社保登记号": "", "统计证证号": "", "名称": "北京数字传奇网络科技有限公司", "类型": "有限责任公司(自然人投资或控股)", "住所": "北京市朝阳区将台乡驼房营路8号新华科技大厦21层2106室", "法定代表人": "吴发强", "组成形式": "", "注册资本": "100万元", "成立日期": "2018年03月21日", "营业期限": "2018年03月21日至长期", "经营范围": "技术开发、技术推广、技术咨询、技术服务。(企业依法自主\n选择经营项目,开展经营活班依法须经批准的顼目,经相关\n部门批准后依批准的内容开展经营活班不得从事本市产业政\n策禁止和限制类顼目的经营活动。)", "登记机关": "", "登记日期": "", "二维码": "http://qyxy.baic.gov.cn/wap/wap/creditWapAction!qr.dhtml?id=ff8080816242f1250162463d9d3168f3", "副本": "" }, "error_code": 0 }
curl -X POST -F "pic=@WechatIMG305.jpeg" -F "key=您申请的key" -F "cardType=3" http://v.juhe.cn/certificates/query
<?php // 基本信息配置 $apiKey = '您申请的APIKey'; // 接口请求APIkey $apiUrl = 'http://v.juhe.cn/certificates/query'; // 证件识别接口的URL $imgFile = 'e938060a0b240502.jpeg'; // 本地图片文件路径 $pic = curl_file_create($imgFile, 'image/jpeg', 'pic'); // 组装请求参数 $params = [ 'key' => $apiKey, // 您申请到的接口请求key 'cardType' => 2, // 证件类型,依据支持的证件类型清单id修改 'pic' => $pic ]; // 发起接口网络请求 $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($curl, CURLOPT_URL, $apiUrl); curl_setopt($curl, CURLOPT_HTTPHEADER, ["Content-Type: multipart/form-data"]); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); if (1 == strpos("$" . $apiUrl, "https://")) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); } curl_setopt($curl, CURLOPT_POSTFIELDS, $params); $response = curl_exec($curl); $httpInfo = curl_getinfo($curl); curl_close($curl); $result = json_decode($response, true); if ($result) { // 请求成功,正常响应。 依据自己的业务逻辑修改 var_dump($result); $errorCode = $result['error_code']; if ($errorCode === 0) { // 识别成功 } else { // 识别失败 } } else { // 可能网络异常等问题,无法正常获得相应内容,业务逻辑可自行修改 echo "请求异常" . PHP_EOL; }
package demo; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.http.HttpEntity; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.FileBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; public class Demo { public static void main(String[] args) throws Exception { File file = new File("D://918785084181803756.jpg"); System.out.println(post("2", file)); } public static String post(String type, File file) throws Exception { CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = null; String result = null; // HttpClient请求的相关设置,可以不用配置,用默认的参数,这里设置连接和超时时长(毫秒) RequestConfig config = RequestConfig.custom().setConnectTimeout(30000).setSocketTimeout(30000).build(); try { HttpPost httppost = new HttpPost("http://v.juhe.cn/certificates/query"); // FileBody封装File类型的参数 FileBody bin = new FileBody(file); // StringBody封装String类型的参数 StringBody keyBody = new StringBody("这里换成你自己的key", ContentType.TEXT_PLAIN); StringBody typeBody = new StringBody(type, ContentType.TEXT_PLAIN); // addPart将参数传入,并指定参数名称 HttpEntity reqEntity = MultipartEntityBuilder.create() .addPart("pic", bin).addPart("key", keyBody) .addPart("cardType", typeBody).build(); httppost.setEntity(reqEntity); httppost.setConfig(config); // 执行网络请求并返回结果 response = httpClient.execute(httppost); HttpEntity resEntity = response.getEntity(); if (resEntity != null) { result = ConvertStreamToString(resEntity.getContent(), "UTF-8"); } EntityUtils.consume(resEntity); } finally { response.close(); httpClient.close(); } // 得到的是JSON类型的数据需要第三方解析JSON的jar包来解析 return result; } // 此方法是把传进的字节流转化为相应的字符串并返回,此方法一般在网络请求中用到 public static String ConvertStreamToString(InputStream is, String charset) throws Exception { StringBuilder sb = new StringBuilder(); try (InputStreamReader inputStreamReader = new InputStreamReader(is,charset)) { try (BufferedReader reader = new BufferedReader(inputStreamReader)) { String line = null; while ((line = reader.readLine()) != null) { sb.append(line).append("\r\n"); } } } return sb.toString(); } }
服务级错误码参照(error_code):
系统级错误码参照:
错误码格式说明(示例:200201):
完整示例代码分享:
常见问题:
限企业实名用户使用
本接口需提供应用场景审核
个人(基础认证)实名用户无法使用
证件识别 [详]
证件识别
全球证件识别
购物小票识别
涉农贷款地址识别