> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# VastAI.attach_ssh

Attach an SSH key to an instance.

## Signature

```python theme={null}
VastAI.attach_ssh(instance_id: int, ssh_key: str) -> str
```

## Parameters

<ParamField path="instance_id" type="int" required>
  instance\_id
</ParamField>

<ParamField path="ssh_key" type="str" required>
  ssh\_key
</ParamField>

## Returns

`str`, Result from the API call.

## Example

```python theme={null}
from vastai import VastAI

client = VastAI(api_key="YOUR_API_KEY")
result = client.attach_ssh(instance_id=12345, ssh_key="...")
print(result)
```
