How do you associate a promo code with a discount using the api?

I have created a discount using the api calling addOrderTotalDiscount but cant use it in the cart because it dosent have a promo code associated with it. how do I create a promo code and associate it with the discount using the api ?