# Retrieve an action's secret

> Use this after an action with secretAvailable true succeeds: a provision or reinstall that set a password, or a password reset with delivery api.

Source: https://docs.clouduxe.com/api/reference/server-actions/get-action-secret/

`GET /actions/{actionId}/secret`

Use this after an action with secretAvailable true succeeds: a provision or reinstall that set a password, or a password reset with delivery api. Owner tokens only, and only the token that started the action (for a provision, the token that placed the order). You may read it up to 5 times until it expires (60 minutes after the action succeeded), so a retry after a lost answer works; every read is audited. Store it, then delete it with deleteActionSecret. A 410 is final. Needs services:destructive, or orders:write for a provision action.

Token scope: `services:destructive`, `orders:write`.

### Path parameters

- `actionId` (string (uuid), required): The action's id.

### Headers

- `Clouduxe-Version` (string): The API version to use, such as 2026-12-01. Omit it to use your token's version. pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.

### Responses

- `200`: The secret.
- `400`: The request is not valid. Codes: version_invalid.
- `401`: Authentication failed. Codes: token_missing, token_invalid, token_expired, token_revoked.
- `403`: The token is not allowed to do this. Codes: forbidden, ip_not_allowed, api_access_disabled, scope_missing.
- `404`: Not found. Codes: not_found.
- `410`: Gone. Codes: secret_unavailable.
- `429`: A rate limit was reached. Codes: rate_limited.
- `500`: Unexpected error. Codes: internal_error.
- `503`: Temporarily unavailable. Codes: unavailable.

### Request

curl:
```bash
curl https://api.clouduxe.com/v1/actions/f5c8b2a1-6e3d-4c9f-b1a7-3d2e9c0f4b6a/secret \
  -H "Authorization: Bearer $CLOUDUXE_API_KEY"
```

Node SDK:
```javascript
import { Clouduxe } from "@clouduxe/sdk";

const cx = new Clouduxe({ apiKey: process.env.CLOUDUXE_API_KEY });

const actionSecret = await cx.actions.getSecret("f5c8b2a1-6e3d-4c9f-b1a7-3d2e9c0f4b6a");
```

Python:
```python
import os
import requests

res = requests.get(
    "https://api.clouduxe.com/v1/actions/f5c8b2a1-6e3d-4c9f-b1a7-3d2e9c0f4b6a/secret",
    headers={
        "Authorization": f"Bearer {os.environ['CLOUDUXE_API_KEY']}",
    },
)
actionSecret = res.json()
```

PHP SDK:
```php
<?php
require 'vendor/autoload.php';

$cx = new \Clouduxe\Clouduxe(['apiKey' => getenv('CLOUDUXE_API_KEY')]);

$actionSecret = $cx->actions->getSecret('f5c8b2a1-6e3d-4c9f-b1a7-3d2e9c0f4b6a');
```

fetch:
```javascript
const res = await fetch("https://api.clouduxe.com/v1/actions/f5c8b2a1-6e3d-4c9f-b1a7-3d2e9c0f4b6a/secret", {
  headers: {
    Authorization: `Bearer ${process.env.CLOUDUXE_API_KEY}`,
  },
});
const actionSecret = await res.json();
```

### Response (`200`)

```json
{
  "object": "action_secret",
  "actionId": "f5c8b2a1-6e3d-4c9f-b1a7-3d2e9c0f4b6a",
  "kind": "server_password",
  "username": "root",
  "password": "hV4qW9zL2mRt8KxP",
  "readsLeft": 4,
  "expiresAt": "2026-12-04T10:20:39Z"
}
```
