RFC validation

The RFC (Registro Federal de Contribuyentes) is Mexico's tax ID, issued by SAT. It has a strict 18-character structure that encodes the taxpayer type, a date, and a verification digit. This endpoint validates that structure locally — no external calls, no credentials, sub-millisecond response.

Validate an RFC

POST /v1/rfc/validate

{ "rfc": "COSC8001137NA" }

The rfc field accepts 12-character (moral) or 13-character (física) RFCs, case-insensitive.

Response (200 OK):

{
  "rfc":        "COSC8001137NA",
  "valid":      true,
  "type":       "fisica",
  "is_generic": false,
  "is_foreign": false
}

Field reference

Field Type Description
rfc string The RFC in uppercase, as stored by SAT
valid bool Always true on 200 — invalid RFCs return 422
type string See type table below
is_generic bool true if RFC is the generic billing placeholder (XAXX010101000)
is_foreign bool true if RFC is the foreign party placeholder (XEXX010101000)

RFC types

type Length Who holds it
fisica 13 Natural person (persona física)
moral 12 Legal entity / company (persona moral)
generic 13 SAT placeholder for counter sales (XAXX010101000)
foreign 13 SAT placeholder for foreign parties (XEXX010101000)

What "valid" means

The validation checks:

  • Format: correct character classes per position ([A-ZÑ&]{3,4} + YYMMDD + homoclave + check digit)
  • Date: the embedded YYMMDD is a real calendar date (rejects e.g. month 13 or February 30)
  • Check digit: the last character matches the computed verification digit

Responses

Status What happened What to do
200 RFC is structurally valid Use the type and flags
422 RFC failed format, date, or check-digit validation Ask the user to re-enter their RFC

Example 422 error:

{ "errors": { "rfc": ["The rfc is not a valid Mexican RFC."] } }

RFC validation is synchronous and local — it never calls SAT or any external service. Use it as a fast first gate before any operation that requires a valid RFC.