---
title: "Stores a secret"
method: PUT
path: "/lambdas/{privateKey}/secrets/{name}"
tags: ["Secrets"]
---

# Stores a secret

`PUT /lambdas/{privateKey}/secrets/{name}`

## Request

- Base URL: `https://genhttp.dev/api/v1`
- URL: `https://genhttp.dev/api/v1/lambdas/{privateKey}/secrets/{name}`
- Auth: none declared

The lambda reads it from its next `Secret.Read` on, without being deployed again. The value cannot be read back
afterwards - not even by whoever stored it. Its features keep the copies they have.

## Path parameters

- `privateKey` string, required
- `name` string, required

## Request body

- SecretRequest: The value to store under a name.
  - `Value` string: The value, up to 32 KB - sent once, and never shown again

## Response `200`

The secret, without its value

- SecretResponse: A secret, as anybody but the lambda gets to see it: never its value.
  - `Name` string: What the code reads it by: `Secret.Read("STRIPE_KEY")`
  - `Created` string, date-time: When it was first stored
  - `Changed` string, date-time: When its value was last replaced
  - `Used` boolean: Whether the code reads it by that name

## Other responses

- `204`: A response containing no body
- `400`: The name is not one a secret may have, or the value is empty or larger than 32 KB.
- `403`: The lambda is a demo, which anybody may read and nobody may change. Create a lambda of your own from it instead: `POST /lambdas` with the demo's id as `template`.
- `404`: No lambda has this editor key. A key that never existed and the key of a deleted lambda are answered alike.
- `409`: Secrets are switched off, or the lambda has as many secrets as it may keep.

---

[API](https://skmtc.dev/genhttp/apis/genhttp-lambda-api.md) · [All operations](https://skmtc.dev/genhttp/apis/genhttp-lambda-api/llms.txt) · [OpenAPI document](https://skmtc.dev/genhttp/apis/genhttp-lambda-api/revisions/8b36699e03df?raw)
