> ## 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.

# シークレットの作成・更新

> シークレット値を書き込み。

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

認証：APIキー必須（`Authorization: Bearer <API Key>`）。

上流資格情報シークレットを作成またはローテーション。平文は書き込み時のみ。読み取りでは返さない。

## リクエスト

### パスパラメータ

<ParamField path="name" type="string" required>
  シークレット名。英数字とアンダースコア。App からは `env.<name>`。
</ParamField>

### リクエスト body

<ParamField body="value" type="string" required>
  平文シークレット値。
</ParamField>

### リクエスト例

```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"
```

## レスポンス

### 200 成功

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

ペイロードは `data` に包まれます。フィールド:

<ResponseField name="name" type="string" required>
  Secret name.
</ResponseField>

<ResponseField name="mask" type="string" required>
  書き込み後のマスク値。
</ResponseField>

<ResponseField name="updated_at" type="string" required>
  更新時刻（ISO 8601）。
</ResponseField>

### エラー

| HTTP | `code`          | `category`      | Description    |
| ---- | --------------- | --------------- | -------------- |
| 400  | `invalid-input` | `invalid_input` | 名前または値が無効。     |
| 401  | `unauthorized`  | `forbidden`     | API キー欠落または無効。 |

エラー応答は `{"error": {code, category, message, retryable}}` です。<a href="/docs/jp/datahub/api/reference/introduction#errors">エラー</a> を参照。

## クライアントライブラリ

Python / JavaScript SDK はまだこのエンドポイントをラップしていません。REST を直接呼び出してください。
