enh: moved api into its own file