Amendment XIV, Sec. 2: Representatives shall be apportioned among the several States according to their respective numbers, counting the whole number of persons in each State, excluding Indians not taxed.
Nothing there about being a legal citizen. I don't recall if the last Census form I filled out asked.
But you did talk to a census taker, or at least fill out a form. It’s assumed that illegals don’t respond to census forms.