---
title: "Update secret"
method: PATCH
path: "/secrets/{name}"
tags: ["Forward"]
---

# Update secret

`PATCH /secrets/{name}`

## Request

- Base URL: `https://forward.checkout.com`
- URL: `https://forward.checkout.com/secrets/{name}`
- Auth: one of:
  - OAuth 2
    - Client credentials
    - Token URL: `string` scopes: `forward`, `forward:secrets`
  - API key in header `Authorization`
- TypeScript: <https://skmtc.dev/checkout/apis/checkout-com-api-reference/docs/secrets/:name/patch.ts> (a function with typed inputs; its response is checked against the schema)

Update an existing secret. After updating, the version is automatically incremented.

**Validation Rules:**
- Only `value` and `entity_id` can be updated
- `value`: max 8KB

**Response:**
Returns updated metadata with incremented version.

## Path parameters

- `name` string, required

## Request body

- UpdateSecretRequest: Request to update an existing secret. At least one of `value` or `entity_id` must be provided.
  - `entity_id` string: Update the entity scope.
  - `value` string: New plaintext secret value. Max 8KB.

## Response `200`

Secret updated successfully

- SecretResponse: Secret response metadata. The secret value is never returned in responses.
  - `name` string, required: Secret name (1-64 characters, alphanumeric and underscore)
  - `created_at` string, date-time, required: Timestamp when the secret was created.
  - `updated_at` string, date-time, required: Timestamp when the secret was last updated.
  - `version` integer, required: Version number.
  - `entity_id` string: Entity ID if the secret is scoped to a specific entity.

## Other responses

- `401`: Unauthorized
- `404`: Secret not found
- `422`: Invalid data was sent
- `500`: Internal Error

---

[API](https://skmtc.dev/checkout/apis/checkout-com-api-reference.md) - [All operations](https://skmtc.dev/checkout/apis/checkout-com-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/checkout/apis/checkout-com-api-reference/revisions/0f1abdb1c3e9?raw)
