Skip to main content
POST
/
api-keys
Create an AI Gateway API key
curl --request POST \
  --url https://api.ngrok.ai/api-keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "metadata": "<string>"
}
'
{
  "id": "<string>",
  "uri": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "createdBy": {
    "id": "<string>",
    "uri": "<string>"
  },
  "lastUpdatedBy": {
    "id": "<string>",
    "uri": "<string>"
  },
  "keyRedacted": "<string>",
  "name": "<string>",
  "description": "<string>",
  "metadata": "<string>",
  "token": "<string>",
  "lastUsed": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string

User-friendly label for this API key.

Maximum string length: 255
description
string

Human-readable description of this API key.

Maximum string length: 255
metadata
string

Arbitrary user-defined metadata for this API key.

Maximum string length: 4096

Response

The created AI Gateway API key.

id
string
required

Unique identifier for this API key.

uri
string
required

URI of this AI Gateway API Key API resource.

createdAt
string<date-time>
required

Timestamp when the API key was created.

updatedAt
string<date-time>
required

Timestamp when the API key was last updated.

createdBy
object
required
lastUpdatedBy
object
required
keyRedacted
string
required

Redacted display form of the API key token.

name
string

User-friendly label for this API key.

description
string

Human-readable description of this API key.

metadata
string

Arbitrary user-defined metadata for this API key.

token
string

Plaintext API key token. Only returned when the key is first created.

lastUsed
string<date-time> | null

Timestamp when the API key was last used.