How the test works
Apple's push servers answer every request with a reason, and in our tests APNs checked the provider token before it looked at the device token. So the tester sends one request to each server with a made-up device token. A working key gets BadDeviceToken: Apple got past the key, the Key ID and the Team ID and only refused the device. The made-up device can't show whether the bundle ID is right, so the test push is the check for that. A broken one gets InvalidProviderToken, and a key made for one server only gets BadEnvironmentKeyIdInToken from the other.
Because our server's connections to Apple are shared, an answer that may come from the connection rather than your key (a token refusal, a bundle ID refusal or a connection error) is tried up to four times, alternating with Apple's other port, 2197, before the page shows it. Your .p8 key stays in this tab. What reaches our server, and through it Apple, is the provider token, which stops working an hour after it was made, plus the bundle ID. A test push adds the device token and the text you typed. We don't store any of it.
What goes in the provider token
The provider token is a JWT with two short JSON parts, signed with your .p8 key using ES256. Your server sends it in the authorization header as bearer <token>.
| Field | What goes in | Example |
|---|---|---|
alg (header) | Always ES256, the only algorithm APNs supports | ES256 |
kid (header) | Your Key ID, 10 characters | ABC123DEFG |
iss | Your Team ID, 10 characters | DEF123GHIJ |
iat | When you made it, in seconds since 1 January 1970 UTC. Not milliseconds | 1796428800 |
There's no exp, aud or sub. That's the main difference from a Sign in with Apple client secret, which is signed the same way with a different key.
The 20 to 60 minute rule
Apple asks you to make a new token no more than once every 20 minutes and no less than once every 60. A token whose iat is more than an hour old gets ExpiredProviderToken. Changing the token more often than every 20 minutes on the same connection gets TooManyProviderTokenUpdates.
Auth key or certificate
APNs takes two kinds of credentials. The .p8 file is the auth key. The .p12 file is a push certificate with its private key, exported from Keychain Access.
| Auth key (.p8) | Certificate (.p12) | |
|---|---|---|
| Expires | Never, until you revoke it | After a year; Apple says to renew it before then |
| Apps | Every app in the team, or the topics you pick | One app per certificate |
| Servers | New keys: Sandbox or Production. Older keys: both | Sandbox and Production |
| Push types | Apple: "token-based connection supports all push-types" | A subset, listed in the certificate |
| How many | Team-scoped: 2 per environment. Topic-specific: 200 per environment, up to 400 topics each | A separate one for each app |
| Download | Once; Apple doesn't keep a copy | Export from Keychain Access on the Mac that made the request |
Apple's own page says it's often simpler to use token-based authentication for several apps. Unless a service you use only takes certificates, use the key.
Team-scoped and topic-specific keys
When you make an APNs key, Apple asks for the environment and the type. Apple's current docs say a team-scoped key works on either Sandbox or Production, for every app in the team, including apps you add later. A topic-specific key works in one environment for the bundle IDs you list. Older keys that work on both servers keep working, though Apple recommends a separate key per environment. If the tester says your key works on one server only, that's the reason.
Using the key with Firebase
- In the Firebase console, open Settings, General, then the Cloud Messaging tab.
- Under APNs authentication key in the iOS app configuration, click Upload. Firebase takes a development key, a production key, or both, and at least one is required.
- Choose the .p8 file, add its Key ID, and click Upload.
If Firebase pushes fail with an auth error, test the same key here. When Apple accepts it on the server Firebase uses, the key, Key ID and Team ID are right. Send a test push here to check the bundle ID, then check the Firebase settings.
APNs errors about keys and tokens
| Reason | Status | Apple's words | What to do |
|---|---|---|---|
InvalidProviderToken | 403 | The provider token is not valid, or the token signature can't be verified. | Check the Key ID and Team ID match the key, and the key isn't revoked |
ExpiredProviderToken | 403 | The provider token is stale and a new token should be generated. | Sign a new token; check the server's clock and that iat is in seconds |
MissingProviderToken | 403 | No provider certificate was used to connect to APNs, and the authorization header is missing or no provider token is specified. | Send authorization: bearer <token> |
BadEnvironmentKeyIdInToken | 403 | The key ID in the provider token doesn't match the environment. | Use the key made for this server, or the other server |
UnrelatedKeyIdInToken | 403 | The key ID in the provider token isn't related to the key ID of the token used in the first push of this connection. | Open a new connection for the other key |
TooManyProviderTokenUpdates | 429 | The provider's authentication token is being updated too often. | Reuse one token for at least 20 minutes |
BadDeviceToken | 400 | The specified device token is invalid. Verify that the request contains a valid token and that the token matches the environment. | Send Xcode builds' tokens to Sandbox and TestFlight or App Store tokens to Production |
DeviceTokenNotForTopic | 400 | The device token doesn't match the specified topic. | Use the bundle ID of the app that made the token |
TopicDisallowed | 400 | Pushing to this topic is not allowed. | Check the bundle ID; a topic-specific key pushes only to the topics picked for it |
Unregistered | 410 | The device token is inactive for the specified topic. | Stop sending to it until the app sends a new token |
Sources, checked 6 December 2026: Apple's Establishing a token-based connection to APNs, Sending notification requests to APNs, Handling notification responses from APNs, Establishing a certificate-based connection to APNs, aps-environment, Communicate with APNs using authentication tokens, Communicate with APNs using a TLS certificate, Create a private key to access a service and Team ID; Firebase's Set up a Firebase Cloud Messaging client app on Apple platforms.
Where Hailbell fits
Hailbell sends push notifications to your iOS, Android and web apps from one dashboard, the API or your AI agent, and takes the same .p8 key, Key ID and Team ID in Settings › Push keys. It tries the key with Apple before saving it, the way this tester does, so a wrong Key ID shows up at setup instead of as silent failed pushes. It also puts a support chat in your app. Hailbell has a 14-day free trial, no card needed. See how it works.
Questions
What is an APNs auth key?
It's the .p8 file you download from the Keys page of your Apple developer account with Apple Push Notifications service ticked. Your server uses it to sign a short JSON Web Token, the provider token, and sends that token with every push. Apple calls it the APNs authentication token signing key. The other way to connect to APNs is a certificate for each app.
Does the APNs auth key expire?
No. Apple's help page says the signing key doesn't expire, but can be revoked. What expires is each provider token you sign with it: APNs refuses a token whose iat is more than an hour old. Push certificates are different: Apple says they're valid for a year and you must renew them.
Can I use one APNs key for all my apps?
Yes, for every app in the same Apple developer team. A team-scoped key works for all existing and new apps in the team, on one server, Sandbox or Production, so you make one key per server. A topic-specific key works only for the apps you pick when you create it. Apps in another team need that team's own key, and Apple says one connection can't mix teams.
Sandbox or Production: which server do I use?
It depends on the build that made the device token. Apple says a development provisioning profile uses the development environment, also called Sandbox, and the production profile and TestFlight builds use production. So a build you run from Xcode needs api.sandbox.push.apple.com, and TestFlight and App Store builds need api.push.apple.com. A token sent to the wrong server gets BadDeviceToken.
Is it safe to put my .p8 key in this page?
The key never leaves your browser. The page reads it with Web Crypto and signs the provider token in the same tab. When you press Test with Apple or Send test push, only that token, your bundle ID and, for a push, the device token and message go to our server, which passes them to Apple and keeps nothing. The token stops working an hour after it was made. You can watch the Network tab in your browser's developer tools to see exactly what's sent.
How do I send a test push notification?
Load your key above, get the device token your app received from registerForRemoteNotifications, as hex, and paste it under Send a test push. Pick Sandbox for a build you ran from Xcode or Production for TestFlight and the App Store, type a title and press Send test push. Apple answers 200 when it accepts the push. The page also writes the same request as a curl command for your own terminal.
More free tools for app developers: all free tools. Questions about push in your app? Start a chat with us.