internal api rewrite