wrap api in def