Impossible to create an app via api

Hi,
I am trying to use bitrise api to create an app following this guide Adding and managing apps - Bitrise Docs

The requests to https://api.bitrise.io/v0.1/apps/register and https://api.bitrise.io/v0.1/apps/APP-SLUG/register-ssh-key both work well returning HTTP 200 OK with {“status”:“ok”} in the body. However, calling https://api.bitrise.io/v0.1/apps/APP_SLUG/finish fails with HTTP 400 {“error_msg”:“Failed to save project”}

When I check my workspace via the UI, I see the new app created but in “incomplete” state. When clicking on the details of the app, the app set up page is presented with the stage “Repository connected” being complete, the stage “Setup repository access” being open for editing and all the following stages inaccessible.

This looks very similar to the following 2 issues:

Unfortunately, neither one has a solution for the problem.

Thank you for your help

Ok, ended up finding the solution. It seems that the stack_id was invalid. The example provided in the official api guide doesn’t work Adding and managing apps - Bitrise Docs. It was actually a bit of a struggle to find the correct value. I ended up setting up a project manually to see the parameters that were passed.