[api] refactor one more function