---
title: "Create or update a secret"
method: PUT
path: "/secrets"
tags: ["Secrets"]
---

# Create or update a secret

`PUT /secrets`

## Request

- Base URL: `https://api.quiva.ai`
- URL: `https://api.quiva.ai/secrets`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-2/docs/secrets/put.ts> (a function with typed inputs; its response is checked against the schema)

Stores a new secret or updates an existing one in the secrets bucket

## Request body

- SecretCreate
  - `key` string, required: The unique identifier for the secret
  - `value` string, required: The secret value to store
  - `scope` 'user' | 'account': Where to store the secret; `account` is the default

## Response `200`

Secret created/updated successfully

- object
  - `message` string

## Other responses

- `400`: Bad request

## Changes

- **2026-11-12** `4b1f083f4026`: 1 info
  - added the new optional request property `scope`

[Operation history](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-2/changes/secrets/put.md)

---

[API](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-2.md) - [All operations](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-2/llms.txt) - [OpenAPI document](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-2/revisions/4b1f083f4026?raw)
