> For the complete documentation index, see [llms.txt](https://docs.terrakube.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.terrakube.io/api/methods/ssh-key.md).

# SSH Key

This endpoint is used to create, update, search or delete ssh keys.

{% hint style="warning" %}
To use this endpoint you should have "manageVcs" access at team level and a Terrakube Organization
{% endhint %}

### Entity fields:

| Path                        | Type   | Description                                       |
| --------------------------- | ------ | ------------------------------------------------- |
| data.type                   | string | Should be "ssh"                                   |
| data.attributes.name        | string | Unique ssh key name for an Terrakube organization |
| data.attributes.description | string | Free text for description                         |
| data.attributes.privateKey  | string | SSH Key content                                   |
| data.attributes.sshType     | string | rsa or ed25519                                    |

### Example:

```
{
  "data": {
    "type": "ssh",
    "attributes": {
      "name": "Sample SSH Key",
      "description": "SSH Key Description",
      "privateKey": "{{sshPrivateKey}}",
      "sshType": "{{sshKeyType}}"
    }
  }
}
```

### Supported Operations

## GET /organization/{organizationId}/ssh

> Returns the relationship ssh

```json
{"openapi":"3.0.1","info":{"title":"Elide Service","version":"0.0.1"},"tags":[{"name":"ssh"}],"servers":[{"url":"/api/v1"}],"paths":{"/organization/{organizationId}/ssh":{"get":{"tags":["ssh"],"description":"Returns the relationship ssh","parameters":[{"name":"sort","in":"query","description":"Sorts the collection on the selected attributes.  A prefix of '-' sorts descending","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["createdBy","-createdBy","description","-description","name","-name","privateKey","-privateKey","updatedBy","-updatedBy","id","-id"]}}},{"name":"fields[ssh]","in":"query","description":"Selects the set of ssh fields that should be returned in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["createdBy","createdDate","description","name","privateKey","sshType","updatedBy","updatedDate","organization"]}}},{"name":"include","in":"query","description":"Selects the set of relationships that should be expanded as a compound document in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["organization"]}}},{"name":"filter[ssh]","in":"query","description":"Filters the collection of ssh using a 'disjoint' RSQL expression","schema":{"type":"string"}},{"name":"page[number]","in":"query","description":"Number of pages to return.  Can be used with page[size]","schema":{"type":"integer","format":"int32"}},{"name":"page[size]","in":"query","description":"Number of elements per page.  Can be used with page[number]","schema":{"type":"integer","format":"int32"}},{"name":"page[offset]","in":"query","description":"Offset from 0 to start paginating.  Can be used with page[limit]","schema":{"type":"integer","format":"int32"}},{"name":"page[limit]","in":"query","description":"Maximum number of items to return.  Can be used with page[offset]","schema":{"type":"integer","format":"int32"}},{"name":"page[totals]","in":"query","description":"For requesting total pages/records be included in the response page meta data","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ssh"}},"included":{"uniqueItems":true,"type":"array","description":"Included resources","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"type":"object"},"relationships":{"type":"object"}}}}}}}}}}}}},"components":{"schemas":{"ssh":{"type":"object","properties":{"type":{"type":"string","description":"Create Permissions : (team manage ssh)\nDelete Permissions : (team manage ssh)"},"id":{"type":"string"},"attributes":{"type":"object","properties":{"createdBy":{"type":"string","description":"Read Permissions : (team view ssh)\nUpdate Permissions : (team manage ssh)","readOnly":false,"writeOnly":false},"createdDate":{"type":"string","description":"Read Permissions : (team view ssh)\nUpdate Permissions : (team manage ssh)","readOnly":false,"writeOnly":false},"description":{"type":"string","description":"Read Permissions : (team view ssh)\nUpdate Permissions : (team manage ssh)","readOnly":false,"writeOnly":false},"name":{"type":"string","description":"Read Permissions : (team view ssh)\nUpdate Permissions : (team manage ssh)","readOnly":false,"writeOnly":false},"privateKey":{"type":"string","description":"Read Permissions : (read private key)\nUpdate Permissions : (team manage ssh)","readOnly":false,"writeOnly":false},"sshType":{"type":"string","description":"Read Permissions : (team view ssh)\nUpdate Permissions : (team manage ssh)","readOnly":false,"writeOnly":false,"enum":["rsa","ed25519"]},"updatedBy":{"type":"string","description":"Read Permissions : (team view ssh)\nUpdate Permissions : (team manage ssh)","readOnly":false,"writeOnly":false},"updatedDate":{"type":"string","description":"Read Permissions : (team view ssh)\nUpdate Permissions : (team manage ssh)","readOnly":false,"writeOnly":false}}},"relationships":{"type":"object","properties":{"organization":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["organization"]},"id":{"type":"string"}},"description":"Read Permissions : (team view ssh)\nUpdate Permissions : (team manage ssh)","readOnly":false,"writeOnly":false}}}}}}}}}}}
```

{% openapi src="/files/w7UwhVqVh1io56WMn611" path="/organization/{organizationId}/ssh" method="post" %}
[v2\_6.yaml](https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-cbcb0b1bcdefad8f4d123fc3cda02bf617d62c95%2Fv2_6.yaml?alt=media)
{% endopenapi %}

{% openapi src="/files/w7UwhVqVh1io56WMn611" path="/organization/{organizationId}/ssh/{sshId}" method="delete" %}
[v2\_6.yaml](https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-cbcb0b1bcdefad8f4d123fc3cda02bf617d62c95%2Fv2_6.yaml?alt=media)
{% endopenapi %}

{% openapi src="/files/w7UwhVqVh1io56WMn611" path="/organization/{organizationId}/ssh/{sshId}" method="patch" %}
[v2\_6.yaml](https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-cbcb0b1bcdefad8f4d123fc3cda02bf617d62c95%2Fv2_6.yaml?alt=media)
{% endopenapi %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.terrakube.io/api/methods/ssh-key.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
