Yes, you can usually cancel a flight ticket through the flight booking API, though whether a refund follows and how much of it comes back depends on the airline and the fare rules of the ticket you sold.
When you send a cancellation request, the API passes it on to the airline or the supplier and returns a status so you can see that the booking is no longer live. If you cancel very soon after issuing, inside the short window the airline allows, the ticket can often be voided outright and the whole amount comes back without a penalty. After that window it becomes a refund rather than a void, and the airline decides what is due after deducting whatever it charges for cancelling.
The honest limit is that the money does not arrive the moment you click. A refund passes through the airline first and then the supplier, and on some routes that takes weeks. Cheaper fares are often non refundable apart from certain taxes, and some low cost carriers do not accept cancellations through the API at all, so those have to be handled directly with the airline or raised with our support team. The penalty is set by the airline, not by us, and we cannot waive it.
Before you confirm any ticket, read the fare rules that come back in the search response so you can tell your customer plainly what they stand to lose, and during your setup ask us which of your suppliers allow cancelling straight from the API and which ones need an offline request.