add before casting api