technitium 0.4.0

Typed async Rust client for the Technitium DNS Server API
Documentation
# Create API Token

## Endpoint

`/api/user/createToken`

## Method

GET

## Description

Creates a non-expiring API token that can be used with automation scripts to make API calls. The token provides the same privileges as the user account it was created for. It is recommended to create a separate user account with limited permissions for automation tasks. The token cannot be used to change the user's password or update user profile details.

## Parameters

| Name | Type | Required | Conditional | Description |
|------|------|----------|-------------|-------------|
| `user` | string | Yes | - | The username for the user account for which to generate the API token. |
| `pass` | string | Yes | - | The password for the user account. |
| `totp` | string | No | Required if the user account has Two Factor Authentication (2FA) enabled | The time-based one-time password (6-digit code from authenticator app). |
| `tokenName` | string | Yes | - | The name of the created token to identify its session. |

## Authentication

No token required. This endpoint authenticates via `user`/`pass` parameters directly.

## Response Fields

| Field | Type | Description |
|-------|------|-------------|
| `username` | string | The username of the user account the token was created for. |
| `tokenName` | string | The name assigned to this token. |
| `token` | string | The API token that MUST be used with all subsequent API calls. |

## Conditional Logic Notes

- If the user account has 2FA enabled, the `totp` parameter becomes required.
- The generated token does NOT expire (unlike session tokens from login).
- The token inherits the privileges of the user account, so permission changes to the user account will affect what the token can do.

## Edge Cases

- Tokens created via this endpoint **cannot** be used to call the Change Password (`/api/user/changePassword`) or Set User Profile (`/api/user/profile/set`) endpoints.
- Unlike login session tokens, API tokens do not have a sliding expiration window -- they persist until explicitly deleted via logout.
- Best practice is to create dedicated user accounts with minimal permissions for API tokens rather than using the `admin` account.