I tried creating a provisioning profile through App Store Connect API. Here is the body with obfuscated data that I sent to POST v1/profiles.

{
  "data": {
    "relationships": {
      "certificates": {
        "data": [
          {
            "id": "BD615443",
            "type": "certificates"
          }        ]
      },
      "bundleId": {
        "data": {
          "id": "bundle.identifier.app",
          "type": "bundleIds"
        }
      }
    },
    "attributes": {
      "profileType": "IOS_APP_STORE",
      "name": "SO Question Profile"
    },
    "type": "profiles"
  }
}

I cross verified that all the above supplied data was correct. But I ended up receiving an error response with error description - There is no App ID with ID 'com.appmysite.iaptest' on this team.

I can see that I have not made a mistake while copying and pasting the bundle ID from developer.apple.com. I have also tried the app ID (teamID.bundle.identifier.app) and also the app Apple ID (1234567) for this API field and nothing seems to work. Moreover, I am able to create a provisioning profile using the same certificate and bundle ID through App Store Connect portal. There is little to no documentation and online resources regarding this, so what exactly does Apple expect me to send as bundleId?

2

There are 2 answers

0
hsiraaH On BEST ANSWER

So, since I was sending the primaryID of the certificate that I want to use to create the provisioning profile. I thought of trying the same for the bundleID and it worked like a charm.

It is important to note that these 'primaryIds' are not exposed through App Store Connect portal and needs to be obtained using App Store Connect APIs.

For certificates you can use GET v1/certificates and for bundleIds use GET v1/bundleIds.

1
Tushar srivastava On

Double-check the bundleId field in your request payload. Make sure it matches the Bundle ID Identifier exactly as it appears in your App Store Connect account.

Verify that the App ID exists in your Apple Developer account and is associated with the correct team.

Check if there are any typos or discrepancies in the Bundle ID between your API request and your App Store Connect account.

Ensure that the App ID and Bundle ID are registered under the correct team, especially if you're working with multiple team