YunShang API

ID Card 2-Factor Verification

Checks whether the name and ID number match, backed by authoritative data with real-time results. Fits registration, real-name verification and risk-control scenarios. Billed per package, 1 deduction per call.

API info

ItemValue
EndpointPOST /api/v3/idcard2check
BillingPackage

Request parameters

ParameterTypeRequiredDescription
namestringYesReal name
idcardstringYesID card number

Request example

PHP

<?php
$app_id = 'YOUR_APP_ID';
$app_key = 'YOUR_APP_KEY';
$url = 'https://yunsapi.com/api/v3/idcard2check';
$params = ['name' => 'Zhang San', 'idcard' => '440301199512073421'];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'X-APP-ID: ' . $app_id,
    'X-APP-KEY: ' . $app_key,
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($ch);
curl_close($ch);

echo $resp;

Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class IdcardDemo {
    public static void main(String[] args) throws Exception {
        String appId = "YOUR_APP_ID";
        String appKey = "YOUR_APP_KEY";
        String url = "https://yunsapi.com/api/v3/idcard2check";
        String body = "{\"name\":\"Zhang San\",\"idcard\":\"440301199512073421\"}";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest req = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-APP-ID", appId)
                .header("X-APP-KEY", appKey)
                .POST(HttpRequest.BodyPublishers.ofString(body))
                .build();

        HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
        System.out.println(resp.body());
    }
}

Response example

{
    "code": 0,
    "msg": "success",
    "data": {
        "name": "Zhang San",
        "status": "1",
    },
    "request_id": "req_xxx"
}

Response parameters

ParameterTypeDescription
data.namestringThe verified name
data.statusstring1 means matched, 0 means mismatch

Note: on a name/ID mismatch the API returns business code 1100; you can determine the result via data.status or the error code.