---
title: "Create a new Key"
method: POST
path: "/keys"
tags: ["Keys"]
---

# Create a new Key

`POST /keys`

Create a new Key

## Request body

- Key — A Key object holds a representation of asymmetric keys in various formats. When Kong or a Kong plugin requires a specific public or private key to perform certain operations, it can use this entity.
  - `created_at` integer, nullable — Unix epoch when the resource was created.
  - `id` string, nullable
  - `jwk` string, nullable — A JSON Web Key represented as a string.
  - `kid` string, required — A unique identifier for a key.
  - `name` string, nullable — The name to associate with the given keys.
  - `pem` object, nullable — A keypair in PEM format.
    - `private_key` string
    - `public_key` string
  - `set` object, nullable — The id (an UUID) of the key-set with which to associate the key.
    - `id` string
  - `tags` string[] — An optional set of strings associated with the Key for grouping and filtering.
  - `updated_at` integer, nullable — Unix epoch when the resource was last updated.
  - `x5t` string, nullable

## Response `201`

Successfully created Key

- Key — A Key object holds a representation of asymmetric keys in various formats. When Kong or a Kong plugin requires a specific public or private key to perform certain operations, it can use this entity.
  - `created_at` integer, nullable — Unix epoch when the resource was created.
  - `id` string, nullable
  - `jwk` string, nullable — A JSON Web Key represented as a string.
  - `kid` string, required — A unique identifier for a key.
  - `name` string, nullable — The name to associate with the given keys.
  - `pem` object, nullable — A keypair in PEM format.
    - `private_key` string
    - `public_key` string
  - `set` object, nullable — The id (an UUID) of the key-set with which to associate the key.
    - `id` string
  - `tags` string[] — An optional set of strings associated with the Key for grouping and filtering.
  - `updated_at` integer, nullable — Unix epoch when the resource was last updated.
  - `x5t` string, nullable

## Other responses

- `401` — Unauthorized

## Changes

> 7 revisions in range; 1 not diffed.

- **2025-04-04** `e07a25288f1f` — 2 breaking, 8 info
  - the response property `created_at` became nullable for the status `201`
  - the response property `updated_at` became nullable for the status `201`
  - added the new optional request property `x5t`
  - the request optional property `created_at` became not read-only
  - …6 more
- **2024-11-26** `99e71588eb61` — 6 breaking, 8 info
  - the request property `kid` became required
  - the response property `id` became nullable for the status `201`
  - the response property `jwk` became nullable for the status `201`
  - the response property `name` became nullable for the status `201`
  - …10 more

[Change history](https://skmtc.dev/kong/apis/kong-enterprise-admin-api/changes/keys/post.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)
