Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Upload SSH personal and SSH access keys in Bitbucket Server using REST API endpoints

How to add an SSH key

To upload an SSH access key for a project, the REST API endpoint to use is:

POST /rest/keys/1.0/projects/{projectKey}/ssh

With a payload similar to the following payload:

    "key": {
        "text": "ssh-rsa AAAAB3... me@"
    "permission": "PROJECT_READ"


To add an SSH access key to a repository, we can use:

POST /rest/keys/1.0/projects/{projectKey}/repos/{repositorySlug}/ssh

And this payload:

    "key": {
        "text": "ssh-rsa AAAAB3... me@"
    "permission": "REPO_WRITE"


And finally to add an SSH personal key for a user, this is the command:

POST /rest/ssh/1.0/keys?user=username

With a payload similar to:

    "text": "ssh-rsa AAAAB3... me@"


One full example

When using curl, the full command to add an SSH access key on a project looks like this:

curl --user <user>:<password> -H "Content-Type: application/json" --data @input.json -X POST <Bitbucket URL>/rest/keys/1.0/projects/{projectKey}/repos/{repositorySlug}/ssh

More details

SSH keys in Bitbucket Server

There are two different types of SSH keys that can be set up as described on the Controlling access to code and Using SSH keys to secure Git operations:

- SSH personal keys

- SSH access keys


SSH keys REST API endpoints

Both of these access keys can be managed by using the REST API endpoints described on the Bitbucket Server - SSH page.

Just one of the multiple set of endpoints available on the Bitbucket Server REST APIs list.



Log in or Sign up to comment
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

2,149 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you