---
title: "Upserts a secret"
method: POST
path: "/v1/secrets"
---

# Upserts a secret

`POST /v1/secrets`

Creates or updates a secret by name. Scoped to the caller's primary team; use the team-scoped variant to target a specific team.

## Request body

- UpsertSecretRequestV1 — A request to create or update a Baseten secret by name.
  - `name` string, required — Name of the new or existing secret
  - `value` string, required — Value of the secret

## Response `200`

- SecretV1 — A Baseten secret. Note that we do not support retrieving secret values.
  - `id` string, required — Stable identifier for the secret. Unchanged across rotation.
  - `created_at` string, date-time, required — Time the secret was created in ISO 8601 format
  - `name` string, required — Name of the secret
  - `team_name` string, required — Name of the team the secret belongs to

---

[API](https://skmtc.net/baseten/apis/baseten-inference-api.md) · [All operations](https://skmtc.net/baseten/apis/baseten-inference-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/baseten/baseten-inference-api/versions/a55a2f64c3c5/schema)
