# restore_secret_version

`tools/call` · `POST /clanker/v1/secrets:restore-version`

Restore an earlier version of a secret in one environment, as its newest version. Production needs an admin or owner. Returns the outcome without the value. Needs write access.

- Area: Vault
- Needs the write grant. Idempotent.

## Inputs

- `product` (string, required): The product's slug, such as storefront.
- `name` (string, required): The secret's name, such as DATABASE_URL.
- `environment` (string, required): The environment's slug, such as staging.
- `version` (integer, required): The version to restore, from list_secret_versions. From -9,007,199,254,740,991 to 9,007,199,254,740,991.

## Request

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "restore_secret_version",
    "arguments": {
      "product": "storefront",
      "name": "DATABASE_URL",
      "environment": "staging",
      "version": 3
    }
  }
}
```

## HTTP request

The same call over the clanker HTTP API, with a clanker OAuth access token:

```bash
curl -X POST https://api.clankership.com/clanker/v1/secrets:restore-version \
  -H "Authorization: Bearer $CLANKER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product": "storefront",
    "name": "DATABASE_URL",
    "environment": "staging",
    "version": 3
  }'
```
