News

API Now Supports SSH Keys for Droplet Creates

Posted: January 22, 20131 min read

We are excited to announce that our API now supports SSH Keys for virtual server creates. This allows customers to spin-up new servers through the API with a single or multiple SSH keys already added to the root user. When using SSH keys, we also do not email out the root password for added security as we default to SSH keys for authorization.

To get a list of your available SSH keys simply:

https://api.digitalocean.com/ssh\_keys/?client\_id=\[YOUR\_CLIENT\_ID\]&api\_key=\[YOUR\_API\_KEY\]

This will give you JSON output of all of your current keys that can be deployed during creates:

{ “status”:“OK”, “ssh_keys”:[{“id”:10,“name”:“office-imac”}, {“id”:11,“name”:“macbook-air”}]}

To use SSH keys in your create request, simply add the new paramater `ssh_key_ids` with a comma separated list of SSH Key IDs that you would like added to the new server that you will create:

https://api.digitalocean.com/droplets/new?name=\[DROPLET\_NAME\]&size\_id=\[SIZE\_ID\]&image\_id=\[IMAGE\_ID\]&region\_id=\[REGION\_ID\]&client\_id=\[YOUR\_CLIENT\_ID\]&ssh\_key\_ids=\[SSH\_KEY\_ID1\],\[SSH\_KEY\_ID2\]

In this case, if you wanted to add both the office-imac and macbook-air keys, you would add the following to your create call: ssh_key_ids=10,11

It’s just that simple to now integrate SSH Keys into your droplet creates via the API!

Share

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!Sign up

Related Articles

DigitalOcean partners with Tabnine to bring the power of AI-enabled software development to startups and developers globally
news

DigitalOcean partners with Tabnine to bring the power of AI-enabled software development to startups and developers globally

February 15, 20243 min read

Driving Inclusive Entrepreneurship with DO Impact
news

Driving Inclusive Entrepreneurship with DO Impact

February 12, 20243 min read

Turbocharge Your Business with a Black Friday Cyber Monday Deal from Cloudways
news

Turbocharge Your Business with a Black Friday Cyber Monday Deal from Cloudways

November 21, 20233 min read