Notably, the Customs and Border Patrol officer at your point of entry can do this [1], on the spot.
[1] https://esta.cbp.dhs.gov/esta/application.html?execution=e1s...