{"id":"cn-resident-id-parse","version":"1.0.0","description":"Parse an 18-digit (or legacy 15-digit) Chinese resident ID: region code, birth date, sex and GB 11643-1999 check digit.","supported_operations":["parse a chinese id card number","validate a china resident identity card number","check digit for a PRC id number","extract birth date from chinese national id","convert 15 digit chinese id to 18 digit","GB 11643 id number checksum","身份证号码校验"],"unsupported_operations":["looking up the administrative region name for the 6-digit region code (no GB/T 2260 lookup or region-name data)","validating a national ID from any country other than China","accepting a lowercase x in the 18th position or any whitespace/hyphen formatting"],"semantics":["id must be exactly 15 ASCII digits (legacy form) or exactly 17 ASCII digits followed by a digit or uppercase X (18-digit form); anything else throws invalid_input. No trimming, case folding or separators.","15-digit input is upgraded to 17 digits by inserting '19' after the 6-digit region code (this tool assumes the 1900s century, since the 15-digit form predates the 2000s); 18-digit input's first 17 characters are used as-is.","check_digit is always the GB 11643-1999 weighted mod-11 computation over the 17-digit payload (weights 7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2, remainder table 0..10 -> 1,0,X,9,8,7,6,5,4,3,2), independent of whether it matches the supplied 18th character.","id18 preserves the original 18th character when one was supplied (even when it disagrees with check_digit); for 15-digit input, id18 uses the freshly computed check_digit, so a 15-digit input can never produce checksum_mismatch.","birth_date is validated as a real proleptic Gregorian calendar date using the encoded 4-digit year (leap years: divisible by 4 and (not divisible by 100 or divisible by 400)); an invalid date reports birth_date: null and takes precedence over a checksum mismatch.","sex is derived from the 17th character of the 17-digit payload (the last digit of the 3-digit sequence code): odd is male, even is female; this is always computed, regardless of date or checksum validity.","region_code is the payload's first 6 characters returned unchanged; no administrative-division lookup is performed.","Pure integer arithmetic and a fixed calendar rule; no locale, clock, or randomness; identical output across runs for the same input."],"limits":{"max_input_bytes":18},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["id"],"properties":{"id":{"type":"string","minLength":15,"maxLength":18,"pattern":"^(\\d{15}|\\d{17}[0-9X])$"}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","region_code","birth_date","sex","check_digit","id18"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":[null,"invalid_birth_date","checksum_mismatch"]},"region_code":{"type":"string","pattern":"^\\d{6}$"},"birth_date":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"sex":{"type":"string","enum":["male","female"]},"check_digit":{"type":"string","pattern":"^[0-9X]$"},"id18":{"type":"string","pattern":"^\\d{17}[0-9X]$"}}},"examples":[{"input":{"id":"11010519491231002X"},"output":{"valid":true,"reason":null,"region_code":"110105","birth_date":"1949-12-31","sex":"female","check_digit":"X","id18":"11010519491231002X"}},{"input":{"id":"310112850409522"},"output":{"valid":true,"reason":null,"region_code":"310112","birth_date":"1985-04-09","sex":"female","check_digit":"7","id18":"310112198504095227"}}],"execute_url":"/v1/tools/cn-resident-id-parse/versions/1.0.0/execute"}