API abstraction layer to switch endpoints