rewriting api