Checkout API apply discount

Hi everyone, I am using the Checkout API to create and manage my checkout. But I’m unable to find out how to apply discount code on checkout because I didn’t find any API call or any method to update my checkout.
How can I achieve this?

Ok i found that we can achieve this by requesting a post request on checkout api and providing the following data in the body of the request:

https://api-key:password@shop_name.myshopify.com/admin/api/2019-10/checkouts/token.json

{
“checkout”:{
“discount_code”:“free123”
}
}