---
title: "Create an API key"
method: POST
path: "/organizations/{orgId}/api-keys"
tags: ["organizations"]
---

# Create an API key

`POST /organizations/{orgId}/api-keys`

Allows a user to generate an API key for their organization.

## Path parameters

- `orgId` string, uuid, required

## Request body

- CreateApiKeyRequest
  - `name` string, required — The API key name.
  - `scope` 'ie_model' | 'ce_resource' — The API key scope. Default value is `ie_model`.
  - `expiresAt` integer — The UNIX timestamp when API key will expire (UTC). - Must be a UNIX timestamp in seconds and must be greater than the current time. - If not set, the key will not expire.

## Response `201`

Successfully created an API key.

- CreateApiKeyResponse
  - `key` string, required — The generated API key (returned only once).

## Other responses

- `400` — - [group:**request**, code:**0**]: Invalid field in the request. - [group:**request**, code:**1**]: The request body is required. - [group:**api-key**, code:**0**]: The organization has reached the maximum number of API keys.
- `404` — - [group:**organization**, code:**2**]: Organization does not exist.
- `500` — - [group:**api-key**, code:**1000**]: Create API key encountered DB error. - [group:**api-key**, code:**1200**]: Get API key list encountered DB error. - [group:**organization**, code:**1201**]: Get organization encountered DB error.

---

[API](https://skmtc.net/gmicloud/apis/cluster-engine-api.md) · [All operations](https://skmtc.net/gmicloud/apis/cluster-engine-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gmicloud/cluster-engine-api/versions/bcbab016469f/schema)
