SSH

Add a new SSH key

Changed on

Adds a new SSH public key to the specified user account and returns the resulting key.

Example:

$ curl -X POST -H "Content-Type: application/json" -d '{"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY user@myhost"}' https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys
post/users/{selected_user}/ssh-keys

Request

  • Base URL
    https://api.bitbucket.org/2.0
  • URL
    https://api.bitbucket.org/2.0/users/{selected_user}/ssh-keys
  • Auth
    • OAuth 2
      Authorization code: https://bitbucket.org/site/oauth2/authorize
      Token URL: https://bitbucket.org/site/oauth2/access_token scopes: account:write
    • or HTTP basic
    • or API key in header Authorization

Query parameters

expires_onstring

The date or date-time of when the key will expire, in ISO-8601 format. Example: YYYY-MM-DDTHH:mm:ss.sssZ

Request body

typestring required
uuidstring

The SSH key's immutable ID.

keystring

The SSH public key value in OpenSSH format.

commentstring

The comment parsed from the SSH key (if present)

labelstring

The user-defined label for the SSH key

created_onstring date-time
last_usedstring date-time
expires_onstring date-time
fingerprintstring

The SSH key fingerprint in SHA-256 format.

Response

The newly created SSH key.

typestring required
uuidstring

The SSH key's immutable ID.

keystring

The SSH public key value in OpenSSH format.

commentstring

The comment parsed from the SSH key (if present)

labelstring

The user-defined label for the SSH key

created_onstring date-time
last_usedstring date-time
expires_onstring date-time
fingerprintstring

The SSH key fingerprint in SHA-256 format.

Changes

    • warning

      removed the request property ///

    • warning

      removed the optional property /// from the response with the status

    • info

      api tag SSH added

    • info

      api tag Ssh removed

    • info

      added the new optional query request parameter expires_on

    • info

      added the new optional request property /

    • info

      added the new optional request property /

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status