The procedure for filing a petition for a writ of habeas corpus is spelled out in the CPLR Article 70. Habeas Corpus, in the Federal Court, is a petition that claims that you are being detained against your US constitutional rights.A Writ of Habeas Corpus is a civil proceeding that is available in both State and Federal Court to challenge the legality of imprisonment. The "Great Writ" of habeas corpus is a fundamental right in the Constitution that protects against unlawful and indefinite imprisonment. The writ of habeas corpus primarily acts as a writ of inquiry, issued to test the reasons or grounds for restraint and detention. Petition for a Writ of Habeas Corpus Under 28 U.S.C. § 2241. Download. To get a writ of habeas corpus, you must file a petition for a civil (not criminal) proceeding in either state or federal court. A writ of habeas corpus is a judicial mandate to a prison official, usually the warden, ordering that an inmate be brought to the court. In a petition for habeas corpus, a prisoner raises doubts about the legality of their imprisonment. You do not need to cite law.