Creating a Github Deploy Key Using Web Services?

Attempt at using the API to Create a Deployment Key for my Repository:

So I tried the following in my github account using the Create a deploy key documentation to select the permissions.

The docs read the following:

Fine-grained access tokens for “Create a deploy key”
This endpoint works with the following fine-grained token types:

  • ...
  • Fine-grained personal access tokens
  The fine-grained token must have the following permission set:
  • "Administration" repository permissions (write)

So I did the following in my github account to set this up:

  1. Clicked my profile picture
  2. Clicked Settings
  3. Clicked Developer Settings in the right sidebar
  4. Expanded Personal Access Tokens in the right sidebar
  5. Clicked Fine-grained tokens
  6. Clicked Generate New Token

Next, I was presented with the form to create a Fine-grained token where I used the following settings:

  • Token name: jobsearch_dotfiles - Create a Deploy Key
  • Repository Access - leeand00/jobsearch_dotfiles
  • Permissions
    • Repository Permissions
      • Administration → Access Read and Write

Next, I clicked the Generate token button.

A dialog box appeared which read

New personal Access Token

Your new personal access token jobsearch_dotfiles - Create a Deploy Key will be ready immediately It will expire Wednesday, April 23, 2025.

jobsearch_dotfiles - Create a Deploy Key grants you 2 permissions for 1 repository:

Administration - Read and write
Metadata - Read-only


I then copied the personal access token tried the API call:

curl -L   -X POST   -H "Accept: application/vnd.github+json"   -H "Authorization: Bearer github_pat_..."   -H "X-GitHub-Api-Version: 2022-11-28"   https://api.github.com/leeand00/jobsearch_dotfiles/keys    -d '{"title":"leeand00@leeand00","key":"ssh-ed25519../xb..A vagrant@vagrant","read_only":true}'
{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest",
  "status": "404"
}

Still doesn’t work; any ideas what I’m doing wrong?