api rewrite