restructure api