---
search:
  tags:
    - App keys
    - PATCH
seo:
  description: >-
    Changes a key's name or rules. Only the fields you send change. The main…
    Reference for the PATCH /_luna/tenants/{tenant}/keys/{id} endpoint in the
    Luna API.
sidebar:
  label: Update an app key
  badge: PATCH
title: Update an app key
type: openapi-operation
---
Changes a key's name or rules. Only the fields you send change. The main secret token has no rules to change.

`PATCH /_luna/tenants/{tenant}/keys/{id}`

**Request body** (`application/json`, required)

- `kind` (string | null) — \`publishable\`, which is the default, or \`secret\`. Only read when a key is made.
- `name` (string | null) — A name to tell the key by.
- `origins` (string[] | null) — The origins a browser can use the key from, such as \`https://app.example.com\`. Empty means any origin.
- `ratePerSecond` (number<double> | null) — The most requests a second the key can make. More than 0.
- `types` (string[] | null) — The luna types the key can call. Empty sets no such limit.
- `expiresIn` (integer<int64> | null) — How long the key works, in seconds from now.

Request body example:

```json
{
  "kind": null,
  "name": null,
  "origins": null,
  "ratePerSecond": null,
  "types": null,
  "expiresIn": null
}
```

**Responses**

- `200` — The key is changed.
- `default` — The request failed. The status says how and \`error.message\` says why.

Response example, 200:

```json
{
  "ok": true
}
```
