Take control from pixhawk during mission

Which API should we use to control drone programmatically with pixhawk flight controller?

What were we planing is that during a ongoing mission if something comes in the path the campanion computer would take the control from pixhawk and try to avoid that obstacle.And resume to that mission.But is it possible to resume the mission again after AUTO mode is changed?