POST /sentry-apps/ is responding with a 500 status

Hello,

I am trying to create internal integrations programmatically using the /sentry-apps/ endpoint, but I keep getting 500 Internal Server Error responses from the API at sentry.io, regardless of the body/payload I send to it. I am able to retrieve and update those integrations just fine, but not create new ones.

Questions:

  1. Is this an error on Sentry side? Or should I correct something in the payload?
  2. I couldn’t find any documentation related to this endpoint, or any API related to managing internal integrations for that matter. Are there any docs out there related to this?

Example failed request:

POST /sentry-apps/ HTTP/1.1
Host: https://sentry.io/api/0
Authorization: Bearer xxxxxxxxxxx
Content-Type: application/json

{
    "scopes": [
        "project:read",
        "team:read",
        "event:read",
        "org:read",
        "member:read"
    ],
    "isAlertable": true,
    "name": "test123",
    "webhookUrl": "https://ad33a9a4ac54.ngrok.io",
    "events": [
        "issue"
    ]
}

This endpoint responds with a 500 Internal Server Error status, and a payload like this:

{
    "detail": "Internal Error",
    "errorId": "0624bff51cf644c3b23fca61bbd89849"
}

Like mentioned above, GET and PUT requests to individual integrations work just fine, e.g.:

PUT /sentry-apps/test1-7d51c4/ HTTP/1.1
Host: https://sentry.io/api/0
Authorization: Bearer xxxxxxxxxxx
Content-Type: application/json

{
    "name": "test456"
}

This returns a 200 OK just fine, and correctly updates the integration.

The problem arises when the organization field is missing from the request payload. Make sure the organization field is present when issuing a request like this one.

The 500 error is misleading, so I created an issue for this:

And a PR to address this issue in a more graceful manner: