Documentation (2024.2 Enterprise)

# SSH Key

An SSH key is used for authenticating an account (a user or a bot) when accessing repositories over SSH.

- Attributes
- Operations
  - For current user
    - `GET /account/ssh_keys`
    - `GET /account/ssh_keys/:id`
    - `POST /account/ssh_keys`
    - `PUT /account/ssh_keys/:id`
    - `DELETE /account/ssh_keys/:id`

## Attributes

### id

A URL-friendly identifier of the key.

- Type: `string`
- Unique: `true`
- Immutable: `true`

### title

A human-readable name of the SSH key (for example, "Macbook @ work")

- Type: `string`
- Required: `true`
- Maximum length: `50`

### content

The actual contents of the public key. Must be in OpenSSH format. Must be either an RSA key (`ssh rsa...`) or a DSA key (`ssh-dss...`).

- Type: `string`
- Required: `true`
- Minimum length: `380`
- Maximum length: `1500`

## Operations

### For current user

This endpoint supports both Users and Collaborators.

#### GET /account/ssh_keys

Returns all the SSH keys of a user, with optional limit and offset parameters, as a metadata-results object.

##### Example request

    curl -X GET \
      -H "Accept: application/vnd.hth.v1" \
      -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
      https://helixteamhub.cloud/api/account/ssh_keys

##### Example response

    {
      "metadata": {
        "more_results": false,
        "next_offset": 2,
        "count": 2
      },
      "results": [
        {
          "api_status": 200,
          "api_timestamp": "2012-10-24T14:03:48Z",
          "id": "51b9d9d21cf35908d0000134",
          "created_at": "2012-10-24T14:03:48Z",
          "updated_at": "2012-10-24T14:03:48Z",
          "title": "My work laptop",
          "content": "ssh-rsa ... norris@NorrisMacBookPro"
        },
        {
          "api_status": 200,
          "api_timestamp": "2012-10-24T14:03:48Z",
          "id": "512786801229c077f6002480",
          "created_at": "2012-10-24T14:03:48Z",
          "updated_at": "2012-10-24T14:03:48Z",
          "title": "My desktop computer at home",
          "content": "ssh-dss ... chuck@homecomp"
        }
      ]
    }

#### GET /account/ssh_keys/:id

Returns one SSH key, based on its id.

##### Example request

    curl -X GET \
      -H "Accept: application/vnd.hth.v1" \
      -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
      https://helixteamhub.cloud/api/account/ssh_keys/51b9d9d21cf35908d0000134

##### Example response

    {
      "api_status": 200,
      "api_timestamp": "2012-10-24T14:03:48Z",
      "id": "51b9d9d21cf35908d0000134",
      "created_at": "2012-10-24T14:03:48Z",
      "updated_at": "2012-10-24T14:03:48Z",
      "title": "My work laptop",
      "content": "ssh-rsa ... norris@NorrisMacBookPro"
    }

#### POST /account/ssh_keys

Creates a new SSH key for the user. Returns the created SSH key object.

##### Example request

    curl -X POST \
      -H "Accept: application/vnd.hth.v1" \
      -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
      -H "Content-Type: application/json" \
      -d '{ "title": "My IPad2", "content": "ssh-rsa ... norris@NorrisIPad"}' \
      https://helixteamhub.cloud/api/account/ssh_keys

##### Example response

    {
      "api_status": 201,
      "api_timestamp": "2012-10-24T14:03:48Z",
      "id": "51b9d9d21cf35908d0000134",
      "created_at": "2012-10-24T14:03:48Z",
      "updated_at": "2012-10-24T14:03:48Z",
      "title": "My IPad2 Pro",
      "content": "ssh-rsa ... norris@NorrisIPad"
    }

#### PUT /account/ssh_keys/:id

Updates an SSH key. Returns the updated SSH key object.

##### Example request

    curl -X PUT \
      -H "Accept: application/vnd.hth.v1" \
      -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
      -H "Content-Type: application/json" \
      -d '{ "title": "My old Macbook Pro" }'
      https://helixteamhub.cloud/api/account/ssh_keys/51b9d9d21cf35908d0000134

##### Example response

    {
      "api_status": 201,
      "api_timestamp": "2012-10-24T14:03:48Z",
      "id": "51b9d9d21cf35908d0000134",
      "created_at": "2012-10-24T14:03:48Z",
      "updated_at": "2012-10-24T14:03:48Z",
      "title": "My old Macbook Pro",
      "content": "ssh-rsa ... norris@NorrisMacBookPro"
    }

#### DELETE /account/ssh_keys/:id

Deletes an SSH key. Returns the deleted SSH key object.

##### Example request

    curl -X DELETE \
      -H "Accept: application/vnd.hth.v1" \
      -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
      https://helixteamhub.cloud/api/account/ssh_keys/51b9d9d21cf35908d0000134

##### Example response

    {
      "api_status": 200,
      "api_timestamp": "2012-10-24T14:03:48Z",
      "id": "51b9d9d21cf35908d0000134",
      "created_at": "2012-10-24T14:03:48Z",
      "updated_at": "2012-10-24T14:03:48Z",
      "title": "My work laptop",
      "content": "ssh-rsa ... norris@NorrisMacBookPro"
    }

Your search for returned results

Your search for returned results