---
title: "Update a secret key"
method: PATCH
path: "/secret-keys/{keyId}"
tags: ["Secret Keys"]
---

# Update a secret key

`PATCH /secret-keys/{keyId}`

Update one secret key within the organization.

## Path parameters

- `keyId` string, uuid, required — Key ID to update.

## Request body

- object
  - `organizationId` string — Organization whose keys the operation targets. User tokens must supply it unless the credential's fixed scope resolves it; secret keys may omit it (the key's organization applies).
  - `name` string — New human-readable name for the key.
  - `expiresAt` string, date-time, nullable — New expiration timestamp for the key, or null to clear it.

## Response `200`

OK

- object
  - `secretKey` object, required
    - `id` string, uuid, required
    - `name` string, required
    - `expiresAt` string, date-time, nullable, required
    - `lastUsedAt` string, date-time, nullable, required
    - `createdAt` string, date-time, required
    - `projectId` string, uuid, nullable, required

---

[API](https://skmtc.dev/sazabi/apis/sazabi-public-api.md) · [All operations](https://skmtc.dev/sazabi/apis/sazabi-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/sazabi/sazabi-public-api/revisions/1d12b71c735a/schema)
