---
title: "Create API Key"
method: POST
path: "/v4/organizations/{organizationId}/aiServices/models/apiKeys"
tags: ["Model Services API Keys (AI Data Plane)"]
---

# Create API Key

`POST /v4/organizations/{organizationId}/aiServices/models/apiKeys`

## Request

- Base URL: `https://cloudapi.cloud.couchbase.com`
- URL: `https://cloudapi.cloud.couchbase.com/v4/organizations/{organizationId}/aiServices/models/apiKeys`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/couchbase/apis/couchbase-capella-management-api/docs/v4/organizations/:organizationId/aiServices/models/apiKeys/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a new API Key for the specified region within an organization.
API Key created for a region can be used to access all the models of that region for inferencing.

In order to access this endpoint, the provided API key must have at least one of the following roles:
  - Organization Owner

To learn more, see [Organization, Project, and Database Access Overview](https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html).

## Request body

- CreateLanguageModelAPIKeyRequest
  - `name` string, required: Name of the Language Model API Key.
  - `description` string: Description of the Language Model API Key.
  - `expiry` number, float, required: Expiry of the API key in number of days. Maximum value is 365 days.
  - `allowedCIDRs` string[], required: List of IP addresses or CIDR blocks that are allowed to use this API key.
  - `allowedModels` string[]: List of allowed model IDs for this API key. - If empty or omitted, defaults to "*" (all models in the region). - Can be set to ["*"] explicitly for all models. - Can contain specific model IDs to restrict access to those models only.
  - `region` string, required: The region where the API key will be created. The apikey created in a region can access all the models available in that region.

## Response `201`

Successfully created API Key.

- CreateLanguageModelAPIKeyResponse
  - `id` string: Unique identifier for the Model API key.
  - `token` string: Generated API key token (only returned during creation).

## Other responses

- `400`: Returned when we are unable to decode the recevied payload.
- `401`: The client does not have the valid credentials to access this resource.
- `403`: The client does not have the necessary permissions to access this resource.
- `404`: AI Gateway doesn't exist for the tenant in the specified region.
- `422`: Request validation error.
- `500`: An unexpected error occurred in the server while processing this request.

## Changes

- **2026-08-06** `e67df5d1f74e`: 3 info
  - api tag `Model Services API Keys (AI Data Plane)` added
  - api tag `Model Services API Keys (AI Services)` removed
  - added the non-success response with the status `404`

[Operation history](https://skmtc.dev/couchbase/apis/couchbase-capella-management-api/changes/v4/organizations/:organizationId/aiServices/models/apiKeys/post.md)

---

[API](https://skmtc.dev/couchbase/apis/couchbase-capella-management-api.md) - [All operations](https://skmtc.dev/couchbase/apis/couchbase-capella-management-api/llms.txt) - [OpenAPI document](https://skmtc.dev/couchbase/apis/couchbase-capella-management-api/revisions/a5e88bcf71cb?raw)
