---
search:
  tags:
    - Secrets
    - PUT
seo:
  description: >-
    Sets a secret of a tenant to the text in the body. The tenant's code reads
    it… Reference for the PUT /_luna/secrets/{tenant}/{name} endpoint in the
    Luna API.
sidebar:
  label: Set a secret
  badge: PUT
title: Set a secret
type: openapi-operation
---
Sets a secret of a tenant to the text in the body. The tenant's code reads it as an environment variable of the same name. Setting a secret deploys a new version with the same code, so that running lunas take it up.

`PUT /_luna/secrets/{tenant}/{name}`

**Request body** (`text/plain`, required)

The secret's value, as UTF-8 text of at most 64 KiB.

Request body example:

```json
"string"
```

**Responses**

- `200` — The secret is set.
- `default` — The request failed. The status says how and \`error.message\` says why.

Response example, 200:

```json
{
  "version": 0
}
```
