The procedure for filing a petition for a writ of habeas corpus is spelled out in the CPLR Article 70. A Writ of Habeas Corpus is a civil proceeding that is available in both State and Federal Court to challenge the legality of imprisonment.This article addresses a defendant's right to file a federal petition for a writ of habeas corpus from a conviction in a state court. Habeas Corpus, in the Federal Court, is a petition that claims that you are being detained against your US constitutional rights. Introduction. This pamphlet is intended as a general guide to assist a person in prosecuting a civil matter in the Appellate Division, Second Department. A writ of habeas corpus requires that a person who is in custody be brought before a judge or court and that they be able to challenge that custody. To get a writ of habeas corpus, you must file a petition for a civil (not criminal) proceeding in either state or federal court. Any defendant who has been convicted of a New York state crime in a proceeding should be aware of their right to file a petition for a Writ of Habeas Corpus. To get a writ of habeas corpus, you must file a petition for a civil (not criminal) proceeding in either state or federal court. If you have comments, please leave them in the section provided below.