400 PARAMETER_ERROR.INVALID from the NEXT Link in /v1/devices

We use Bitrise for our build pipelines and the step for building and signing the iOS app fails when calling the v1/devices endpoint. Specifically, the next endpoint from the App Store API returns this error when getting the next page of devices.

PARAMETER_ERROR.INVALID: A parameter has an invalid value: 'XXXXXXXXXXXXX' is not a valid cursor for this request

I am able to recreate this in Postman. The first query without a cursor works just fine.

https://api.appstoreconnect.apple.com/v1/devices?filter%5Bplatform%5D=IOS&filter%5Bstatus%5D=ENABLED&limit=20
{
data: [
...
],
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/devices?filter%5Bstatus%5D=ENABLED&filter%5Bplatform%5D=IOS&limit=20",
"next": "https://api.appstoreconnect.apple.com/v1/devices?filter%5Bstatus%5D=ENABLED&filter%5Bplatform%5D=IOS&cursor=XXXXXXXXXXXX&limit=20"
},
"meta": {
"paging": {
"total": 90,
"limit": 20
}
}
}

However when I try to get the next page of devices with the next URL from the App Store API I get the same error as before.

{
"errors": [
{
"id": "...",
"status": "400",
"code": "PARAMETER_ERROR.INVALID",
"title": "A parameter has an invalid value",
"detail": "'XXXXXX' is not a valid cursor for this request",
"source": {
"parameter": "cursor"
}
}
]
}

Recently I refreshed the certificates and provisioning profiles and removed outdated device listings, so this might play a role in what is happening.

Answered by brad_kwon in 830444022

After spending some hours to resolve this issue, I was able to make it working again in the Bitrise. I noticed that they mark the existing Apple code signing in each project as legacy and recommend managing it in the workspace settings.

After adding my App Store Connect API key there, it started working again with ad-hoc distribution. In my case, I created a new API key, however I hope this helps other devs.

We are experiencing the exact same issue with the same step in bitrise. I have been looking around and have seen a few other rumblings about very similar cases within the last couple days. I believe this might be due to an issue on Apple's end.

Same issue faced in Bitrise with the api-key code signing, but only ad-hoc distribution. Same api-key with the app-store distribution works as it doesn't require devices. I haven't changed anything and it starts failing with this error from 17. Mar. I am not sure which side causes this issue, however at least there is an incident reported in Bitrise.

If anyone uses Bitrise, you can subscribe it to be notified of any updates.

https://status.bitrise.io/incidents/2pb4mjklqzz0

Same for us

Accepted Answer

After spending some hours to resolve this issue, I was able to make it working again in the Bitrise. I noticed that they mark the existing Apple code signing in each project as legacy and recommend managing it in the workspace settings.

After adding my App Store Connect API key there, it started working again with ad-hoc distribution. In my case, I created a new API key, however I hope this helps other devs.

400 PARAMETER_ERROR.INVALID from the NEXT Link in /v1/devices
 
 
Q