Cancelling an organization invitation (rest-api)

Using the REST API we are able to invite users to our organization using their email address - likewise, we can list all of the pending invitations. However, there appears to be no way to cancel a pending organization invitation via the REST API - one would have expected DELETE /org/:org/invitations/:invitation_id to be the obvious endpoint (an equivalent DELETE /repos/:owner/:repo/invitations/:invitation_id is documented), however this results in a 404.

Is there a way to do this via the REST API?

If not, it seems like a fairly large deficiency, given that they can be cancelled via the web UI.

Hi @4a6f656c Welcome to the community! We are glad you are here. You should be able to accomplish this using the invitation_id endpoint…:thinking: Are you able to see that invite on the UI https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/canceling-or-editing-an-invitation-to-join-your-organization?

Thanks for your response - yes, the invitations are visible in the UI and can be cancelled there, but unfortunately that is a manual process.

Which invitation_id endpoint are you referring to?

I am not seeing anything in https://docs.github.com/en/rest/overview/endpoints-available-for-github-apps, that would allow for for the cancellation/deletion of an organization invite.