PubNub portal

Creating Keys

portal keys 1200x630

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.

Follow Along

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.

  1. Login to the Admin Portal.

  2. Click on the Apps tab on the left-hand-side.

  3. Click on the “Create New App” button to create a new application. Give the application a name and click the “Create” button. 

  4. 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.

  5. Click the “Create New Keyset” button on the upper right hand-side of the portal.

  6. A pop-up appears. Give the keyset a name and click the “Create” button.

  7. Click on the newly created keyset.

  8. Enable three features for the keyset to be able to connect to the PubNub Network: Presence, Message Persistence and Stream Controller.

  9. 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.

  10. Enable Message Persistence by clicking on the slider to turn it on. You can leave the default settings.

  11. Enable Stream Controller by clicking on the slider to turn it on if it is already not enabled. You can leave the default settings.

  12. 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. 

  13. 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.