---
title: NameID mapper scripting API
description: Configure the NameID mapper scripting API to customize SAML 2.0 NameID values using script bindings for session, identity, and helper methods
component: pingam
version: 8
page_id: pingam:am-scripting:saml2-nameid-mapper-api
canonical_url: https://docs.pingidentity.com/pingam/8.1/am-scripting/saml2-nameid-mapper-api.html
llms_txt: https://docs.pingidentity.com/pingam/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
revdate: 2026-06-01T14:34:20Z
page_aliases: ["scripting-guide:saml2-nameid-mapper-api.adoc"]
superseded_by: https://docs.pingidentity.com/pingam/8.1/am-scripting/saml2-nameid-mapper-api.html
---

# NameID mapper scripting API

|   |                                                                                                                                                                                         |
| - | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | The NameID mapper script is a next-generation script and therefore has access to all the *next-generation* [common bindings](script-bindings.html) in addition to those described here. |

| Binding              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `hostedEntityId`     | The entity ID for the hosted IDP.                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `remoteEntityId`     | The ID of the hosted SAML 2.0 entity.                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `nameIDFormat`       | The requested SAML 2.0 NameID format.                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `session`            | An instance of `ScriptedSession` representing the user's single sign-on session object interface for information about SSO token and authentication information, as well as session-related properties.Only present when the session object passed by the SAML engine is an SSOToken.Retrieve session property values with the following `ScriptedSession` supported method:`public String getProperty(String name)`                                                                                |
| `nameIDScriptHelper` | The \`NameIDScriptHelper\`\`binding provides the following supporting methods and constants for customizing the NameID value:- Constants

  * `NAMEID_FORMAT_TRANSIENT`

  * `NAMEID_FORMAT_PERSISTENT`

  * `NAMEID_FORMAT_UNSPECIFIED`

  * `NAMEID_FORMAT_EMAIL`

- Methods

  * `public String createNameIdentifier()`

  * `public String getNameIDValue() throws SAML2Exception`

  * `public boolean shouldPersistNameIDFormat()`

  * `public String getNameIDFromSession()`Always present. |
| `identity`           | An instance of `ScriptedIdentityScriptWrapper` representing a scriptable implementation of an AM identity. The `identity` binding is derived from the session, so it's only present if the `session` object is.The `identity` object will also be missing if AM throws an exception during its creation. If this happens, AM records an entry in the logs.                                                                                                                                          |
