Trade out via API

I was wondering whether there is any way to Trade Out via the api if, for example, certain conditions were met, like there is on the app? I’ve tried to cancel but from experience and from what I’ve found on here, I can’t cancel an order when its matched but I’d like the opportunity to Trade Out at whatever available price. Am I missing something or is this not an option.