{"id":"payment-card-validate","version":"1.0.0","description":"Validate a payment card's Luhn check digit and detect its brand from its IIN, without returning the full number.","supported_operations":["validate a credit card number","check if this card number passes the luhn check","what card brand is this number","is this a valid mastercard 2-series number","detect visa mastercard amex discover from card number","בדיקת מספר כרטיס אשראי"],"unsupported_operations":["CVV, expiry date or cardholder-name validation","looking up the issuing bank or country from the IIN","card numbers with fewer than 12 or more than 19 digits after stripping spaces and hyphens","brands other than Visa, Mastercard, American Express and Discover"],"semantics":["stripped = number with every ASCII space (U+0020) and hyphen (-) character removed; every other character stays.","If stripped is not all decimal digits 0-9, or its length is outside 12-19, return {valid:false, reason:'invalid_format', brand:'unknown', brand_candidates:[], length: stripped.length, luhn_valid:false, iin6:null, last4:null, data_version}.","Otherwise iin6 is the first 6 characters of stripped and last4 the last 4; the full stripped number is never returned. luhn_valid is the ISO/IEC 7812-1:2017 Luhn check over stripped.","brand_candidates, tested in the fixed order visa, mastercard, amex, discover: visa when stripped starts with '4'; mastercard when the 6-digit iin6 is in [510000,559999] or [222100,272099]; amex when the first 2 characters are '34' or '37'; discover when the first 4 characters are '6011', iin6 is in [622126,622925], the first 3 characters are '644'-'649', or the first 2 characters are '65'.","brand is the single brand_candidates entry, else 'unknown'. valid = luhn_valid AND (brand is 'unknown' OR length is an allowed length for that brand: visa [13,16,19], mastercard [16], amex [15], discover [16,17,18,19]).","reason is null when valid; 'luhn_invalid' when luhn_valid is false; 'wrong_length_for_brand' when luhn_valid is true but the length does not match the detected brand. data_version is always the pinned card-brand-iin-ranges dataset version."],"limits":{"max_number_bytes":40},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["number"],"properties":{"number":{"type":"string","minLength":1,"maxLength":40}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","brand","brand_candidates","length","luhn_valid","iin6","last4","data_version"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":[null,"invalid_format","luhn_invalid","wrong_length_for_brand"]},"brand":{"type":"string","enum":["visa","mastercard","amex","discover","unknown"]},"brand_candidates":{"type":"array","items":{"type":"string","enum":["visa","mastercard","amex","discover"]},"uniqueItems":true,"maxItems":4},"length":{"type":"integer","minimum":0,"maximum":40},"luhn_valid":{"type":"boolean"},"iin6":{"type":["string","null"],"pattern":"^[0-9]{6}$"},"last4":{"type":["string","null"],"pattern":"^[0-9]{4}$"},"data_version":{"type":"string"}}},"examples":[{"input":{"number":"4111111111111111"},"output":{"valid":true,"reason":null,"brand":"visa","brand_candidates":["visa"],"length":16,"luhn_valid":true,"iin6":"411111","last4":"1111","data_version":"card-iin-2026-09-28"}},{"input":{"number":"2223000048400011"},"output":{"valid":true,"reason":null,"brand":"mastercard","brand_candidates":["mastercard"],"length":16,"luhn_valid":true,"iin6":"222300","last4":"0011","data_version":"card-iin-2026-09-28"}},{"input":{"number":"378282246310005"},"output":{"valid":true,"reason":null,"brand":"amex","brand_candidates":["amex"],"length":15,"luhn_valid":true,"iin6":"378282","last4":"0005","data_version":"card-iin-2026-09-28"}}],"execute_url":"/v1/tools/payment-card-validate/versions/1.0.0/execute"}