> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.athenaintel.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.athenaintel.com/_mcp/server.

# Create SSH access for a computer asset

POST https://api.athenaintel.com/api/v0/computer/{asset_id}/ssh-access
Content-Type: application/json

Generate a time-limited SSH access token for a computer asset. Returns a full SSH command and token that can be used to connect to the computer's underlying VM and run commands. The computer must support SSH access. If it is stopped, this call starts it first and can take as long as `start_computer`; after an explicit Stop it returns 409 until you call `start_computer`. Use `get_status` to see whether the computer is ready.

Reference: https://docs.athenaintel.com/api-reference/computer/create-ssh-access

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Path parameters

- `asset_id` (string, required)

### Body (application/json)

This endpoint expects a CreateSshAccessRequestIn.

- `expires_in_minutes` (integer, optional, nullable) — How long the SSH access token should remain valid, in minutes (1-1440). The environment may cap this lower (see `token_expiry_minutes_options` on `get_ssh_access`); omit it to get the environment's shortest offered lifetime.

## Response

### 200

Successful Response

- `command` (string, required) — Full SSH command to connect to the computer (e.g., 'ssh token@host')
- `expires_in_minutes` (integer, required) — Number of minutes until the SSH access token expires
- `token` (string, required) — SSH access token used for authentication
- `proxy_command` (string, optional, nullable) — Alternative SSH command via proxy (only available for admin users)
- `token_id` (string, optional, nullable) — Id of the minted token in `list_ssh_access_tokens`; pass it to `revoke_ssh_access_token` to revoke it without the raw token.

## Errors

### 401 Unauthorized Error

Unauthorized

- `message` (string, required)

### 404 Not Found Error

Not Found

- `message` (string, required)

### 409 Conflict Error

Conflict

- `map from string to any`

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 502 Bad Gateway Error

Bad Gateway

- `map from string to any`

## Types

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (ValidationErrorCtx, optional)
- `input` (any, optional)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

## Examples

**Request**

```json
{
  "expires_in_minutes": 60
}
```

**Response**

```json
{
  "command": "ssh abc123token@ssh.example.com",
  "expires_in_minutes": 60,
  "token": "abc123token",
  "token_id": "3f2a9c0d1b7e4a55"
}
```

**SDK Code**

```python
import requests

url = "https://api.athenaintel.com/api/v0/computer/asset_id/ssh-access"

payload = { "expires_in_minutes": 60 }
headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.athenaintel.com/api/v0/computer/asset_id/ssh-access';
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"expires_in_minutes":60}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.athenaintel.com/api/v0/computer/asset_id/ssh-access"

	payload := strings.NewReader("{\n  \"expires_in_minutes\": 60\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.athenaintel.com/api/v0/computer/asset_id/ssh-access")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"expires_in_minutes\": 60\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.athenaintel.com/api/v0/computer/asset_id/ssh-access")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"expires_in_minutes\": 60\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.athenaintel.com/api/v0/computer/asset_id/ssh-access', [
  'body' => '{
  "expires_in_minutes": 60
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.athenaintel.com/api/v0/computer/asset_id/ssh-access");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"expires_in_minutes\": 60\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["expires_in_minutes": 60] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.athenaintel.com/api/v0/computer/asset_id/ssh-access")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```