How to Generate a Key for Apple Push Notification Service (APNs)

To send Push Notifications to the Apple Push Notification service (APNs) using JWT token-based authentication, you need to generate a Key for APNs.

In this article, we will explain how to generate a Key for APNs using your Apple Developer Program account.

To generate an APNs key, you must be enrolled in the paid Apple Developer Program. For more details, see About the Apple Developer Program.

Generate a Key for Apple Push Notification Service (APNs)

Let's generate a Key for APNs.

Log in to the Apple Developer site, go to [Certificates, IDs & Profiles], and click Keys.

How to Generate an APNs Key 1


On the Certificates, Identifiers & Profiles page, click the + button next to Keys.

How to Generate an APNs Key 2


The Register a New Key page will appear. Enter a name for the key, select Apple Push Notifications service (APNs), and then click the [Configure] button next to it.

How to Generate an APNs Key 3


On the Configure Key page, choose the Environment and Key Restriction, then click [Save]. In this example, we selected Sandbox for testing purposes. For production or TestFlight, choose the option that includes Production.

How to Generate an APNs Key 4


You will be taken back to the previous screen. Click [Continue] to proceed.

How to Generate an APNs Key 5


Review the details, and if everything looks correct, click [Register].

How to Generate an APNs Key 6


The APNs Key is now created. Click [Download] to download the .p8 file. Note: once downloaded, the key file cannot be downloaded again, so make sure to keep it safe.

How to Generate an APNs Key 7

How to Generate an APNs Key 8


The APNs Key has been successfully generated.

How to Generate an APNs Key 9


That's all for how to generate an Apple Push Notification service (APNs) Key for iOS.