---
title: "Upserts a secret in a team"
method: POST
path: "/v1/teams/{team_id}/secrets"
---

# Upserts a secret in a team

`POST /v1/teams/{team_id}/secrets`

Creates a new secret or updates an existing secret if one with the provided name already exists. The name and creation date of the created or updated secret is returned. This secret belongs to the specified 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/revisions/a55a2f64c3c5/schema)
