Rewrite api