Creating a deploy key for a repository within an organization

I can’t seem to find the documentation on how the REST API or shell can be used to create a deploy key for a repository within an organization. Any help?

I can’t get it to work, but in theory, this is the documentation:
https://docs.github.com/en/rest/reference/repos#create-a-deploy-key

I’ve filed a ticket.