[api] refactor replacement of external_id by company_id