q_api and when_api