---
updatedAt: 2026-06-22T13:11:51.000Z
agentTools:
  projectIndex: https://integrations.luscii.com/llms.txt
---

# Generate API key

Generate an api key for a user

Retrieve an API key for a specific user. This endpoint needs to be called with an API key with sufficient permissions for the requested user API key (e.g. admin of the organization).

Accessible by `HC_ADMIN`.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Public API reference",
    "description": "Full list of available endpoints.",
    "version": "1.0"
  },
  "paths": {
    "/v1/users/{uuid}/apikeys": {
      "post": {
        "tags": [
          "API Keys"
        ],
        "summary": "Generate API key",
        "description": "Generate an api key for a user",
        "operationId": "1f7546577e27b473c342baecba8ff68c",
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "description": "User UUID",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/uuidSchema"
            }
          }
        ],
        "requestBody": {
          "description": "API Key data",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "description": {
                    "description": "Description of the API key",
                    "type": [
                      "string",
                      "null"
                    ],
                    "example": "MDM user provisioning key"
                  }
                },
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created response if key has been created",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/GeneratedApiKey"
                        }
                      },
                      "type": "object"
                    },
                    {
                      "$ref": "#/components/schemas/PublicV1ResponseBody"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "GeneratedApiKey": {
        "required": [
          "apiKey",
          "expiration",
          "description"
        ],
        "properties": {
          "apiKey": {
            "description": "The API Key secret value",
            "type": [
              "string"
            ],
            "example": "lsc-secretAPIKeyValue"
          },
          "expiration": {
            "description": "Moment that the API Key expires",
            "oneOf": [
              {
                "$ref": "#/components/schemas/isoDateTimeSchema"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "description": "Description of the API Key",
            "type": [
              "string",
              "null"
            ],
            "example": "MDM user provisioning key"
          }
        },
        "type": "object"
      },
      "uuidSchema": {
        "type": "string",
        "format": "uuid",
        "example": "9890ed24-405d-4688-abcd-b7f829d75939"
      },
      "isoDateTimeSchema": {
        "description": "Date-time formatted to ISO8601. See https://www.rfc-editor.org/rfc/rfc3339#section-5.6",
        "type": "string",
        "format": "date-time",
        "example": "2024-09-17T15:45:00+02:00"
      },
      "PublicV1ResponseBody": {
        "properties": {
          "data": {
            "description": "Representation of the resource or collection of resources targeted by a request",
            "type": "object",
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "errors": {
            "description": "Additional information about problems encountered while performing an operation",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicV1ErrorElement"
            }
          },
          "meta": {
            "description": "Non-standard meta-information",
            "type": "object"
          }
        },
        "type": "object"
      },
      "PublicV1ErrorElement": {
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "description": "Machine-readable designation of the error",
            "type": "string"
          },
          "message": {
            "description": "Human-readable designation of the error, intended for developers, not necessarily end-users",
            "type": "string"
          },
          "attribute": {
            "description": "Name of the attribute for which the validation failed, only in case of validation errors",
            "type": "string"
          }
        },
        "type": "object"
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad request, e.g. trying to create an API key for a stopped user",
        "x-statusCode": "400"
      },
      "Forbidden": {
        "description": "Forbidden, e.g. trying to access the endpoint without authorization",
        "x-statusCode": "403"
      },
      "NotFound": {
        "description": "Resource cannot be found",
        "x-statusCode": "404"
      },
      "Unprocessable": {
        "description": "Unprocessable entity, i.e. Validation error",
        "x-statusCode": "422"
      }
    },
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "description": "Bearer token. Just enter the token itself without 'Bearer' keyword",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "API Keys",
      "description": "API Keys related endpoints",
      "externalDocs": {
        "description": "API key guide",
        "url": "https://integrations.luscii.com/docs/api-key"
      }
    }
  ],
  "externalDocs": {
    "description": "General Public API Documentation",
    "url": "https://integrations.luscii.com/docs/public-api"
  },
  "servers": [
    {
      "url": "https://vitalsapi.luscii.com/"
    }
  ],
  "x-readme": {}
}
```