---
title: "Updates a key"
method: PATCH
path: "/apps/{app_id}/keys/{key_id}"
tags: ["keys"]
---

# Updates a key

`PATCH /apps/{app_id}/keys/{key_id}`

Update the API key with the specified key ID, for the application with the specified application ID.

## Path parameters

- `app_id` string, required
- `key_id` string, required

## Request body

- KeyPatch
  - `capabilities` string[] — The capabilities that this key has. More information on capabilities can be found in the <a href="https://ably.com/documentation/core-features/authentication#capabilities-explained">Ably documentation</a>.
  - `channels` string — Specify the channels and queues that this key can be used with.
  - `name` string — The name for your API key. This is a friendly name for your reference.

## Response `200`

Key updated

- KeyResponse
  - `appId` string — The Ably application ID which this key is associated with.
  - `capability` object — The capabilities that this key has. More information on capabilities can be found in the <a href="https://ably.com/documentation/core-features/authentication#capabilities-explained">Ably documentation</a>.
  - `created` integer — Unix timestamp representing the date and time of creation of the key.
  - `id` string — The key ID.
  - `key` string — The complete API key including API secret.
  - `modified` integer — Unix timestamp representing the date and time of the last modification of the key.
  - `name` string — The name of the application this key is associated with.

## Other responses

- `400` — Bad request
- `401` — Authentication failed
- `404` — App not found
- `422` — Invalid request
- `500` — Internal server error
- `504` — Gateway timeout

---

[API](https://skmtc.net/ably/apis/control.md) · [All operations](https://skmtc.net/ably/apis/control/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ably/control/revisions/85e2f4b0deb6/schema)
