[api] Clean up code