Regardless of your verbal agreement, IRS says that the custodial parent is the one who gets to determine who claims the dependency exemption. So - if your ex is the custodial parent and she chooses to claim both children then you are out of luck. You will need to file your return not claiming either child.
If you ex agrees to give you one child you need to have her sign Form 8332. She then needs to amend her return taking the child off. You would then need to mail in your return (cannot do electronically) and wait for them to process her amended return and then IRS would allow you to claim the child.
If you want to fight for the right to claiming the child, it would need to be a legal battle with the end result your ex signing the Form 8332.
I know this is not good news. IRS does not care in this case what people have said. They look at who is the custodial parent and let them determine.
If you have a specific question related to this matter, please hit the need info button and ask. If you are satisfied with this answer, please hit the green accept button to close the question and allow me to get paid.
With joint custody, it is the physical presence that determines who is considered the custodial parent. IRS specifically looks at where the child spent more nights to determine who had more physical custody - this is a new change and different from past years.
With 365 nights in the year, if you had one or both children more nights then you would be considered the custodial parent. If your ex had one or more both children more nights then she would be considered the custodial parent. It is possible that the custodial parent could be different for each child.