---
title: "Create"
method: POST
path: "/api_keys"
tags: ["APIKeys"]
---

# Create

`POST /api_keys`

Create a new API key. The generated API key can be used to authenticate to the ngrok API.

## Headers

- `ngrok-version` integer, required

## Request body

- APIKeyCreate
  - `description` string — human-readable description of what uses the API key to authenticate. optional, max 255 bytes.
  - `metadata` string — arbitrary user-defined data of this API key. optional, max 4096 bytes
  - `owner_id` string — If supplied at credential creation, ownership will be assigned to the specified User or Bot. Only admins may specify an owner other than themselves. Defaults to the authenticated User or Bot.

## Response `201`

Create a new API key. The generated API key can be used to authenticate to the ngrok API.

- APIKey
  - `id` string — unique API key resource identifier
  - `uri` string — URI to the API resource of this API key
  - `description` string — human-readable description of what uses the API key to authenticate. optional, max 255 bytes.
  - `metadata` string — arbitrary user-defined data of this API key. optional, max 4096 bytes
  - `created_at` string — timestamp when the api key was created, RFC 3339 format
  - `token` string — the bearer token that can be placed into the Authorization header to authenticate request to the ngrok API. **This value is only available one time, on the API response from key creation. Otherwise it is null.**
  - `owner_id` string — If supplied at credential creation, ownership will be assigned to the specified User or Bot. Only admins may specify an owner other than themselves. Defaults to the authenticated User or Bot.

## 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

- **2024-10-22** `e40349f8ec6f` — 1 info
  - api operation id `APIKeysCreate` removed and replaced with `ApiKeysCreate`

[Change history](https://skmtc.dev/ngrok/apis/ngrok-openapi/changes/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)
