Typesafe API utils.