What are Keys?
When you create an account in the PubNub Admin Portal, the first set of API keys are demo keys that are automatically generated for you. While fine for quick testing, this automatically generated keyset is rate-limited and not suitable for production level environments. You’ll want to create your own keyset for each environment of your application, such as for production, testing, and QA, so you can avoid these limits and can customize each keyset to suit your needs. Any new API keys that you create aren’t rate-limited and have fewer PubNub services enabled by default; you’ll enable services on your keyset as required.
To get started, there are a few features that you’ll want to enable to begin using PubNub in your own application. Follow along with the video or read the step-by-step guide to get your own API keys.
Watch the video below or follow the step-by-step instructions to learn how to create keys. Need extra information? Check out PubNub’s official documentation on getting started to learn more about how to build your own PubNub application.
Login to the Admin Portal.
Click on the Apps tab on the left-hand-side.
Click on the “Create New App” button to create a new application. Give the application a name and click the “Create” button.
Click on your newly created app. You will be brought to the keysets page for this application. Note that each application created automatically generates a new keyset for you, but you will be creating a new keyset to enable specific features.
Click the “Create New Keyset” button on the upper right hand-side of the portal.
A pop-up appears. Give the keyset a name and click the “Create” button.
Click on the newly created keyset.
Enable three features for the keyset to be able to connect to the PubNub Network: Presence, Message Persistence and Stream Controller.
Enable Presence by clicking on the slider to turn it on. A pop-up will require that you enter in “ENABLE”. Enter in “ENABLE” in all caps and then press the “Enable” button. You can leave the default settings.
Enable Message Persistence by clicking on the slider to turn it on. You can leave the default settings.
Enable Stream Controller by clicking on the slider to turn it on if it is already not enabled. You can leave the default settings.
Click on the “Save Changes” button in the bottom right corner of the portal. After a few seconds, a confirmation message will appear in the upper-left corner of the portal confirming that these changes have been saved.
Scroll back to the top of the portal. Copy the Publish and Subscribe Keys to a text editor by clicking on the copy icons next to each key field. You’ll need these keys later on.