Placeholders

Placeholders are tokens that Keyguard replaces with real data at the moment you use a field — copying it, opening it in a browser, and so on. The syntax is largely based on the KeePass specification.

Placeholders currently work in:

How resolution works

  • Placeholder names and their basic parameters are case-insensitive — the comment prefix {c:...} is the one exception and must be lowercase.
  • All placeholders in a field resolve at the same shared instant, so time-sensitive placeholders stay in sync with each other.
  • A known placeholder with no value resolves to an empty string{otp} becomes nothing if the item has no one-time password configured.
  • An unknown placeholder is kept as-is{keyguard} stays {keyguard}.

Item fields

PlaceholderDescription
{uuid}UUID
{title}Title / name
{username}Username
{password}Password
{otp}One-time password
{notes}Notes
{favorite}Favorite
> https://example.com?user={username}
https://example.com?user=joe

Custom fields

Reference a custom field by name with {s:name}. For example, if an item has a custom field named “Email”, {s:email} resolves to its value. If several fields share the name, the first one wins.

> https://example.com?license={s:license}
https://example.com?license=12345678ABCD

URL parts

Available in URL override commands. These extract pieces of the URL being overridden, so your command can reassemble them. {base} is identical to {url} and supports the same parts.

For the URL https://user:pw@keepass.info:80/path/example.php?q=e&s=t:

PlaceholderDescriptionValue
{url}Full URLhttps://user:pw@keepass.info:80/path/example.php?q=e&s=t
{url:rmvscm}Without schemeuser:pw@keepass.info:80/path/example.php?q=e&s=t
{url:scm}Schemehttps
{url:host}Hostkeepass.info
{url:port}Port80
{url:path}Path/path/example.php
{url:query}Queryq=e&s=t
{url:userinfo}User informationuser:pw
{url:username}Usernameuser
{url:password}Passwordpw
{url:parameter:q}Query parameter named qe

Text transformations

Replace with a regular expression

{t-replace-rx:/text/search/replace/}

The first symbol after : defines the separator — any symbol except { and } — and the trailing separator is required.

If the username field contains username@example.com:

> {t-replace-rx:/{username}/.*@(.*)/$1/}
example.com

See the underlying implementation’s documentation for the exact regex semantics.

Convert to another representation

{t-conv:/value/type/}

The separator works the same way as above. Supported types:

  • u or upper — uppercase;
  • l or lower — lowercase;
  • base64 — Base64 (no padding, no wrap, URL safe);
  • hex — HEX (lowercase);
  • uri — URI-encode;
  • uri-dec — URI-decode.
> https://example.com?user={username}&password={t-conv:/{password}/uri/}
https://example.com?user=joe&password=Password1%21

Environment variables

System environment variables are supported; enclose the variable name in % characters.

> {%HOME%}
/home/username

Date and time

Local

PlaceholderDescription
{dt_simple}Current local date/time as a simple, sortable string — for 2024-01-01 17:05:34 the value is 20240101170534
{dt_year}Year component
{dt_month}Month component
{dt_day}Day component
{dt_hour}Hour component
{dt_minute}Minute component
{dt_second}Second component

UTC

PlaceholderDescription
{dt_utc_simple}Current UTC date/time as a simple, sortable string — for 2024-01-01 17:05:34 the value is 20240101170534
{dt_utc_year}Year component
{dt_utc_month}Month component
{dt_utc_day}Day component
{dt_utc_hour}Hour component
{dt_utc_minute}Minute component
{dt_utc_second}Second component

Comments

PlaceholderDescription
{c:value}Comment — removed upon transformation