The numbers change depending on level and spec for some classes (I know they do for druid). As a general rule, they're as numbered left-to-right on the stance bar starting from 1. There was a table somewhere mapping them out.
Here's an older version of the API page on WoWPedia with some of the numbers. Use this only for the order in which the forms show up, they will be shifted according to which forms the player currently has.
https://wow.gamepedia.com/index.php?...&oldid=1849816