> For the complete documentation index, see [llms.txt](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/integrations/configuration/identity-mapping-templates.md).

# Identity Mapping Templates

### Overview

A template is one of the property types available in a property matcher when you configure an [identity mapping](/4yItIzMvkpAvMVFAamTf/integrations/configuration/custom-identity-mappings.md). Select **Template** as the source or destination property, then enter a template expression. Veza validates the expression when you save the configuration and returns an error if it references an unknown function or has invalid syntax.

Use a template when the two systems hold the same person under different naming conventions, and no single attribute pair matches on its own:

* Source and destination follow different username formats.
* You need to normalize an identifier, such as removing a domain or padding a number.
* You want one mapping rule to work across several applications.

Templates are available on both sides of a matcher. You can build a template on the source, on the destination, or on both.

### Template syntax

A template combines property placeholders with optional transformation functions:

```txt
{PropertyName | FUNCTION1 | FUNCTION2,...}
```

For example, a template that turns a user's name from "JOHN DOE" into "jdoe":

```txt
{FirstInitial | LOWER}{LastName | LOWER}
```

Literal characters outside the braces are preserved, so `{FirstName | LOWER}.{LastName | LOWER}` produces `john.doe`.

### Supported properties

A template can reference **any property on the source or destination entity** by name. Property names are matched without regard to case, so `{email}`, `{principal_name}`, and `{employee_id}` all work when that property exists on the entity being matched.

Veza also provides these properties when a user's name is available:

* `FirstName`: the user's given name
* `LastName`: the user's surname
* `FirstInitial`: the first character of the given name, the same as `{FirstName | SUB_STRING,0,1}`
* `LastInitial`: the first character of the surname, the same as `{LastName | SUB_STRING,0,1}`

An entity that does not have a referenced property does not match the template expression.

### Transformation functions

Transformation functions match identities based on a variation of the source attribute. Identity mapping supports a subset of the [Lifecycle Management transformer library](/4yItIzMvkpAvMVFAamTf/features/lifecycle-management/transformers/transformer-reference.md); see that reference for additional examples and pipeline patterns.

#### Case conversion

**LOWER**

Converts all characters to lowercase.

* Example: `{FirstName | LOWER}` for "John" returns "john"

**UPPER**

Converts all characters to uppercase.

* Example: `{FirstName | UPPER}` for "John" returns "JOHN"

**TITLE\_CASE**

Capitalizes the first letter of each word and lowercases the rest.

* Example: `{LastName | TITLE_CASE}` for "SMITH" returns "Smith"

**SENTENCE\_CASE**

Capitalizes the first letter only and lowercases the rest.

* Example: `{LastName | SENTENCE_CASE}` for "SMITH" returns "Smith"

**LOWER\_SNAKE\_CASE**

Converts to lowercase with underscores replacing spaces and other separators.

* Example: `{LastName | LOWER_SNAKE_CASE}` for "Van Der Berg" returns "van\_der\_berg"

**UPPER\_SNAKE\_CASE**

Converts to uppercase with underscores replacing spaces and other separators.

* Example: `{LastName | UPPER_SNAKE_CASE}` for "Van Der Berg" returns "VAN\_DER\_BERG"

**LOWER\_CAMEL\_CASE**

Converts to camel case with the first letter lowercase.

* Example: `{FirstName | LOWER_CAMEL_CASE}` for "John Smith" returns "johnSmith"

**UPPER\_CAMEL\_CASE**

Converts to Pascal case with the first letter uppercase.

* Example: `{FirstName | UPPER_CAMEL_CASE}` for "John Smith" returns "JohnSmith"

#### Substring extraction

**SUB\_STRING**

Extracts a portion of text.

* Parameters:
  * start\_index: Starting position (0-based)
  * length: Number of characters to extract
* Example: `{FirstName | SUB_STRING,0,3}` for "John" returns "Joh"

**FIRST\_N**

Returns the first N characters.

* Parameters:
  * length: Number of characters to return
* Example: `{LastName | FIRST_N,4}` for "Smith" returns "Smit"

**LAST\_N**

Returns the last N characters.

* Parameters:
  * length: Number of characters to return
* Example: `{LastName | LAST_N,3}` for "Smith" returns "ith"

**SPLIT**

Splits on a delimiter and returns the element at the specified index.

* Parameters:
  * delimiter: The string to split on
  * index: Zero-based position of the element to return
* Example: `{Email | SPLIT,"@",0}` for "<john.doe@company.com>" returns "john.doe"

#### Trim

**TRIM**

Removes leading and trailing whitespace.

* Example: `{FirstName | TRIM}` for " John " returns "John"

**TRIM\_CHARS**

Removes specified characters from both ends.

* Parameters:
  * characters: The characters to trim
* Example: `{FirstName | TRIM_CHARS,"."}` for ".john." returns "john"

**TRIM\_CHARS\_LEFT**

Removes specified characters from the start.

* Parameters:
  * characters: The characters to trim
* Example: `{FirstName | TRIM_CHARS_LEFT,"0"}` for "00123" returns "123"

**TRIM\_CHARS\_RIGHT**

Removes specified characters from the end.

* Parameters:
  * characters: The characters to trim
* Example: `{FirstName | TRIM_CHARS_RIGHT,"."}` for "john." returns "john"

#### Character removal

**REMOVE\_CHARS**

Removes all occurrences of specified characters.

* Parameters:
  * characters: The characters to remove
* Example: `{Username | REMOVE_CHARS,".-_"}` for "john.doe\_1-2" returns "johndoe12"

**REMOVE\_WHITESPACE**

Removes all whitespace characters.

* Example: `{Username | REMOVE_WHITESPACE}` for "john doe" returns "johndoe"

#### String modification

**REPLACE\_ALL**

Replaces all occurrences of a string.

* Parameters:
  * original: The string to replace
  * replacement: The replacement string (omit to delete)
* Example: `{Email | REPLACE_ALL,"@company.com",""}` for "<john@company.com>" returns "john"

**APPEND**

Appends a value to the end.

* Parameters:
  * value: The string to append
* Example: `{Username | APPEND,"@example.com"}` for "john" returns "<john@example.com>"

**PREPEND**

Prepends a value to the start.

* Parameters:
  * value: The string to prepend
* Example: `{Username | PREPEND,"CN="}` for "john" returns "CN=john"

#### Padding

**LEFT\_PAD**

Pads on the left to reach a specified total length.

* Parameters:
  * length: Target total length
  * pad character: Character to use for padding (default is space)
* Example: `{Username | LEFT_PAD,8,"0"}` for "john" returns "0000john"

**RIGHT\_PAD**

Pads on the right to reach a specified total length.

* Parameters:
  * length: Target total length
  * pad character: Character to use for padding (default is space)
* Example: `{Username | RIGHT_PAD,8,"."}` for "john" returns "john...."

**ZERO\_PAD**

Left-pads with zeros to reach a specified total length.

* Parameters:
  * length: Target total length
* Example: `{EmployeeId | ZERO_PAD,6}` for "42" returns "000042"

#### Domain and character encoding

**REMOVE\_DOMAIN**

Removes the domain portion from an email address.

* Example: `{Email | REMOVE_DOMAIN}` for "<john@company.com>" returns "john"

**ASCII**

Converts non-ASCII characters to their closest ASCII equivalents and removes control characters.

* Example: `{FirstName | ASCII}` for "Łukasz" returns "Lukasz"

**REMOVE\_DIACRITICS**

Removes diacritical marks (accents) from characters.

* Example: `{FirstName | REMOVE_DIACRITICS}` for "résumé" returns "resume"

{% hint style="info" %}
**Functions not supported in identity mappings**

The following transformer categories are available in attribute sync and provisioning workflows but are excluded from identity mapping templates:

* **Generators** (RANDOM\_STRING\_GENERATOR, RANDOM\_NUMBER\_GENERATOR, UUID\_GENERATOR, and others): produce non-deterministic output unsuitable for identity matching.
* **Date and time** (DATE\_FORMAT, DATE\_ADJUST, ASSUME\_TIME\_ZONE, and others): context-dependent and non-deterministic for matching purposes.
* **Lookup and entity** (FROM\_ENTITY\_ATTRIBUTE, FROM\_MANY\_ENTITIES\_ATTRIBUTE, LOOKUP): require graph cache or lookup table infrastructure that the identity mapping context does not provide.
* **Formatting** (COUNTRY\_CODE\_ISO3166, LANGUAGE\_RFC5646, PHONE\_NUMBER\_E164, FOR\_EACH, JSON\_FORMAT, JSON\_EXTRACT): not applicable to identity string matching.
  {% endhint %}

### Function composition

Chain multiple functions together. Veza applies them left to right:

```txt
{FirstName | TRIM | SUB_STRING,0,1 | UPPER}.{LastName | LOWER}
```

For a user "John Smith", this produces "J.smith".

### Common template patterns

1. Given-name initial followed by surname:

   ```txt
   {FirstInitial}{LastName}
   ```

   Example: "John Smith" returns "jsmith"
2. Given name followed by surname initial:

   ```txt
   {FirstName}.{LastInitial}
   ```

   Example: "John Smith" returns "john.s"
3. A template on both source and destination:

   ```txt
   {principal_name | REMOVE_DOMAIN | LOWER} → {email | SPLIT,"@",0}
   ```

   Matches users when the username portion of the principal name equals the local part of the email address.

### Related

* [Custom Identity Mappings](/4yItIzMvkpAvMVFAamTf/integrations/configuration/custom-identity-mappings.md) for configuring the mapping that holds the template
* [Automatic Identity Matching](/4yItIzMvkpAvMVFAamTf/integrations/configuration/automatic-identity-matching.md) for the attributes Veza compares without configuration
* [Transformer reference](/4yItIzMvkpAvMVFAamTf/features/lifecycle-management/transformers/transformer-reference.md) for the full function library


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.veza.com/4yItIzMvkpAvMVFAamTf/integrations/configuration/identity-mapping-templates.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
