move API functions to .api_function