Yes, in most cases you will find out through the API, but how quickly depends on the supplier. When a property or a supplier cancels a booking that was already confirmed, the status of that booking changes on their side, and when your portal asks the API about the booking again it comes back as cancelled, usually with whatever reason the supplier has recorded. Some suppliers also push a message out the moment it happens, and where that is available the change can appear in your system without anyone going looking for it.
Where it gets less tidy is that not every hotel supplier sends that message. Some only change the status quietly and wait for someone to ask. For those, the safest habit is to have your portal re check the status of upcoming bookings on a regular schedule, and to check more often for stays that are about to start. That way a quiet cancellation is picked up by your system rather than by your customer standing at the front desk.
It also helps to be realistic about what happens next. The API can show you the cancellation and any refund the supplier has recorded against it, but it cannot make the property keep the room or pay anything towards the trouble. Putting the guest somewhere else is a fresh booking, made the normal way, and any money you are owed for the cancelled one follows the supplier's own rules.
The next thing to do is to ask which of your hotel suppliers send live cancellation updates and which ones have to be checked, then set your re check schedule so it covers the ones that stay silent.