Skip to content

Create an API key

POST
/v1/api-keys
curl --request POST \
--url https://your-machine.your-tailnet.ts.net/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "sales agent" }'

The key is returned once. Store it; only its hash is kept.

Media typeapplication/json
object
name
required
string
<= 80 characters

Example

sales agent

The new key.

Media typeapplication/json
object
apiKey
object
id
string format: uuid
name
string
prefix
string
createdAt
string format: date-time
lastUsedAt
string format: date-time
key
string

Example

{
"apiKey": {
"prefix": "gw_9fJ2",
"key": "gw_9fJ2kQx0b7Lw4mT1sV8yZ3cA6dE5hN2p"
}
}