The Gateway ID number (12 digits I think) is what you create first to enable you to access your personal tax records. You'll then get a 10 digit SA-UTR (Unique Tax Reference) when you register for self assessment. These are the 2 important numbers to remember.
Each time you log onto your gateway you'll be sent (to your mobile if you want) a unique 6 digit code as a security check.