> ## Documentation Index
> Fetch the complete documentation index at: https://www.referly.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your Apple account

> Create the App Store Connect API key and the push notification (APNs) key Referly needs to build, submit and send notifications for your branded app, and upload both to the Publish step.

Referly builds, uploads and submits your app with two keys from your Apple account instead of your password. You create each key once. This covers steps 2 and 3 of the **Apple** part of the Publish step.

**Before you start**

* Your company is enrolled in the Apple Developer Program and your **Team ID** is saved in Referly. See [Join the Apple Developer Program](https://www.referly.so/docs/help-center/mobile/publish/apple-developer-account.md).
* You're the Account Holder or an Admin of the Apple team.
* Apple lets you download each key file **once**. Keep it until you've uploaded it to Referly, then delete it.

> [!NOTE]
>
> App Store Connect and the Apple Developer site only show these pages after you sign in, so the Apple-side steps are written out. The screenshots show where each value goes in Referly.

## Create the App Store Connect key

This key lets Referly register your app's capabilities, create its signing certificate, upload builds to TestFlight, fill in your App Store page and submit it for review.

1. Open [App Store Connect → Users and Access → Integrations](https://appstoreconnect.apple.com/access/integrations/api). The page opens on **App Store Connect API**.
2. The first time only, the Account Holder selects **Request Access**, accepts the terms and selects **Submit**. Apple reviews the request; it's usually approved quickly.
3. Select **Team Keys**, then **Generate API Key** (or **+** if you already have keys).
4. **Name:** anything you'll recognise, such as `Referly publishing`. **Access:** **Admin**. Referly needs Admin to create your app's signing certificate.
5. Select **Generate**.
6. In the new row, select **Download API Key**. The file is called `AuthKey_XXXXXXXXXX.p8`.
7. Copy two values from the same page:
   * **Key ID**: the 10 characters in the key's row (also in the file name).
   * **Issuer ID**: the long ID with dashes shown above the list of keys.

Then in Referly, under **Create the App Store Connect key**:

![Step 2 of the Apple part in Referly with the Key ID and Issuer ID fields and the Upload AuthKey\_XXXX.p8 button](https://mintcdn.com/pushlapgrowth/qFsunRhIHLiQtJUe/images/help-center/mobile/publish/apple-api-key.png?fit=max\&auto=format\&n=qFsunRhIHLiQtJUe\&q=85\&s=3d50086c0112f16b3dc077696e8f2745)

1. Paste the **Key ID**.
2. Paste the **Issuer ID**.
3. Select **Upload AuthKey\_XXXX.p8** and choose the file.

Referly checks the key with Apple straight away. When it works, the step shows **Checked with Apple** and turns green.

## Create the push notification key

This key lets your app receive notifications on iPhones. One key works for every app on your team, so if you already have one and still have its file, you can upload that.

1. Open [Certificates, Identifiers & Profiles → Keys](https://developer.apple.com/account/resources/authkeys/list) and select **+**.
2. **Key Name:** for example `Referly push`.
3. Tick **Apple Push Notifications service (APNs)** and select **Configure** next to it.
4. Choose the environment **Sandbox & Production** and the key type **Team Scoped (All Topics)**, then confirm.
5. Select **Continue**, then **Register**.
6. Select **Download**. The file is called `AuthKey_YYYYYYYYYY.p8`.
7. Note the **Key ID** shown on the key's page.

Then in Referly, under **Create the push notification key**:

![Step 3 of the Apple part in Referly with the Key ID field and the Upload AuthKey\_XXXX.p8 button](https://mintcdn.com/pushlapgrowth/qFsunRhIHLiQtJUe/images/help-center/mobile/publish/apple-push-key.png?fit=max\&auto=format\&n=qFsunRhIHLiQtJUe\&q=85\&s=120faa2cd622be47ba2288dce3a62e9e)

1. Paste the **Key ID**.
2. Select **Upload AuthKey\_XXXX.p8** and choose the file.

This step stays locked until your Team ID is saved, because the key belongs to your team. Apple has no way to check a push key without a phone, so Referly saves it as it is; the test notification in [Build and test your app](https://www.referly.so/docs/help-center/mobile/publish/build-and-test.md#send-yourself-a-test-push) proves it works.

## What Referly does with the keys

* Both files are stored encrypted and only used to build, publish and notify for this app.
* When it builds, Referly turns on **Push Notifications**, **Associated Domains** (so portal links open the app) and **Sign in with Apple** for your bundle ID, and creates a distribution certificate and an App Store provisioning profile.
* You can revoke a key at any time in your Apple account. Referly then can't build or notify until you upload a new one.

Next: [Create your app in App Store Connect](https://www.referly.so/docs/help-center/mobile/publish/app-store-connect-app.md).

## If Apple rejects the key

* **"Apple rejected this key … Make sure the key has the Admin role."** The key's access is below Admin, or the Key ID, Issuer ID and file don't belong together. A key's access can't be changed: revoke it, generate a new Admin key and upload that.
* **"That is not a .p8 private key file."** You picked a different file. Use the `AuthKey_….p8` you downloaded.
* **A build fails with "already has 3 distribution certificates".** Apple allows three distribution certificates per team and Referly creates one per app. Revoke one you no longer use at **Certificates, Identifiers & Profiles → Certificates**, then build again.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.