App Store Connect API - create certificate from CSR

Hi,

i am trying to upload certificate signing request (CSR) for Pass Type ID via API, using this endpoint https://api.appstoreconnect.apple.com/v1/certificates. Request body looks like this, with POST method and content type application/json:

{
    "data": {
        "attributes": {
            "certificateType": "PASS_TYPE_ID",
            "csrContent": "LS0tL...S0tLS0K"
        },
        "type": "certificates"
    }
}

csrContent is base64 encoded.

The response from API is:

{
  "errors" : [ {
    "id" : "71a...4c9",
    "status" : "404",
    "code" : "NOT_FOUND",
    "title" : "The specified resource does not exist",
    "detail" : "There is no identifier with ID 'null' on this team."
  } ]
}

CSR was created with KeyChain on Mac (as described here: https://developer.apple.com/help/account/create-certificates/create-a-certificate-signing-request), but i can also do it with OpenSSL.

First of all, there is no pairing information between Pass Type Identifier and certificate in request. Status 404? I would expect 400. And given detail is totally useless... The documentation is poor for this topic: https://developer.apple.com/documentation/appstoreconnectapi/create_a_certificate. So that brings me to the idea of adding it (Pass Type Identifier) to the CSR content, but where?

I am able to read all certificates stored via Developer Account and put them together with private keys... but storing it is pain...

Does anyone have an idea?

Post not yet marked as solved Up vote post of holdaak Down vote post of holdaak
517 views

Replies

Related: https://developer.apple.com/forums/thread/662076

Hi holdaak,

Please update your request to include the following objects:

 "relationships": {
      "passTypeId": {
        "data": {
          "type": "passTypeIds",
          "id": "<PASS_TYPE_ID>"
        }
      }

Where the <PASS_TYPE_ID> is the Wallet pass type ID as a string value. We've noted (r. 126354804) to update the documentation on App Store Connect API to reflect this expectation.

Cheers,

Paris