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

# Crea o aggiorna un secret

> Scrivi un valore secret. In rotazione sovrascrive il valore esistente.

**`PUT`** `https://api-datahub.octoparse.com/v1/secrets/{name}`

Autenticazione: API key obbligatoria (`Authorization: Bearer <API Key>`).

Crea o ruota un secret con credenziali upstream. Il testo in chiaro viene accettato in scrittura e mai restituito in lettura.

## Richiesta

### Parametri di percorso

<ParamField path="name" type="string" required>
  Nome secret. Letters, digits, and underscore. Referenced by apps as `env.<name>`.
</ParamField>

### Body della richiesta

<ParamField body="value" type="string" required>
  Valore secret in chiaro.
</ParamField>

### Esempio di richiesta

```bash theme={null}
curl -X PUT   -H "Authorization: Bearer $OCTOPARSE_API_KEY"   -H "Content-Type: application/json"   -d '{"value": "sk-live-example"}'   "https://api-datahub.octoparse.com/v1/secrets/EXAMPLE_API_KEY"
```

## Risposta

### 200 successo

```json theme={null}
{
  "data": {
    "name": "EXAMPLE_API_KEY",
    "mask": "sk-****mple",
    "updated_at": "2026-09-01T08:00:00+00:00"
  }
}
```

Il payload è wrappato in `data`. Campi:

<ResponseField name="name" type="string" required>
  Nome secret.
</ResponseField>

<ResponseField name="mask" type="string" required>
  Valore mascherato dopo la scrittura.
</ResponseField>

<ResponseField name="updated_at" type="string" required>
  Ora di aggiornamento, ISO 8601.
</ResponseField>

### Errori

| HTTP | `code`          | `category`      | Descrizione                    |
| ---- | --------------- | --------------- | ------------------------------ |
| 400  | `invalid-input` | `invalid_input` | Nome o valore non valido.      |
| 401  | `unauthorized`  | `forbidden`     | API key mancante o non valida. |

Le risposte di errore usano `{"error": {code, category, message, retryable}}`. Vedi <a href="/docs/it/datahub/api/reference/introduction#errors">Errori</a>.

## Librerie client

Gli SDK Python e JavaScript non wrappano ancora questo endpoint. Chiama REST direttamente.
