> ## Documentation Index
> Fetch the complete documentation index at: https://mikting.docs.komo.moe/llms.txt
> Use this file to discover all available pages before exploring further.

# Secrets

> Environment variables, numbered API keys, and the shared .env file.

Store API credentials in the environment. With the default `MIKTING_`
prefix, `{{secret.NAME}}` reads `MIKTING_NAME`. Configure a different prefix
with `secrets.prefix`. Secrets have no Discord management interface.

References work in templated strings, including URLs, headers, query
parameters, JSON, forms, and text bodies. Secret references are resolved
before `[[variables]]` and `%placeholders%`.

```yaml theme={null}
- id: miktingHttp
  args:
    url: 'https://api.example.com/v1/check'
    headers: { Authorization: 'Bearer {{secret.API_TOKEN}}' }
    json: { text: '%message_content%' }
```

The authentication shortcuts use the same secret names:

* `auth: { type: bearer, tokenSecret: API_TOKEN }`
* `auth: { type: basic, userSecret: API_USER, passSecret: API_PASS }`

If a secret is missing, the action sets `[[mikting_error]]` to
`missing_secret:NAME` and runs its follow-up actions.

With `logging.redactContent: true` (the default), the logger redacts known
secret values and Bearer or Basic credentials. Log lines are capped at 2000
characters. Keep credentials out of script text and repository files.

On Pterodactyl, set `MIKTING_*` variables in the egg environment, startup
variables, or the shared environment file described below.

## Numbered bearer keys

For `auth: { type: bearer, tokenSecret: TYPESAFE_API_KEY }`, configure the
keys in the environment:

```ini theme={null}
MIKTING_TYPESAFE_API_KEY_1=your-first-key
MIKTING_TYPESAFE_API_KEY_2=your-second-key
MIKTING_TYPESAFE_API_KEY_10=your-tenth-key
```

Keep the base name `TYPESAFE_API_KEY` in YAML. Requests rotate through
nonempty numbered slots in numeric order; gaps are allowed. An unnumbered
`MIKTING_TYPESAFE_API_KEY` works on its own or as the first pool slot.
Duplicate key values count once. `secrets.prefix` applies to every slot.

Key pooling applies to the bearer `tokenSecret` shortcut. Direct
`{{secret.NAME}}` references and basic authentication resolve exact names.

HTTP actions and debug checks share rotation state for each destination
origin and base secret name. Each request keeps one key for its duration,
including concurrent requests and transport retries. A failed POST is not
replayed against another key.

| Response | Pool behavior |
| - | - |
| HTTP 401 or 403 | Excludes the selected key until its value changes or the addon reloads. If all keys are excluded, requests fail before sending. |
| HTTP 429 | Pauses the entire pool for `Retry-After`, interpreted as seconds or an HTTP date. The fallback is 60 seconds when the header is absent or invalid. In-flight requests may already have been sent. |

Rotation does not increase a provider's quota. For example,
[TypeSafe limits apply to the organization](https://docs.typesafe.ai/models).
The same pooling mechanism supports the selected Jev setup and OpenAI or
Groq bearer keys.

The selected slot name is available in `[[mikting_key_name]]` and
`[[<storeAs>_key_name]]` and appears in private moderation debug reports.
Reports expose the slot name only; error messages and response excerpts
redact credential values.

Restart after changing environment keys or the shared `.env` file. See
`self-scripts/.env.example` for the moderation variables.

## Shared environment file

Mikting loads `<scripts.dir>/.env` at addon startup. The default path is
`configs/Mikting/scripts/.env`. All scripts use this file.

```ini theme={null}
# comments, export KEY=... and quotes around values are accepted
MIKTING_API_TOKEN=abc123
MIKTING_HOOK_DEPLOYS=a-long-random-string
```

Existing environment variables take precedence. The file fills missing
`MIKTING_*` keys; other keys are ignored. A missing file is skipped.
The startup message reports the loaded key names and count without values.
The default `/configs/` directory is excluded by the repository's
`.gitignore`.

[Documentation home](https://mikting.docs.komo.moe/index.md) · [Source Markdown](https://gitlab.com/komomori/mikting/-/blob/main/docs/mikting-secrets.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.