There's no API for that operation currently, but you can use PowerShell:
Set-Mailbox ******@domain.com -ForwardingSmtpAddress ******@anotherdomain.com -DeliverToMailboxAndForward $true
If you need help connecting to Exchange Online PowerShell, follow the instructions here: https://learn.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps