---
title: "Update a project secret. Value rotation requires a redeploy to take effect — running containers keep their currently-mounted values until the next deployment."
method: PUT
path: "/projects/{project_id}/secrets/{secret_id}"
tags: ["Secrets"]
---

# Update a project secret. Value rotation requires a redeploy to take effect — running containers keep their currently-mounted values until the next deployment.

`PUT /projects/{project_id}/secrets/{secret_id}`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/secrets/{secret_id}`
- Auth: HTTP bearer

## Path parameters

- `project_id` integer, required
- `secret_id` integer, required

## Request body

- UpdateProjectSecretRequest: Request to update a project secret. The `value` field is optional — omit it to rotate only the environment scoping / preview flag without touching the ciphertext.
  - `compose_services` string[]: Docker Compose services allowed to read this secret, by compose service name. Empty (the default) delivers it to every service in the stack, which is how secrets behaved before scoping existed. Ignored by non-Compose presets: those deploy a single container, which always receives every secret in scope for its environment.
  - `environment_ids` integer[]
  - `include_in_preview` boolean
  - `value` string, nullable: New plaintext value, <= 1 MiB. Omit to keep the existing value.

## Response `200`

Secret updated

- ProjectSecretResponse: Project secret metadata. There is deliberately no `value` field — secret plaintext is never returned after creation. Callers that need the value must read it from the mounted file inside the container.
  - `compose_services` string[], required: Compose services this secret is restricted to. Empty means every service in the stack.
  - `created_at` string, date-time, required
  - `environments` ProjectSecretEnvironmentInfo[], required
    - `id` integer, required
    - `main_url` string, required
    - `name` string, required
  - `id` integer, required
  - `include_in_preview` boolean, required
  - `key` string, required
  - `project_id` integer, required
  - `updated_at` string, date-time, required

## Other responses

- `400`: Value too large
- `404`: Secret not found
- `500`: Internal server error

## Changes

- **2026-11-26** `e1864d950604`: 2 breaking
  - the `created_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
  - the `updated_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
- **2026-11-25** `480a86944327`: 1 info
  - the endpoint scheme security `bearer_auth` was added to the API
- **2026-09-07** `cdc1afae1752`: 2 info
  - added the new optional request property `compose_services`
  - added the required property `compose_services` to the response with the `200` status
- **2026-09-07** `f7404eb7ac98`: 1 breaking, 1 warning
  - removed the required property `compose_services` from the response with the `200` status
  - removed the request property `compose_services`
- **2026-08-17** `bd326cf0ea13`: 2 info
  - added the new optional request property `compose_services`
  - added the required property `compose_services` to the response with the `200` status

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/secrets/:secret_id/put.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
