---
title: "Stores a secret in a feature's copy"
method: PUT
path: "/lambdas/{privateKey}/features/{feature}/secrets/{name}"
tags: ["Secrets"]
---

# Stores a secret in a feature's copy

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

## Request

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

For trying the feature with - a key for a sandbox, say. The lambda's own secrets are not touched, and the copy is thrown away when the feature is merged.

## Path parameters

- `privateKey` string, required
- `feature` 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.
- `404`: No lambda has this editor key, or the lambda has no feature with this key: it never existed, or it was merged or deleted.
- `409`: Secrets are switched off, or the copy has as many secrets as a lambda 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)
