---
title: "Create a secret"
method: POST
path: "/secrets"
tags: ["secrets"]
---

# Create a secret

`POST /secrets`

Create a secret by storing a runtime marker as its first version. The response carries metadata only.

## Request body

- NewSecret
  - `name` string, required — Name of the secret, unique within the project. Names are lower-cased before storage and returned in that canonical form; the sec_ prefix is reserved for secret identifiers.
  - `value` string, required — Runtime marker stored as the secret's first 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 `201`

Successfully created 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)
