---
title: "Update a secret"
method: POST
path: "/secrets/{secretID}"
tags: ["secrets"]
---

# Update a secret

`POST /secrets/{secretID}`

Replace the secret's stored marker by appending a new version. The response carries metadata only.

## Path parameters

- `secretID` string, required — Identifier of the secret (sec_ prefixed), or its canonical lower-case name

## Request body

- SecretUpdate
  - `value` string, required — Runtime marker stored as the secret's new version. The runtime resolves it to a value at sandbox egress.
  - `metadata` SecretMetadata — Customer metadata of the secret. Always present, empty when unset. At most 32 entries; keys are limited to 128 bytes, values to 1024 bytes, and a secret's metadata to 8192 bytes in total.

## Response `200`

Successfully updated the secret

- Secret — Metadata of a secret. It never carries the secret value.
  - `secretID` string, required — Identifier of the secret
  - `name` string, required — Name of the secret, unique within the project
  - `currentVersion` integer, required — Version served to readers that do not name one
  - `metadata` SecretMetadata, required — Customer metadata of the secret. Always present, empty when unset. At most 32 entries; keys are limited to 128 bytes, values to 1024 bytes, and a secret's metadata to 8192 bytes in total.
  - `createdAt` string, date-time, required — Time when the secret was created
  - `updatedAt` string, date-time, required — Time when the secret was last updated

## Other responses

- `400` — Bad request
- `401` — Authentication error
- `403` — Forbidden
- `404` — Not found
- `409` — Conflict
- `429` — Too many requests
- `500` — Server error
- `502` — Backend error
- `504` — Backend timeout

---

[API](https://skmtc.dev/e2b-dev/apis/e2b-api.md) · [All operations](https://skmtc.dev/e2b-dev/apis/e2b-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/e2b-dev/e2b-api/revisions/e01b3f5506fe/schema)
