rewrite api