How to apply the Promotion when creating orders programmatically in Magento2.2?

I have created an API that will place an order in Magento 2.2.1 programmatically. Now the customer will receive a promotion code. When the order is made through the API, how can I make this promotion code be added to the API of my order made programmatically?

Thanks in advance