Kong Keys API

A key object holds a representation of asymmetric keys in various formats. When Kong Gateway or a Kong plugin requires a specific public or private key to perform certain operations, it can use this entity.

OpenAPI Specification

kong-keys-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  contact:
    email: support@konghq.com
    name: Kong Inc
    url: https://konghq.com
  description: 'OpenAPI 3.0 spec for Kong Gateway''s Admin API.


    You can learn more about Kong Gateway at [developer.konghq.com](https://developer.konghq.com).

    Give Kong a star at the [Kong/kong](https://github.com/kong/kong) repository.'
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  title: Kong Enterprise Admin ACLs Keys API
  version: 3.14.0
servers:
- description: Default Admin API URL
  url: '{protocol}://{hostname}:{port}{path}'
  variables:
    hostname:
      default: localhost
      description: Hostname for Kong's Admin API
    path:
      default: /
      description: Base path for Kong's Admin API
    port:
      default: '8001'
      description: Port for Kong's Admin API
    protocol:
      default: http
      description: Protocol for requests to Kong's Admin API
      enum:
      - http
      - https
security:
- adminToken: []
tags:
- description: 'A key object holds a representation of asymmetric keys in various formats. When Kong Gateway or a Kong plugin requires a specific public or private key to perform certain operations, it can use this entity.

    '
  name: Keys
paths:
  /{workspace}/keys:
    post:
      x-speakeasy-entity-operation:
        terraform-datasource: null
        terraform-resource: Key#create
      operationId: create-key
      summary: Create a new Key
      description: Create a new Key
      parameters:
      - $ref: '#/components/parameters/Workspace'
      requestBody:
        description: Description of the new Key for creation
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Key'
      responses:
        '201':
          description: Successfully created Key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Key'
        '401':
          $ref: '#/components/responses/HTTP401Error'
      tags:
      - Keys
  /{workspace}/keys/{KeyIdOrName}:
    parameters:
    - $ref: '#/components/parameters/KeyIdOrName'
    delete:
      x-speakeasy-entity-operation:
        terraform-datasource: null
        terraform-resource: Key#delete
      operationId: delete-key
      summary: Delete a Key
      description: Delete a Key
      parameters:
      - $ref: '#/components/parameters/KeyIdOrName'
      - $ref: '#/components/parameters/Workspace'
      responses:
        '204':
          description: Successfully deleted Key or the resource didn't exist
        '401':
          $ref: '#/components/responses/HTTP401Error'
      tags:
      - Keys
    get:
      x-speakeasy-entity-operation:
        terraform-datasource: null
        terraform-resource: Key#read
      operationId: get-key
      summary: Get a Key
      description: Get a Key using ID or name.
      parameters:
      - $ref: '#/components/parameters/Workspace'
      responses:
        '200':
          description: Successfully fetched Key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Key'
        '401':
          $ref: '#/components/responses/HTTP401Error'
        '404':
          description: Resource does not exist
      tags:
      - Keys
    put:
      x-speakeasy-entity-operation:
        terraform-datasource: null
        terraform-resource: Key#update
      operationId: upsert-key
      summary: Upsert a Key
      description: Create or Update Key using ID or name.
      parameters:
      - $ref: '#/components/parameters/Workspace'
      requestBody:
        description: Description of the Key
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Key'
      responses:
        '200':
          description: Successfully upserted Key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Key'
        '401':
          $ref: '#/components/responses/HTTP401Error'
      tags:
      - Keys
  /v2/control-planes/{controlPlaneId}/core-entities/key-sets/{KeySetId}/keys:
    parameters:
    - $ref: '#/components/parameters/controlPlaneId'
    get:
      operationId: list-key-with-key-set
      summary: List all Keys associated with a KeySet
      description: List all Keys associated with a KeySet
      parameters:
      - $ref: '#/components/parameters/KeySetId'
      - $ref: '#/components/parameters/PaginationSize'
      - $ref: '#/components/parameters/PaginationOffset'
      - $ref: '#/components/parameters/PaginationTagsFilter'
      responses:
        '200':
          description: A successful response listing Keys
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Key_2'
                  next:
                    $ref: '#/components/schemas/PaginationNextResponse'
                  offset:
                    $ref: '#/components/schemas/PaginationOffsetResponse'
      tags:
      - Keys
    post:
      operationId: create-key-with-key-set
      summary: Create a new Key associated with a KeySet
      description: Create a new Key associated with a KeySet
      parameters:
      - $ref: '#/components/parameters/KeySetId'
      requestBody:
        description: Description of new Key for creation
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeyWithoutParents'
      responses:
        '201':
          description: Successfully created Key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Key_2'
      tags:
      - Keys
  /v2/control-planes/{controlPlaneId}/core-entities/key-sets/{KeySetId}/keys/{KeyId}:
    parameters:
    - $ref: '#/components/parameters/controlPlaneId'
    delete:
      operationId: delete-key-with-key-set
      summary: Delete a a Key associated with a KeySet
      description: Delete a a Key associated with a KeySet using ID or name.
      parameters:
      - $ref: '#/components/parameters/KeySetId'
      - $ref: '#/components/parameters/KeyId'
      responses:
        '204':
          description: Successfully deleted Key or the resource didn't exist
      tags:
      - Keys
    get:
      operationId: get-key-with-key-set
      summary: Get a Key associated with a KeySet
      description: Get a Key associated with a KeySet using ID or name.
      parameters:
      - $ref: '#/components/parameters/KeySetId'
      - $ref: '#/components/parameters/KeyId'
      responses:
        '200':
          description: Successfully fetched Key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Key_2'
        '404':
          description: Resource does not exist
      tags:
      - Keys
    put:
      operationId: upsert-key-with-key-set
      summary: Upsert a Key associated with a KeySet
      description: Create or Update a Key associated with a KeySet using ID or name.
      parameters:
      - $ref: '#/components/parameters/KeySetId'
      - $ref: '#/components/parameters/KeyId'
      requestBody:
        description: Description of the Key
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeyWithoutParents'
      responses:
        '200':
          description: Successfully upserted Key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Key_2'
      tags:
      - Keys
  /v2/control-planes/{controlPlaneId}/core-entities/keys:
    parameters:
    - $ref: '#/components/parameters/controlPlaneId'
    get:
      operationId: list-key
      summary: List all Keys
      description: List all Keys
      parameters:
      - $ref: '#/components/parameters/PaginationSize'
      - $ref: '#/components/parameters/PaginationOffset'
      - $ref: '#/components/parameters/PaginationTagsFilter'
      responses:
        '200':
          description: A successful response listing Keys
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Key_2'
                  next:
                    $ref: '#/components/schemas/PaginationNextResponse'
                  offset:
                    $ref: '#/components/schemas/PaginationOffsetResponse'
        '401':
          $ref: '#/components/responses/HTTP401Error_2'
      tags:
      - Keys
    post:
      operationId: create-key
      summary: Create a new Key
      description: Create a new Key
      requestBody:
        description: Description of the new Key for creation
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Key_2'
      responses:
        '201':
          description: Successfully created Key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Key_2'
        '401':
          $ref: '#/components/responses/HTTP401Error_2'
      tags:
      - Keys
  /v2/control-planes/{controlPlaneId}/core-entities/keys/{KeyId}:
    parameters:
    - $ref: '#/components/parameters/KeyId'
    - $ref: '#/components/parameters/controlPlaneId'
    delete:
      operationId: delete-key
      summary: Delete a Key
      description: Delete a Key
      parameters:
      - $ref: '#/components/parameters/KeyId'
      responses:
        '204':
          description: Successfully deleted Key or the resource didn't exist
        '401':
          $ref: '#/components/responses/HTTP401Error_2'
      tags:
      - Keys
    get:
      operationId: get-key
      summary: Get a Key
      description: Get a Key using ID or name.
      responses:
        '200':
          description: Successfully fetched Key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Key_2'
        '401':
          $ref: '#/components/responses/HTTP401Error_2'
        '404':
          description: Resource does not exist
      tags:
      - Keys
    put:
      operationId: upsert-key
      summary: Upsert a Key
      description: Create or Update Key using ID or name.
      requestBody:
        description: Description of the Key
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Key_2'
      responses:
        '200':
          description: Successfully upserted Key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Key_2'
        '401':
          $ref: '#/components/responses/HTTP401Error_2'
      tags:
      - Keys
components:
  parameters:
    KeyId:
      description: ID of the Key to lookup
      example: bba22c06-a632-42be-a018-1b9ff357b5b9
      in: path
      name: KeyId
      required: true
      schema:
        type: string
    PaginationSize:
      description: Number of resources to be returned.
      in: query
      name: size
      schema:
        type: integer
        default: 100
        maximum: 1000
        minimum: 1
    KeySetId:
      description: ID of the KeySet to lookup
      example: 6cc34248-50b4-4a81-9201-3bdf7a83f712
      in: path
      name: KeySetId
      required: true
      schema:
        type: string
    Workspace:
      description: The name of the workspace
      in: path
      name: workspace
      required: true
      schema:
        type: string
        example: team-payments
        default: default
    PaginationOffset:
      allowEmptyValue: true
      description: Offset from which to return the next set of resources. Use the value of the 'offset' field from the response of a list operation as input here to paginate through all the resources
      in: query
      name: offset
      schema:
        type: string
    controlPlaneId:
      name: controlPlaneId
      in: path
      required: true
      schema:
        type: string
        format: uuid
        example: 9524ec7d-36d9-465d-a8c5-83a3c9390458
      description: The UUID of your control plane. This variable is available in the Konnect manager.
      x-speakeasy-param-force-new: true
    KeyIdOrName:
      description: ID or name of the Key to lookup
      example: bba22c06-a632-42be-a018-1b9ff357b5b9
      in: path
      name: KeyIdOrName
      required: true
      schema:
        type: string
      x-speakeasy-match: id
    PaginationTagsFilter:
      allowEmptyValue: true
      description: A list of tags to filter the list of resources on. Multiple tags can be concatenated using ',' to mean AND or using '/' to mean OR.
      example: tag1,tag2
      in: query
      name: tags
      schema:
        type: string
  responses:
    HTTP401Error_2:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GatewayUnauthorizedError'
    HTTP401Error:
      description: Unauthorized
      content:
        application/json:
          examples:
            DuplicateApiKey:
              summary: Duplicate API key found
              value:
                message: Duplicate API key found
                status: 401
            InvalidAuthCred:
              summary: Invalid authentication credentials
              value:
                message: Unauthorized
                status: 401
            NoAPIKey:
              summary: No API key found
              value:
                message: No API key found in request
                status: 401
          schema:
            $ref: '#/components/schemas/GatewayUnauthorizedError'
  schemas:
    PaginationOffsetResponse:
      description: Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page
      type: string
    GatewayUnauthorizedError:
      type: object
      properties:
        message:
          type: string
        status:
          type: integer
      required:
      - message
      - status
    Key_2:
      description: 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.
      type: object
      properties:
        created_at:
          description: Unix epoch when the resource was created.
          type: integer
          nullable: true
        id:
          description: A string representing a UUID (universally unique identifier).
          type: string
          nullable: true
        jwk:
          description: A JSON Web Key represented as a string.
          type: string
          nullable: true
          x-encrypted: true
          x-referenceable: true
        kid:
          description: A unique identifier for a key.
          type: string
        name:
          description: The name to associate with the given keys.
          type: string
          nullable: true
        pem:
          description: A keypair in PEM format.
          type: object
          nullable: true
          properties:
            private_key:
              type: string
              x-encrypted: true
              x-referenceable: true
            public_key:
              type: string
              x-referenceable: true
        set:
          description: The id (an UUID) of the key-set with which to associate the key.
          type: object
          nullable: true
          properties:
            id:
              type: string
          x-foreign: true
        tags:
          description: An optional set of strings associated with the Key for grouping and filtering.
          type: array
          items:
            description: A string representing a tag.
            type: string
          nullable: true
        updated_at:
          description: Unix epoch when the resource was last updated.
          type: integer
          nullable: true
        x5t:
          description: X.509 certificate SHA-1 thumbprint.
          type: string
          nullable: true
      example:
        id: d958f66b-8e99-44d2-b0b4-edd5bbf24658
        jwk: '{"alg":"RSA",  "kid": "42",  ...}'
        kid: '42'
        name: a-key
        pem:
          private_key: '-----BEGIN'
          public_key: '-----BEGIN'
        set:
          id: b86b331c-dcd0-4b3e-97ce-47c5a9543031
      additionalProperties: false
      required:
      - kid
    PaginationNextResponse:
      description: URI to the next page (may be null)
      type: string
    KeyWithoutParents:
      description: 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.
      type: object
      properties:
        created_at:
          description: Unix epoch when the resource was created.
          type: integer
          nullable: true
        id:
          description: A string representing a UUID (universally unique identifier).
          type: string
          nullable: true
        jwk:
          description: A JSON Web Key represented as a string.
          type: string
          nullable: true
          x-encrypted: true
          x-referenceable: true
        kid:
          description: A unique identifier for a key.
          type: string
        name:
          description: The name to associate with the given keys.
          type: string
          nullable: true
        pem:
          description: A keypair in PEM format.
          type: object
          nullable: true
          properties:
            private_key:
              type: string
              x-encrypted: true
              x-referenceable: true
            public_key:
              type: string
              x-referenceable: true
        set:
          description: The id (an UUID) of the key-set with which to associate the key.
          type: object
          nullable: true
          properties:
            id:
              type: string
          x-foreign: true
        tags:
          description: An optional set of strings associated with the Key for grouping and filtering.
          type: array
          items:
            description: A string representing a tag.
            type: string
          nullable: true
        updated_at:
          description: Unix epoch when the resource was last updated.
          type: integer
          nullable: true
        x5t:
          description: X.509 certificate SHA-1 thumbprint.
          type: string
          nullable: true
      example:
        id: d958f66b-8e99-44d2-b0b4-edd5bbf24658
        jwk: '{"alg":"RSA",  "kid": "42",  ...}'
        kid: '42'
        name: a-key
        pem:
          private_key: '-----BEGIN'
          public_key: '-----BEGIN'
        set:
          id: b86b331c-dcd0-4b3e-97ce-47c5a9543031
      additionalProperties: false
      required:
      - kid
    Key:
      x-speakeasy-entity: Key
      description: 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.
      type: object
      properties:
        created_at:
          description: Unix epoch when the resource was created.
          type: integer
          nullable: true
        id:
          description: A string representing a UUID (universally unique identifier).
          type: string
          nullable: true
        jwk:
          description: A JSON Web Key represented as a string.
          type: string
          nullable: true
          x-encrypted: true
          x-referenceable: true
        kid:
          description: A unique identifier for a key.
          type: string
        name:
          description: The name to associate with the given keys.
          type: string
          nullable: true
        pem:
          description: A keypair in PEM format.
          type: object
          nullable: true
          properties:
            private_key:
              type: string
              x-encrypted: true
              x-referenceable: true
            public_key:
              type: string
              x-referenceable: true
        set:
          description: The id (an UUID) of the key-set with which to associate the key.
          type: object
          nullable: true
          properties:
            id:
              type: string
          x-foreign: true
        tags:
          description: An optional set of strings associated with the Key for grouping and filtering.
          type: array
          items:
            description: A string representing a tag.
            type: string
          nullable: true
        updated_at:
          description: Unix epoch when the resource was last updated.
          type: integer
          nullable: true
        x5t:
          description: X.509 certificate SHA-1 thumbprint.
          type: string
          nullable: true
      example:
        id: d958f66b-8e99-44d2-b0b4-edd5bbf24658
        jwk: '{"alg":"RSA",  "kid": "42",  ...}'
        kid: '42'
        name: a-key
        pem:
          private_key: '-----BEGIN'
          public_key: '-----BEGIN'
        set:
          id: b86b331c-dcd0-4b3e-97ce-47c5a9543031
      additionalProperties: false
      required:
      - kid
  securitySchemes:
    adminToken:
      in: header
      name: Kong-Admin-Token
      type: apiKey
externalDocs:
  description: Documentation for Kong Gateway and its APIs
  url: https://developer.konghq.com