Skip to main content

Is there a way to get a project's additional SSH keys via the API?

Additional SSH Keys via API

You can retrieve a project's additional SSH keys via the CircleCI API. You can use the GET request to list checkout keys for a specific project. Here is the curl command for this request:

curl https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/checkout-key?digest=sha256 -H "Circle-Token: <circle-token>"

This will return an array of checkout keys for the specified project. The digest parameter is optional and defaults to 'md5'. You can pass 'sha256' to return the SHA-256 key fingerprint.

If you want to get an individual checkout key, you can use the following GET request:

curl https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/checkout-key/:fingerprint -H "Circle-Token: <circle-token>"

In this request, you need to supply the fingerprint as a path parameter. The fingerprint can be of type md5 or sha256. sha256 fingerprints should be URL-encoded.

Please replace :vcs-type, :username, :project, :fingerprint, and <circle-token> with your actual values.

Additional Resources

For more details, you can refer to the CircleCI API documentation.

Did this answer your question?