{"id":"se-personnummer-parse","version":"1.0.0","description":"Parse a Swedish personnummer/samordningsnummer: resolve its century, return birth date, sex and Luhn validity.","supported_operations":["parse a swedish personnummer","get birth date from swedish personal identity number","validate a personnummer checksum","resolve the century of a 10 digit swedish id number","is this a samordningsnummer coordination number","swedish ssn sex digit","check a svenskt personnummer med plus tecken"],"unsupported_operations":["reading the system clock to resolve the century (reference_date must be supplied for the short form)","accepting a printed form with a space, dot, or any separator other than \"-\" or \"+\"","looking up which real person a personnummer identifies"],"semantics":["value must be exactly 12 digits (long form, century explicit) or 6 digits + '-'/'+' + 4 digits (short form, 11 characters); any other shape throws invalid_input, no trimming.","reference_date, when present, must be a real YYYY-MM-DD calendar date; it is required (else invalid_input, details.reason \"reference_date_required\") when value is the short form, because the two-digit year has no century of its own and this tool never reads the system clock; it is optional and has no effect on the result for the long form. When value is the short form, reference_date's year must also be at least 0200 (else invalid_input, details.reason \"reference_date_out_of_range\"), because an earlier year can make the resolved birth_year negative, which cannot be written as the 4-digit year in birth_date or normalized12; the bound does not apply to the long form.","Century resolution (short form only): base = reference year when the separator is '-', or reference year - 100 when '+'; birth_year = base - ((base - YY) mod 100) using a true (non-negative) modulo. century_resolved is false for the short form and true for the long form (already explicit).","is_coordination_number is true when the 2-digit day field is 61-91 (samordningsnummer: real day + 60), false when it is 01-31 (a real day); any other value (00, 32-60, 92-99) names no real day under either reading.","birth_date is validated as a real proleptic Gregorian calendar date against the resolved birth_year; an invalid date returns birth_date: null, valid: false, reason: \"invalid_date\", checked before the checksum.","The Luhn checksum is evaluated over exactly the 10 digits YY+MM+DD(as printed, with the +60 offset if any)+NNN+C -- the printed 2-digit year, never the resolved 4-digit birth_year -- using the standard Luhn algorithm (as in checkdigit-validate's luhn preset).","sex is male when the 9th of those 10 digits (the last digit of the 3-digit serial) is odd, female when even.","normalized12 is always the resolved 4-digit birth_year followed by the printed MM, DD (unchanged, including any +60 offset) and the 4 remaining digits (serial + given check digit, never the expected one), regardless of validity.","Pure integer arithmetic and a fixed calendar rule; the century is resolved only from the caller-supplied reference_date, never the system clock; identical output across runs for the same input."],"limits":{"max_value_bytes":12,"max_reference_date_bytes":10},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["value"],"properties":{"value":{"type":"string","minLength":11,"maxLength":12,"pattern":"^(\\d{12}|\\d{6}[-+]\\d{4})$"},"reference_date":{"type":"string","minLength":10,"maxLength":10,"pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","birth_date","century_resolved","is_coordination_number","sex","normalized12"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":[null,"invalid_date","checksum_mismatch"]},"birth_date":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"century_resolved":{"type":"boolean"},"is_coordination_number":{"type":"boolean"},"sex":{"type":"string","enum":["male","female"]},"normalized12":{"type":"string","pattern":"^\\d{12}$"}}},"examples":[{"input":{"value":"811218-9876","reference_date":"2026-09-28"},"output":{"valid":true,"reason":null,"birth_date":"1981-12-18","century_resolved":false,"is_coordination_number":false,"sex":"male","normalized12":"198112189876"}},{"input":{"value":"900161-2358","reference_date":"2026-09-28"},"output":{"valid":true,"reason":null,"birth_date":"1990-01-01","century_resolved":false,"is_coordination_number":true,"sex":"male","normalized12":"199001612358"}}],"execute_url":"/v1/tools/se-personnummer-parse/versions/1.0.0/execute"}