Skip to Content
ZITADEL Docs
APIsCore ResourcesV2Web Key

Create Web Key

Generate a private and public key pair. The private key can be used to sign OIDC tokens after activation. The public key can be used to validate OIDC tokens. The newly created key will have the state STATE_INITIAL and is published to the public key endpoint. Note that the JWKs OIDC endpoint returns a cacheable response.

If no key type is provided, a RSA key pair with 2048 bits and SHA256 hashing will be created.

Required permission:

  • iam.web_key.write
POST
/zitadel.webkey.v2.WebKeyService/CreateWebKey

Header Parameters

Connect-Protocol-Version*1

Define the version of the Connect protocol

Value in1
Connect-Timeout-Ms?Connect-Timeout-Ms

Define the timeout, in ms

Request Body

application/json
  1. body
ecdsa*

Create a ECDSA key pair and specify the curve. If no curve is provided, a ECDSA key pair with P-256 curve will be created.

Response Body

Success

application/json
  1. response
id?id

The unique identifier of the newly created key.

creationDate?creation_date

The timestamp of the key creation.

Formatdate-time
Example Request
curl -X POST 'https://example.com/zitadel.webkey.v2.WebKeyService/CreateWebKey' \  -H 'Connect-Protocol-Version: 1' \  -H 'Content-Type: application/json' \  -d '{  "ecdsa": {}}'
Example Response
{  "id": "string",  "creationDate": "2023-01-15T01:30:15.01Z"}

Was this page helpful?