---
title: "Set a secret"
method: PUT
path: "/websites/{websiteId}/secrets/{name}"
tags: ["Secrets"]
---

# Set a secret

`PUT /websites/{websiteId}/secrets/{name}`

## Request

- Base URL: `https://api.cactal.ai/v1`
- URL: `https://api.cactal.ai/v1/websites/{websiteId}/secrets/{name}`
- Auth: HTTP bearer

Creates or replaces the secret with this name. Names start with a letter or underscore and contain only letters, digits, and underscores. Values are up to 16,384 characters; they are stored encrypted, redacted from function output when 8 or more characters, and never returned. At most 100 secrets per website.

## Path parameters

- `websiteId` string, required
- `name` string, required

## Request body

- object
  - `value` string, required: The secret value. It is stored encrypted and never returned.

## Response `200`

The secret name and timestamps.

- object
  - `name` string, required
  - `createdAt` string, required
  - `updatedAt` string, required

## Other responses

- `400`: Validation failed. The response `message` names the first invalid field.
- `401`: Missing, invalid, expired, or revoked API key.
- `403`: The authenticated principal lacks the required capability.
- `404`: The resource does not exist or is outside the principal’s access scope.
- `429`: Rate limit exceeded. Retry after the number of seconds in the `Retry-After` header.

---

[API](https://skmtc.dev/cactal/apis/cactal-api.md) · [All operations](https://skmtc.dev/cactal/apis/cactal-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cactal/apis/cactal-api/revisions/9cd0fb5eacdd?raw)
