While many co-parents make a pointed effort to get along for the sake of the children, there are some who just can't put themselves aside; they work hard to make the situation as complicated as possible. If you're being subjected to harassment, you will need to take steps to make it stop.
One of the first things that you can do is to communicate with your ex and ask them to stop the behavior. Instead of framing this as an accusation, try to focus on how it's impacting the children. You might even be able to start the conversation out by asking them if they're OK because harassment may come from internal struggles.
Speaking to your ex can help you to find out if there's an underlying parenting problem. This gives you a chance to address the matter in a way that benefits the children. You may find that coming to a solution sets a good foundation for strengthening the parenting relationship.
If nothing else works, you may have to involve the court. Harassment by an ex is never acceptable. In fact, the parenting relationship must be based on mutual respect instead of fear, intimidation and harassment.
As difficult as it is to deal with this type of situation, you should never just ignore the behavior. Your legal team can help you to determine what options you have. Remember, your children are watching what you do and how you handle things. Teaching them the mature way to stand up for yourself can benefit them greatly, so this might be a good learning opportunity.