{"id":"it-codice-fiscale-parse","version":"1.0.0","description":"Parse an Italian codice fiscale: birth date, sex, place code, check character; optionally match a surname/given name.","supported_operations":["parse an italian codice fiscale","get birth date from italian fiscal code","validate a codice fiscale check character","check if a name matches a codice fiscale","italian tax code sex digit","what does the omocodia letter mean in a codice fiscale","verifica codice fiscale"],"unsupported_operations":["resolving the belfiore_code into a comune (place of birth) name (no place-name data is pinned)","reversing the omocodia substitution priority order used by the Anagrafe Tributaria to resolve real collisions","accepting lowercase input or trimming whitespace"],"semantics":["codice_fiscale must be exactly 16 characters matching the structural pattern; each year/day/place slot is a decimal digit or one of the ten omocodia letters L,M,N,P,Q,R,S,T,U,V; the month slot is one of the 12 letters A,B,C,D,E,H,L,M,P,R,S,T. Any other value throws invalid_input; no case folding.","date_digit maps 0-9 to themselves and the omocodia letters L..V to 0-9 in that same order; used for the two year and two day characters only, never the three place characters.","sex is female when the 2-digit day value is >= 41 (the official +40 offset), male otherwise; birth_day subtracts 40 from that value for a female code. birth_day must be 1..days-in-month under a fixed, leap-permissive table (February always 29 days, since the 2-digit year leaves the century undetermined); an invalid day reports reason invalid_date and takes precedence over a checksum mismatch.","belfiore_code is characters 12-15 returned unresolved (no comune lookup); omocodia_level counts, among the 7 year/day/place character slots, how many are an omocodia letter rather than a digit.","check_char sums ODD_TABLE (odd 1-based positions) and EVEN_TABLE (even positions) over the first 15 characters per the DM 1976 Allegato A tables, then takes letter (sum mod 26); a mismatch with the given 16th character is reason checksum_mismatch.","name_letters(text) applies Unicode NFD, drops combining marks, uppercases, and keeps only A-Z; a supplied surname or given_name that normalizes to zero letters throws invalid_input. surname_code_of takes the first 3 consonants (padding with the string's own vowels then 'X' if it runs out); name_code_of does the same unless there are >= 4 consonants, in which case it takes the 1st, 3rd and 4th consonant (skipping the 2nd).","name_match is null when neither surname nor given_name was supplied, true only if every supplied one matches its own 3-letter code in codice_fiscale, false otherwise; it never affects valid or reason.","Pure fixed-table lookups and integer arithmetic; no locale, clock, or randomness beyond the runtime's Unicode version used for NFD; identical output across runs for the same input."],"limits":{"max_codice_fiscale_bytes":16,"max_surname_bytes":60,"max_given_name_bytes":60},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["codice_fiscale"],"properties":{"codice_fiscale":{"type":"string","minLength":16,"maxLength":16,"pattern":"^[A-Z]{6}[0-9LMNPQRSTUV]{2}[ABCDEHLMPRST][0-9LMNPQRSTUV]{2}[A-Z][0-9LMNPQRSTUV]{3}[A-Z]$"},"surname":{"type":"string","minLength":1,"maxLength":60},"given_name":{"type":"string","minLength":1,"maxLength":60}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","surname_code","name_code","birth_year_2d","birth_month","birth_day","sex","belfiore_code","omocodia_level","check_char","name_match"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":[null,"invalid_date","checksum_mismatch"]},"surname_code":{"type":"string","pattern":"^[A-Z]{3}$"},"name_code":{"type":"string","pattern":"^[A-Z]{3}$"},"birth_year_2d":{"type":"string","pattern":"^\\d{2}$"},"birth_month":{"type":"integer","minimum":1,"maximum":12},"birth_day":{"type":"integer","minimum":0,"maximum":59},"sex":{"type":"string","enum":["male","female"]},"belfiore_code":{"type":"string","pattern":"^[A-Z][0-9LMNPQRSTUV]{3}$"},"omocodia_level":{"type":"integer","minimum":0,"maximum":7},"check_char":{"type":"string","pattern":"^[A-Z]$"},"name_match":{"type":["boolean","null"]}}},"examples":[{"input":{"codice_fiscale":"RCCMNL83S18D969H"},"output":{"valid":true,"reason":null,"surname_code":"RCC","name_code":"MNL","birth_year_2d":"83","birth_month":11,"birth_day":18,"sex":"male","belfiore_code":"D969","omocodia_level":0,"check_char":"H","name_match":null}},{"input":{"codice_fiscale":"RCCFNC83S18D969R","given_name":"Francesco"},"output":{"valid":true,"reason":null,"surname_code":"RCC","name_code":"FNC","birth_year_2d":"83","birth_month":11,"birth_day":18,"sex":"male","belfiore_code":"D969","omocodia_level":0,"check_char":"R","name_match":true}}],"execute_url":"/v1/tools/it-codice-fiscale-parse/versions/1.0.0/execute"}