generic API generator