---
title: "Update a an API-key associated with a Consumer"
method: PATCH
path: "/consumers/{ConsumerIdForNestedEntities}/key-auth/{KeyAuthId}"
tags: ["API-keys"]
---

# Update a an API-key associated with a Consumer

`PATCH /consumers/{ConsumerIdForNestedEntities}/key-auth/{KeyAuthId}`

Update a an API-key associated with a Consumer using ID.

## Path parameters

- `ConsumerIdForNestedEntities` string, required
- `KeyAuthId` string, required

## Request body

- KeyAuth
  - `consumer` object, nullable
    - `id` string
  - `created_at` integer, nullable — Unix epoch when the resource was created.
  - `id` string, nullable
  - `key` string, required
  - `tags` string[]
  - `ttl` integer, nullable — key-auth ttl in seconds

## Response `200`

Successfully updated API-key

- KeyAuth
  - `consumer` object, nullable
    - `id` string
  - `created_at` integer, nullable — Unix epoch when the resource was created.
  - `id` string, nullable
  - `key` string, required
  - `tags` string[]
  - `ttl` integer, nullable — key-auth ttl in seconds

## Other responses

- `404` — Resource does not exist

## Changes

> 7 revisions in range; 1 not diffed.

- **2025-05-01** `daef3e27adf6` — 2 info
  - added the new optional request property `ttl`
  - added the optional property `ttl` to the response with the `200` status
- **2025-04-04** `e07a25288f1f` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/kong/apis/kong-enterprise-admin-api/changes/consumers/:ConsumerIdForNestedEntities/key-auth/:KeyAuthId/patch.md)

---

[API](https://skmtc.dev/kong/apis/kong-enterprise-admin-api.md) · [All operations](https://skmtc.dev/kong/apis/kong-enterprise-admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/kong/kong-enterprise-admin-api/revisions/daef3e27adf6/schema)
