api: add bapi thread handle to api main structure.