First things first, you have to create a shodan account for this.
Just visit the registration site of shodan and create a account.
After entering your parameters you have to activate your account by clicking on the link from the received email.
The next step is to login and you will see your API key on the main page.
Have fun. Enumeration is the key!