Placeholders

Android · Linux · macOS · Windows
View Markdown

Placeholders are tokens that Keyguard replaces with an item’s data when you open the item. Copying or opening a URI uses the result. The syntax follows the KeePass placeholder specification.

Placeholders work in:

  • each URI of an item, except one whose Match detection is Regular expression;
  • commands in URL overrides.

Other fields, autofill and Quick search use the text as written.

Resolution rules

  • Placeholder names and their basic parameters are case-insensitive. The comment prefix {c:...} must be lowercase, and environment variable names follow the system’s rules.
  • All placeholders in an item resolve at the same instant, so time-based placeholders match each other.
  • Placeholders can be nested. The innermost resolves first.
  • A known placeholder with no value resolves to an empty string. {otp} becomes nothing if the item has no one-time password.
  • An unknown placeholder stays as it is. {keyguard} stays {keyguard}.

Item fields

PlaceholderDescription
{uuid}UUID
{title}Title or name
{username}Username
{password}Password
{otp}One-time password
{notes}Notes
{favorite}true or false

If the username is joe:

> 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.

If the item’s license field holds 12345678ABCD:

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

URL parts

These work in URL override commands. They extract parts 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}Port, or the scheme’s default 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 : sets the separator. It can be 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

For the exact regex semantics, see Kotlin’s Regex.replace documentation.

Convert to another representation

{t-conv:/value/type/}

The separator works the same way as above.

TypeConversion
u or upperUppercase
l or lowerLowercase
base64Base64: no padding, no wrap, URL safe
hexHex, lowercase
uriURI-encode, with a space as +
uri-decURI-decode, with + as a space

If the username is joe and the password is Password1!:

> 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. For example, if HOME is /home/username:

> {%HOME%}
/home/username

Date and time

These resolve to the current date and time, in local time or in UTC. Components have no leading zero: January is 1.

Local

PlaceholderDescription
{dt_simple}Current local date and time as a 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 and time as a 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 when the value resolves