---
title: "Create"
method: POST
path: "/ai_gateway_api_keys"
tags: ["AIGatewayAPIKeys"]
---

# Create

`POST /ai_gateway_api_keys`

Create a new AI Gateway API Key

## Headers

- `ngrok-version` integer, required

## Request body

- AIGatewayAPIKeyCreate
  - `description` string — human-readable description of this API key
  - `metadata` string — arbitrary user-defined metadata for this API key
  - `endpoint_id` string, required — unique identifier of the AI Gateway endpoint this key is associated with
  - `provider_keys` AIGatewayAPIKeyProviderKeyCreate[] — optional list of provider keys to attach to this managed key at create time
    - `provider_id` string, required — which AI provider this key is for, ex: "openai" / "anthropic"
    - `name` string, required — user-friendly label for this key
    - `value` string, required — plaintext provider key value — write-only input
    - `description` string — human-readable description of this provider key
    - `metadata` string — arbitrary user-defined metadata for this provider key

## Response `201`

Create a new AI Gateway API Key

- AIGatewayAPIKey
  - `id` string — unique identifier for this API key
  - `uri` string — URI of this AI Gateway API Key API resource
  - `created_at` string — Timestamp when the API key was created (RFC 3339 format)
  - `updated_at` string — Timestamp when the API key was last updated (RFC 3339 format)
  - `description` string — human-readable description of this API key
  - `metadata` string — arbitrary user-defined metadata for this API key
  - `created_by` Ref
    - `id` string — a resource identifier
    - `uri` string — a uri for locating a resource
  - `last_updated_by` Ref
    - `id` string — a resource identifier
    - `uri` string — a uri for locating a resource
  - `endpoint` Ref
    - `id` string — a resource identifier
    - `uri` string — a uri for locating a resource
  - `token` string — the API key token. Only provided when the key is first created.
  - `display_name` string — n/a
  - `last_used` string — n/a
  - `provider_keys` AIGatewayProviderKey[] — provider keys attached to this managed key
    - `id` string — unique identifier for this provider key
    - `uri` string — URI of this AI Gateway Provider Key API resource
    - `created_at` string — Timestamp when the provider key was created (RFC 3339 format)
    - `updated_at` string — Timestamp when the provider key was last updated (RFC 3339 format)
    - `provider_id` string — which AI provider this key is for, e.g. "openai", "anthropic"
    - `description` string — human-readable description of this provider key
    - `metadata` string — arbitrary user-defined metadata for this provider key
    - `created_by` Ref
      - `id` string — a resource identifier
      - `uri` string — a uri for locating a resource
    - `last_updated_by` Ref
      - `id` string — a resource identifier
      - `uri` string — a uri for locating a resource
    - `ai_gateway_api_key` Ref
      - `id` string — a resource identifier
      - `uri` string — a uri for locating a resource
    - `display_name` string — redacted display form of the key value, e.g. sk-abc***xyz
    - `last_used` string — Timestamp when the provider key was last used (RFC 3339 format)

## Other responses

- `4XX` — An error. The body carries a machine-readable error_code and a human-readable msg; every code is documented at https://ngrok.com/docs/errors. A 429 with error code ERR_NGROK_226 means the account exceeded the documented request-rate limit.
- `5XX` — An error. The body carries a machine-readable error_code and a human-readable msg; every code is documented at https://ngrok.com/docs/errors. A 429 with error code ERR_NGROK_226 means the account exceeded the documented request-rate limit.

## Changes

- **2026-08-25** `c697539ac350` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/ngrok/apis/ngrok-openapi/changes/ai_gateway_api_keys/post.md)

---

[API](https://skmtc.dev/ngrok/apis/ngrok-openapi.md) · [All operations](https://skmtc.dev/ngrok/apis/ngrok-openapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ngrok/ngrok-openapi/revisions/c697539ac350/schema)
