---
title: "Generate or rotate a site's SFTP password (plaintext returned once with Cache-Control: no-store)"
---

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

Path: Hosted EZ REST API

`POST /v1/sites/{siteId}/sftp/password`

## Authentication

- `sessionCookie`, apiKey, in cookie

## Path parameters

- `rotateSiteSFTPPassword.path.siteId` (string, required) — Site slug (sit_...) or UUID.

## Code samples

### cURL

```curl
curl --request POST \
  --url https://api.hostedez.com/v1/sites/string/sftp/password \
  --header '__Secure-better-auth.session_token: <value>'
```

### TypeScript

```typescript
const url = 'https://api.hostedez.com/v1/sites/string/sftp/password';
const options = {method: 'POST', headers: {'__Secure-better-auth.session_token': '<value>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.hostedez.com/v1/sites/string/sftp/password"

headers = {"__Secure-better-auth.session_token": "<value>"}

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

print(response.text)
```

## Responses

### 200

Newly generated SFTP password

#### Example

```json
{
  "host": "string",
  "password": "string",
  "passwordRotatedAt": "2019-08-24T14:15:22Z",
  "port": 0,
  "username": "string"
}
```

- `rotateSiteSFTPPassword.response.200.host` (string, required)
- `rotateSiteSFTPPassword.response.200.password` (string, required)
- `rotateSiteSFTPPassword.response.200.passwordRotatedAt` (string, required)
  - format `date-time`
- `rotateSiteSFTPPassword.response.200.port` (integer, required)
- `rotateSiteSFTPPassword.response.200.username` (string, required)

### 400

Invalid request

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string"
  }
}
```

- `rotateSiteSFTPPassword.response.400.error` (object, required)
  - `rotateSiteSFTPPassword.response.400.error.code` (string, required)
  - `rotateSiteSFTPPassword.response.400.error.message` (string, required)
  - `rotateSiteSFTPPassword.response.400.error.issues` (array<object>, optional)
    - `rotateSiteSFTPPassword.response.400.error.issues.message` (string, required)
    - `rotateSiteSFTPPassword.response.400.error.issues.path` (string, required)

### 401

Unauthenticated

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string"
  }
}
```

- `rotateSiteSFTPPassword.response.401.error` (object, required)
  - `rotateSiteSFTPPassword.response.401.error.code` (string, required)
  - `rotateSiteSFTPPassword.response.401.error.message` (string, required)
  - `rotateSiteSFTPPassword.response.401.error.issues` (array<object>, optional)
    - `rotateSiteSFTPPassword.response.401.error.issues.message` (string, required)
    - `rotateSiteSFTPPassword.response.401.error.issues.path` (string, required)

### 403

Forbidden origin

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string"
  }
}
```

- `rotateSiteSFTPPassword.response.403.error` (object, required)
  - `rotateSiteSFTPPassword.response.403.error.code` (string, required)
  - `rotateSiteSFTPPassword.response.403.error.message` (string, required)
  - `rotateSiteSFTPPassword.response.403.error.issues` (array<object>, optional)
    - `rotateSiteSFTPPassword.response.403.error.issues.message` (string, required)
    - `rotateSiteSFTPPassword.response.403.error.issues.path` (string, required)

### 404

Site not found

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string"
  }
}
```

- `rotateSiteSFTPPassword.response.404.error` (object, required)
  - `rotateSiteSFTPPassword.response.404.error.code` (string, required)
  - `rotateSiteSFTPPassword.response.404.error.message` (string, required)
  - `rotateSiteSFTPPassword.response.404.error.issues` (array<object>, optional)
    - `rotateSiteSFTPPassword.response.404.error.issues.message` (string, required)
    - `rotateSiteSFTPPassword.response.404.error.issues.path` (string, required)


Source: https://docs.hostedez.com/api/rotateSiteSFTPPassword/index.md
