> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an API key

> Creates new API key based on request body



## OpenAPI

````yaml /api-reference/5.9/fusion-api-api-docs.json post /api-key
openapi: 3.0.1
info:
  title: Fusion Proxy API
  description: Manage Fusion users, roles, realms, access tokens, and API keys.
  contact:
    name: Lucidworks
    url: www.lucidworks.com
    email: support@lucidworks.com
  license:
    name: License of API
    url: https://lucidworks.com/legal/developer-license-agreement/
  version: '5.9'
servers:
  - url: https://{FUSION HOST}/api
    description: Fusion
    variables:
      FUSION HOST:
        default: FUSION_HOST
        description: Your environment host.
security: []
tags:
  - name: Realm management
    description: >-
      Endpoints for creating, configuring, and managing authentication realms
      such as LDAP, SAML, OIDC, and others.
  - name: User management
    description: >-
      Endpoints for creating, updating, deleting, and retrieving Fusion users
      and their associated metadata.
  - name: Suggestions
    description: >-
      Endpoints that provide query suggestions or autocomplete results to
      improve search experiences.
  - name: API key management
    description: >-
      Endpoints for managing API keys used to authenticate Fusion services and
      integrations.
  - name: OAuth 2.0
    description: >-
      Endpoints that support OAuth 2.0 authentication, including token issuance
      and validation.
  - name: Role management
    description: >-
      Endpoints for creating and managing user roles and their associated
      permissions within Fusion.
  - name: System status
    description: >-
      Endpoints for retrieving basic system health, configuration, and
      authentication status.
externalDocs:
  description: Lucidworks Documentation
  url: https://doc.lucidworks.com/
paths:
  /api-key:
    post:
      tags:
        - API key management
      summary: Create an API key
      description: Creates new API key based on request body
      operationId: createApiKey
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyRequest'
            example:
              id: test-key-id
              name: test-key-name
              roles:
                - developer
                - search
        required: true
      responses:
        '200':
          description: Key created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyDto'
              example:
                name: test-key-name
                id: test-key-d
                createdAt: '2025-10-30T22:53:48Z'
                key: ae52a9b0-f719-48d9-88b9-566133338cc9
                roles:
                  - developer
                  - search
        '500':
          description: The key could not be created.  Check the syntax of your request.
components:
  schemas:
    ApiKeyRequest:
      required:
        - id
        - name
      type: object
      properties:
        name:
          type: string
        id:
          type: string
        roles:
          type: array
          description: >-
            One or more user roles. Use `GET /roles` to get the list of existing
            roles.
          writeOnly: true
          items:
            type: string
    ApiKeyDto:
      type: object
      properties:
        name:
          type: string
        id:
          type: string
        createdAt:
          type: string
          format: date-time
          example: '2025-09-23T17:48:07Z'
        key:
          type: string
        roles:
          type: array
          description: >-
            One or more user roles. Use `GET /roles` to get the list of existing
            roles.
          items:
            type: string
        disabled:
          type: boolean

````