Petition for Relief From a Conviction or Sentence By a Person in State Custody (Petition Under 28 U. S. C. § 2254 for a Writ of Habeas Corpus). Petition for Writ of Habeas Corpus.You should use this form if. To get a writ of habeas corpus, you must file a petition for a civil (not criminal) proceeding in either state or federal court. Though subject to different rules, incarcerated people in both state or federal custody may petition for a federal writ of habeas corpus. What Is Habeas Corpus?