I am very sorry to hear this;
The ex parte procedure is authorized by statute if one is at significant harm of psychological abuse - that statute states:
(2) A temporary order for custody ex parte and prior to service of process and notice shall not be entered unless the court finds that the child is exposed to a substantial risk of physical or emotional injury or sexual abuse.
(3) If the court finds that the child is exposed to a substantial risk of physical or emotional injury or sexual abuse, upon request of the aggrieved party, the court shall consider and may order the other party to (i) stay away from a minor child, or (ii) return a minor child to, or not remove a minor child from, the physical care of a parent or person in loco parentis, if the court finds that the order is in the best interest of the minor child and is necessary for the safety of the minor child.
and is located here:
While one can proceed as a self-represented litigant, if at all possible it is best to hire an attorney, because the ex parte process is more complicated, and any mistake will delay the issue going before a judge- which defeats the purpose of the ex parte.
If there is threat of physical harm or emotional abuse, here is the paperwork for a restraining order:
An adult may file on behalf of a minor child; the court house typically has advocates to assist with that.
For example of what is considered domestic violence please see here