more flexible intermediary api logic