---
title: "Create a Jwt plugin"
method: POST
path: "/plugins#Jwt"
tags: ["Plugins"]
---

# Create a Jwt plugin

`POST /plugins#Jwt`

Create a Jwt plugin

## Request body

- CreateJwtPlugin
  - `config` object — The configuration properties for the Plugin which can be found on the plugins documentation page in the [Kong Hub](https://docs.konghq.com/hub/).
    - `anonymous` string — An optional string (consumer UUID or username) value to use as an “anonymous” consumer if authentication fails.
    - `claims_to_verify` string[] — A list of registered claims (according to RFC 7519) that Kong can verify as well. Accepted values: one of exp or nbf.
    - `cookie_names` string[] — A list of cookie names that Kong will inspect to retrieve JWTs.
    - `header_names` string[] — A list of HTTP header names that Kong will inspect to retrieve JWTs.
    - `key_claim_name` string — The name of the claim in which the key identifying the secret must be passed. The plugin will attempt to read this claim from the JWT payload and the header, in that order.
    - `maximum_expiration` number — A value between 0 and 31536000 (365 days) limiting the lifetime of the JWT to maximum_expiration seconds in the future.
    - `realm` string — When authentication fails the plugin sends `WWW-Authenticate` header with `realm` attribute value.
    - `run_on_preflight` boolean — A boolean value that indicates whether the plugin should run (and try to authenticate) on OPTIONS preflight requests. If set to false, then OPTIONS requests will always be allowed.
    - `secret_is_base64` boolean — If true, the plugin assumes the credential’s secret to be base64 encoded. You will need to create a base64-encoded secret for your Consumer, and sign your JWT with the original secret.
    - `uri_param_names` string[] — A list of querystring parameters that Kong will inspect to retrieve JWTs.
  - `created_at` integer — Unix epoch when the resource was created.
  - `enabled` boolean — Whether the plugin is applied.
  - `id` string
  - `instance_name` string
  - `name` 'jwt' — The name of the Plugin that's going to be added. Currently, the Plugin must be installed in every Kong instance separately.
  - `ordering` object
    - `after` object
      - `access` string[]
    - `before` object
      - `access` string[]
  - `protocols` string[] — A list of the request protocols that will trigger this plugin. The default value, as well as the possible values allowed on this field, may change depending on the plugin type. For example, plugins that only work in stream mode will only support `"tcp"` and `"tls"`.
  - `tags` string[] — An optional set of strings associated with the Plugin for grouping and filtering.
  - `updated_at` integer — Unix epoch when the resource was last updated.
  - `consumer` object — If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer.
    - `id` string
  - `consumer_group` object
    - `id` string
  - `route` object — If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the Route being used.
    - `id` string
  - `service` object — If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched.
    - `id` string

## Response `201`

Created Jwt plugin

- JwtPlugin
  - `config` object — The configuration properties for the Plugin which can be found on the plugins documentation page in the [Kong Hub](https://docs.konghq.com/hub/).
    - `anonymous` string — An optional string (consumer UUID or username) value to use as an “anonymous” consumer if authentication fails.
    - `claims_to_verify` string[] — A list of registered claims (according to RFC 7519) that Kong can verify as well. Accepted values: one of exp or nbf.
    - `cookie_names` string[] — A list of cookie names that Kong will inspect to retrieve JWTs.
    - `header_names` string[] — A list of HTTP header names that Kong will inspect to retrieve JWTs.
    - `key_claim_name` string — The name of the claim in which the key identifying the secret must be passed. The plugin will attempt to read this claim from the JWT payload and the header, in that order.
    - `maximum_expiration` number — A value between 0 and 31536000 (365 days) limiting the lifetime of the JWT to maximum_expiration seconds in the future.
    - `realm` string — When authentication fails the plugin sends `WWW-Authenticate` header with `realm` attribute value.
    - `run_on_preflight` boolean — A boolean value that indicates whether the plugin should run (and try to authenticate) on OPTIONS preflight requests. If set to false, then OPTIONS requests will always be allowed.
    - `secret_is_base64` boolean — If true, the plugin assumes the credential’s secret to be base64 encoded. You will need to create a base64-encoded secret for your Consumer, and sign your JWT with the original secret.
    - `uri_param_names` string[] — A list of querystring parameters that Kong will inspect to retrieve JWTs.
  - `created_at` integer — Unix epoch when the resource was created.
  - `enabled` boolean — Whether the plugin is applied.
  - `id` string
  - `instance_name` string
  - `name` 'jwt' — The name of the Plugin that's going to be added. Currently, the Plugin must be installed in every Kong instance separately.
  - `ordering` object
    - `after` object
      - `access` string[]
    - `before` object
      - `access` string[]
  - `protocols` string[] — A list of the request protocols that will trigger this plugin. The default value, as well as the possible values allowed on this field, may change depending on the plugin type. For example, plugins that only work in stream mode will only support `"tcp"` and `"tls"`.
  - `tags` string[] — An optional set of strings associated with the Plugin for grouping and filtering.
  - `updated_at` integer — Unix epoch when the resource was last updated.
  - `consumer` object — If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer.
    - `id` string
  - `consumer_group` object
    - `id` string
  - `route` object — If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the Route being used.
    - `id` string
  - `service` object — If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched.
    - `id` string

## Other responses

- `401` — Unauthorized

## Changes

> 3 revisions in range; 1 not diffed.

- **2024-09-11** `5bd52189d290` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/kong/apis/kong-enterprise-admin-api/changes/plugins#Jwt/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/5bd52189d290/schema)
