[api] made last commit a little DRY