API Overview
Base URL
Unless stated separately, all URLs referenced in the API Reference documentation have the following base
https://verifys-api.geelab.tech
Data security tips
Although HTTP is allowed, to protect your data privacy we strongly recommend you use HTTPS
Authentication
Our API are protected through signature. Authentication parameters include the current timestamp and signature, which will be indicated in the interface parameters.
When generating signature, you need to use your service_id
and service_secret
of service. To learn more about service, please refer to our service documentation.
Here's how to generate a signature:
- Get the current timestamp in seconds:
gen_time
. It is also used asgen_time
in the request parameters. - Concatenate the
service_id
andgen_time
to form a new string. - Use the
service_secret
as the key, and apply the HMAC-SHA256 algorithm to the string obtained in step 2 to generate the signing result in hexadecimal string format.
- Python
- Java
import time
import hmac
def generate_signature(service_id, service_secret):
gen_time = int(time.time())
msg = f"{service_id}{gen_time}"
sig = hmac.new(service_secret.encode(), msg.encode(), digestmod="SHA256").hexdigest()
return sig, gen_time
if __name__ == '__main__':
service_id = "xxx"
service_secret = "xxx"
print(generate_signature(service_id, service_secret))
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
public class SignatureGenerator {
public static class SignatureResult {
public final String signature;
public final long genTime;
public SignatureResult(String signature, long genTime) {
this.signature = signature;
this.genTime = genTime;
}
}
public static SignatureResult generateSignature(String serviceId, String serviceSecret) {
long genTime = System.currentTimeMillis() / 1000;
String msg = serviceId + String.valueOf(genTime);
try {
Mac mac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKey = new SecretKeySpec(serviceSecret.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
mac.init(secretKey);
byte[] signatureBytes = mac.doFinal(msg.getBytes(StandardCharsets.UTF_8));
return new SignatureResult(bytesToHex(signatureBytes), genTime);
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
throw new RuntimeException("Error generating signature", e);
}
}
private static String bytesToHex(byte[] bytes) {
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
public static void main(String[] args) {
String serviceId = "xxx";
String serviceSecret = "xxx";
SignatureResult result = generateSignature(serviceId, serviceSecret);
System.out.println("Signature: " + result.signature);
System.out.println("Generation Time: " + result.genTime);
}
}