title: How to delete/remove/unlink/unversion a package from the Github Package Registry
body: <p><strong>Question:</strong> How can I make a package "disappear" from Github Package Registry?</p>
  
  <ul>
  <li><a href="https://help.github.com/en/github/managing-packages-with-github-packages/deleting-a-package" rel="noreferrer">Documentation</a> says: You cannot "delete" but a package "disappears" when all versions are removed.</li>
  </ul>
  
  <p><strong>Background:</strong></p>
  
  <ul>
  <li>A typo in the Gradle publish task resulted in the release of packages which should not be published.</li>
  </ul>
  
  <p><strong>Steps so far:</strong></p>
  
  <ul>
  <li>I did not find a "delete" option on the Github Web App.</li>
  <li>I tried to delete via the GraphQL API of Github but I need a package ID for this command:</li>
  </ul>
  
  <pre><code>curl -X POST \
  -H "Accept: application/vnd.github.package-deletes-preview+json" \
  -H "Authorization: bearer ACCESS_TOKEN" \
  -d '{"query":"mutation { deletePackageVersion(input:{packageVersionId:\"PACKAGE_ID==\"}) { success }}"}' \
  https://api.github.com/graphql
  </code></pre>
  
  <ul>
  <li>I did not find the full packageVersionId on the Github Web App.</li>
  <li>I tried to query the API for the Package IDs but failed to form a valid query:</li>
  </ul>
  
  <pre><code>curl -X POST \
  -H "Accept: application/vnd.github.package-deletes-preview+json" \
  -H "Authorization: bearer ACCESS_TOKEN" \
  -d "query {
    organization(login: "ORGANIZATION_ACCOUNT") {
      registryPackages {
        edges {
          node {
            name
            id
          }
        }
      }
    }
  }" \
  https://api.github.com/graphql
  
  # The API returns:
  {
    "message": "Problems parsing JSON",
    "documentation_url": "https://developer.github.com/v4"
  }
  </code></pre>
  
  <ul>
  <li>I tried to use the GraphQL API Explorer but I the automatically set up token misses the sufficient rights:</li>
  </ul>
  
  <pre><code># See query above - the API returns via the Explorer:
  {
    "errors": [
      {
        "type": "INSUFFICIENT_SCOPES",
        "locations": [
          {
            "line": 6,
            "column": 11
          }
        ],
        "message": "Your token has not been granted the required scopes to execute this query. The 'name' field requires one of the following scopes: ['read:packages'], but your token has only been granted the: ['read:gpg_key', 'read:org', 'read:public_key', 'read:repo_hook', 'repo', 'user'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."
      },
      {
        "type": "INSUFFICIENT_SCOPES",
        "locations": [
          {
            "line": 7,
            "column": 11
          }
        ],
        "message": "Your token has not been granted the required scopes to execute this query. The 'id' field requires one of the following scopes: ['read:packages'], but your token has only been granted the: ['read:gpg_key', 'read:org', 'read:public_key', 'read:repo_hook', 'repo', 'user'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."
      }
    ]
  }
  </code></pre>
  
  <ul>
  <li>I did not find an option on the Explorer Web App to set another access token.</li>
  </ul>
  
  <p><strong>Desired Solution</strong></p>
  
  <ul>
  <li>I like to know if there is a simpler way to do this and if not, how to get the packageVersionIds required to un-link the packages so that they disappear.</li>
  </ul>
  
  <p><strong>Update1:</strong> It's about packages published to a <strong>public repository</strong>.</p>