implement api factory