---
title: "Create an AI Gateway API key"
method: POST
path: "/v1/org/ai-gateway/api-keys/mine"
tags: ["Inference Providers"]
---

# Create an AI Gateway API key

`POST /v1/org/ai-gateway/api-keys/mine`

## Request

- Base URL: `https://api.openworklabs.com`
- URL: `https://api.openworklabs.com/v1/org/ai-gateway/api-keys/mine`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer

Creates an AI Gateway API key for the caller, with a name and an optional expiry, and returns it once; Den keeps only a digest. An expired key is refused by the Gateway. The key reaches the models the caller's grants allow, through GET /api/v1/models and the provider-less endpoints. A member may hold 20 unexpired keys. Refused while the organization does not allow member keys.

## Request body

- CreateGatewayApiKeyRequest
  - `name` string, required
  - `expiresAt` string, date-time, nullable

## Response `201`

Key created.

- object
  - `apiKey` object, required
    - `id` string, required
    - `name` string, required
    - `prefix` string, required
    - `createdAt` string, date-time, required
    - `lastUsedAt` string, date-time, nullable, required
    - `expiresAt` string, date-time, nullable, required
  - `key` string, required

## Other responses

- `400`: The request was invalid.
- `401`: Authentication required.
- `404`: The organization was not found.
- `409`: Member keys are off for the organization, or the caller holds the most keys allowed.

## Changes

- **2026-11-10** `73cf944df667`: 2 breaking, 1 info
  - response property `apiKey/expiresAt` list-of-types was widened by adding types `null` to media type `application/json` of response `201`
  - response property `apiKey/lastUsedAt` list-of-types was widened by adding types `null` to media type `application/json` of response `201`
  - the `apiKey/createdAt` response's property pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$` was added for the status `201`
- **2026-11-10** `02023e0242a2`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/openworklabs/apis/den-api/changes/v1/org/ai-gateway/api-keys/mine/post.md)

---

[API](https://skmtc.dev/openworklabs/apis/den-api.md) - [All operations](https://skmtc.dev/openworklabs/apis/den-api/llms.txt) - [OpenAPI document](https://skmtc.dev/openworklabs/apis/den-api/revisions/84fb0f99fb95?raw)
