N.Y. Criminal Procedure Law § 530.80
1. At any time before the forfeiture of a bail bond, an obligor may surrender the defendant in his exoneration, or the defendant may surrender himself, to the court in which his case is pending or to the sheriff to whose custody he was committed at the time of giving bail, in the following manner: