We consider over-the-counter (OTC) transactions with bilateral default risk, and study the optimal design of the Credit Support Annex (CSA). In a setting where agents have access to a trading technology, default penalties and collateral costs arise endogenously as a result of foregone investment...