automatically detecting api version