FusionAuth Key API

The Key API from FusionAuth — 7 operation(s) for key.

OpenAPI Specification

fusionauth-key-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  version: 1.66.0
  title: FusionAuth Api Key API
  description: This is a FusionAuth server. Find out more at [https://fusionauth.io](https://fusionauth.io). You need to [set up an API key](https://fusionauth.io/docs/v1/tech/apis/authentication#managing-api-keys) in the FusionAuth instance you are using to test out the API calls.
  license:
    name: Apache2
servers:
- url: http://localhost:9011
- url: https://sandbox.fusionauth.io
security:
- ApiKeyAuth: []
tags:
- name: Key
paths:
  /api/key:
    get:
      description: Retrieves all the keys.
      operationId: retrieveKeysWithId
      parameters: []
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyResponse'
        default:
          description: Error
      tags:
      - Key
  /api/key/generate:
    post:
      description: Generate a new RSA or EC key pair or an HMAC secret.
      operationId: generateKey
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeyRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Key
  /api/key/generate/{keyId}:
    post:
      description: Generate a new RSA or EC key pair or an HMAC secret.
      operationId: generateKeyWithId
      parameters:
      - name: keyId
        in: path
        schema:
          type: string
        required: true
        description: The Id for the key. If not provided a secure random UUID will be generated.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeyRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Key
  /api/key/import:
    post:
      description: Import an existing RSA or EC key pair or an HMAC secret.
      operationId: importKey
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeyRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Key
  /api/key/import/{keyId}:
    post:
      description: Import an existing RSA or EC key pair or an HMAC secret.
      operationId: importKeyWithId
      parameters:
      - name: keyId
        in: path
        schema:
          type: string
        required: true
        description: The Id for the key. If not provided a secure random UUID will be generated.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeyRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Key
  /api/key/search:
    post:
      description: Searches keys with the specified criteria and pagination.
      operationId: searchKeysWithId
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeySearchRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeySearchResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Key
  /api/key/{keyId}:
    delete:
      description: Deletes the key for the given Id.
      operationId: deleteKeyWithId
      parameters:
      - name: keyId
        in: path
        schema:
          type: string
        required: true
        description: The Id of the key to delete.
      responses:
        '200':
          description: Success
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Key
    get:
      description: Retrieves the key for the given Id.
      operationId: retrieveKeyWithId
      parameters:
      - name: keyId
        in: path
        schema:
          type: string
        required: true
        description: The Id of the key.
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Key
    put:
      description: Updates the key with the given Id.
      operationId: updateKeyWithId
      parameters:
      - name: keyId
        in: path
        schema:
          type: string
        required: true
        description: The Id of the key to update.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeyRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Key
components:
  schemas:
    KeySearchCriteria:
      description: Search criteria for Keys
      type: object
      properties:
        algorithm:
          $ref: '#/components/schemas/KeyAlgorithm'
        name:
          type: string
        type:
          $ref: '#/components/schemas/KeyType'
        numberOfResults:
          type: integer
        orderBy:
          type: string
        startRow:
          type: integer
    Errors:
      description: Standard error domain object that can also be used as the response from an API call.
      type: object
      properties:
        fieldErrors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
        generalErrors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
    KeySearchResponse:
      description: Key search response
      type: object
      properties:
        keys:
          type: array
          items:
            $ref: '#/components/schemas/Key'
        total:
          type: integer
          format: int64
    ZonedDateTime:
      description: 'The number of milliseconds since the unix epoch: January 1, 1970 00:00:00 UTC. This value is always in UTC.'
      example: '1659380719000'
      type: integer
      format: int64
    KeyAlgorithm:
      type: string
      enum:
      - ES256
      - ES384
      - ES512
      - HS256
      - HS384
      - HS512
      - RS256
      - RS384
      - RS512
      - Ed25519
      - None
    Error:
      description: Defines an error.
      type: object
      properties:
        code:
          type: string
        data:
          type: object
          additionalProperties:
            type: object
        message:
          type: string
    CertificateInformation:
      type: object
      properties:
        issuer:
          type: string
        md5Fingerprint:
          type: string
        serialNumber:
          type: string
        sha1Fingerprint:
          type: string
        sha1Thumbprint:
          type: string
        sha256Fingerprint:
          type: string
        sha256Thumbprint:
          type: string
        subject:
          type: string
        validFrom:
          $ref: '#/components/schemas/ZonedDateTime'
        validTo:
          $ref: '#/components/schemas/ZonedDateTime'
    KeySearchRequest:
      description: Search request for Keys
      type: object
      properties:
        search:
          $ref: '#/components/schemas/KeySearchCriteria'
    KeyResponse:
      description: Key API response object.
      type: object
      properties:
        key:
          $ref: '#/components/schemas/Key'
        keys:
          type: array
          items:
            $ref: '#/components/schemas/Key'
    Key:
      description: Domain for a public key, key pair or an HMAC secret. This is used by KeyMaster to manage keys for JWTs, SAML, etc.
      type: object
      properties:
        algorithm:
          $ref: '#/components/schemas/KeyAlgorithm'
        certificate:
          type: string
        certificateInformation:
          $ref: '#/components/schemas/CertificateInformation'
        expirationInstant:
          $ref: '#/components/schemas/ZonedDateTime'
        hasPrivateKey:
          type: boolean
        id:
          type: string
          format: uuid
        insertInstant:
          $ref: '#/components/schemas/ZonedDateTime'
        issuer:
          type: string
        kid:
          type: string
        lastUpdateInstant:
          $ref: '#/components/schemas/ZonedDateTime'
        length:
          type: integer
        name:
          type: string
        privateKey:
          type: string
        publicKey:
          type: string
        secret:
          type: string
        type:
          $ref: '#/components/schemas/KeyType'
    KeyType:
      type: string
      enum:
      - EC
      - RSA
      - HMAC
      - OKP
      - Secret
    KeyRequest:
      description: Key API request object.
      type: object
      properties:
        key:
          $ref: '#/components/schemas/Key'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      name: Authorization
      in: header
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT