Skip to main content
POST
https://example.com
/
api
/
api-keys
Create API key
curl --request POST \
  --url https://example.com/api/api-keys \
  --header 'Content-Type: application/json' \
  --cookie better-auth.session_token= \
  --data '
{
  "indexId": "<string>",
  "name": "<string>"
}
'
{
  "summary": {
    "createdAt": "<unknown>",
    "createdByUserId": "<string>",
    "id": 123,
    "indexId": "<string>",
    "lastUsedAt": null,
    "name": "<string>",
    "tokenPrefix": "<string>"
  },
  "token": "<string>"
}

Authorizations

better-auth.session_token
string
cookie
required

Body

application/json
indexId
string
required
Minimum string length: 1
name
string
required
Required string length: 1 - 100
role
enum<string>
required
Available options:
ingest,
search

Response

API key created

summary
object
required
token
string
required