Add a Key | ZITADEL Docs

Add a Key

Add a keys that can be used to securely authenticate at the Zitadel APIs using JWT profile authentication using short-lived tokens. Make sure you store the returned key safely, as you won't be able to read it from the Zitadel API anymore. Only users of type machine can have keys.

Required permission:

POST

/v2/users/{user_id}/keys

Send

Path

Body

Path Parameters

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

{
  "expirationDate": "expiration_date",  
  "publicKey": "public_key"
}

expirationDate? expiration_date

The date the key will expire and no logins will be possible anymore.

Format: date-time

publicKey? public_key

Optionally provide a public key of your own generated RSA private key.

Format: byte

Response Body

200 application/json

cURL

curl -X POST "https://example.com/v2/users/string/keys" \
  -H "Content-Type: application/json" \
  -d '{}'

Response Example

{
  "creationDate": "2023-01-15T01:30:15.01Z",
  "keyId": "string",
  "keyContent": "string"
}