---
title: "Create or update a secret"
method: POST
path: "/v1/apps/{appId}/secrets"
tags: ["Secrets"]
deprecated: true
---

# Create or update a secret

`POST /v1/apps/{appId}/secrets`

## Request

- Base URL: `https://api.spice.ai`
- URL: `https://api.spice.ai/v1/apps/{appId}/secrets`
- Auth: HTTP bearer

> **Deprecated.**

Legacy alias of `/v1/projects/{projectId}/secrets`. Projects were previously called apps. Creates a new secret or updates an existing secret with the same name. The secret value is encrypted at rest.

## Path parameters

- `appId` integer, required

## Headers

- `X-Org-Name` string

## Request body

- object
  - `name` string, required: Secret name (must start with a letter or underscore, alphanumeric and underscores only)
  - `value` string, required: Secret value (will be encrypted at rest)

## Response `200`

Secret created or updated successfully

- Secret
  - `id` integer: Unique identifier for the secret
  - `name` string: Name of the secret
  - `value` string: Always masked with asterisks
  - `created_at` string, date-time: Timestamp when the secret was created
  - `updated_at` string, date-time: Timestamp when the secret was last updated

## Other responses

- `400`: Invalid request body or project ID
- `401`: Unauthorized
- `403`: Insufficient scope
- `404`: Project not found
- `500`: Internal server error

---

[API](https://skmtc.dev/spice/apis/spice-cloud-control-plane-api.md) - [All operations](https://skmtc.dev/spice/apis/spice-cloud-control-plane-api/llms.txt) - [OpenAPI document](https://skmtc.dev/spice/apis/spice-cloud-control-plane-api/revisions/5f3b75dd847d?raw)
