add cfg to all api functions