Headscale unofficial
POST/api/v1/apikey

Create an API key

Creates a new API key. You can provide expiration as a date-time value or omit it if you do not want to specify an expiration. The response contains the generated key in apiKey.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 body field

Optional API key settings.

expirationstringoptional
The API key expiration time as a date-time string.

2 status codes
200Returns an object containing the newly generated API key in `apiKey`.
apiKeystringrequired
defaultError
detailstringoptional
A human-readable explanation specific to this occurrence of the problem.
errorsarray<object>optional
Optional list of individual error details
instancestringoptional
A URI reference that identifies the specific occurrence of the problem.
statusintegeroptional
HTTP status code
titlestringoptional
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
typestringoptional
A URI reference to human-readable documentation for the error.
Default:about:blank

Error handling

If provided, expiration must be a date-time string. The request body can omit expiration.