---
title: "Upsert a API-key"
method: PUT
path: "/key-auths/{KeyAuthId}"
tags: ["API-keys"]
---

# Upsert a API-key

`PUT /key-auths/{KeyAuthId}`

Create or Update API-key using ID.

## Path parameters

- `KeyAuthId` string, required

## Request body

- KeyAuth
  - `created_at` integer — Unix epoch when the resource was created.
  - `id` string
  - `key` string
  - `tags` string[]
  - `consumer` object
    - `id` string

## Response `200`

Successfully upserted API-key

- KeyAuth
  - `created_at` integer — Unix epoch when the resource was created.
  - `id` string
  - `key` string
  - `tags` string[]
  - `consumer` object
    - `id` string

## Other responses

- `401` — Unauthorized

---

[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/bac13851c993/schema)
