---
title: "Create an AI Gateway key"
method: POST
path: "/project/{project}/ai-gateway/keys"
tags: ["AIGateway"]
---

# Create an AI Gateway key

`POST /project/{project}/ai-gateway/keys`

## Request

- Base URL: `https://api.aiven.io/v1`
- URL: `https://api.aiven.io/v1/project/{project}/ai-gateway/keys`
- Auth: HTTP bearer and OAuth 2
  - Authorization code: `https://console.aiven.io/oauth/authorize`
  - Token URL: `https://api.aiven.io/v1/oauth2/token` scopes: `projects:write`

> This endpoint **may be changed or removed at any time**. Don't use it in production environments.

The key value is returned only by this call and cannot be read back later.

## Path parameters

- `project` string, required

## Request body

- AIGatewayKeyCreateRequestBody: AIGatewayKeyCreateRequestBody
  - `description` string: Longer description on how the key is used
  - `expiry_time` string: Time the key expires, or null for a key that never expires
  - `name` string, required: Short human readable identifier for the key

## Response `200`

Response

- AIGatewayKeyCreateResponse: AIGatewayKeyCreateResponse
  - `create_time` string, required: Time the key was created
  - `description` string: Longer description on how the key is used
  - `expiry_time` string: Time the key expires
  - `key` string, required: The key
  - `key_id` string, required: Key ID
  - `key_suffix` string, required: Last characters of the key
  - `name` string, required: Short human readable identifier for the key
  - `revocation_time` string: Time the key was revoked

## Other responses

- `400`: The name is blank, the expiry time is unreadable or in the past, or the project has reached its AI Gateway key limit
- `403`: AI Gateway is not enabled for this organization
- `503`: AI Gateway keys are unavailable

## Changes

- **2026-10-14** `890113a87c87`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/aiven/apis/aiven-api-documentation/changes/project/:project/ai-gateway/keys/post.md)

---

[API](https://skmtc.dev/aiven/apis/aiven-api-documentation.md) - [All operations](https://skmtc.dev/aiven/apis/aiven-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/aiven/apis/aiven-api-documentation/revisions/562453405db0?raw)
