---
title: Manage scripts (REST)
description: AM provides the scripts endpoint to manage scripts using REST calls.
component: pingam
version: 8.1
page_id: pingam:am-scripting:manage-scripts-rest
canonical_url: https://docs.pingidentity.com/pingam/8.1/am-scripting/manage-scripts-rest.html
keywords: ["Scripts", "Rest", "JSON"]
page_aliases: ["scripting-guide:manage-scripts-rest.adoc"]
---

# Manage scripts (REST)

AM provides the `scripts` endpoint to manage scripts using REST calls.

User-created scripts are realm-specific, so you must include the realm when you call the endpoint, for example, `/json{/realm}/scripts`. If you don't specify a realm in the URI, AM uses the Top Level Realm.

|   |                                                                        |
| - | ---------------------------------------------------------------------- |
|   | AM includes some global example scripts that you can use in any realm. |

Scripts are represented in JSON and are built from standard JSON objects and values (strings, numbers, objects, sets, arrays, `true`, `false`, and `null`). Each script has a system-generated *universally unique identifier* (UUID), which you must specify when modifying existing scripts. Renaming a script won't affect the UUID.

Example script:

```json
{
  "_id": "01e1a3c0-038b-4c16-956a-6c9d89328cff",
  "name": "Authentication Tree Decision Node Script",
  "description": "Default global script for a scripted decision node",
  "script": "LyoKICAtIERhdGE...",
  "default": true,
  "language": "JAVASCRIPT",
  "context": "AUTHENTICATION_TREE_DECISION_NODE",
  "createdBy": "id=dsameuser,ou=user,ou=am-config",
  "creationDate": 1433147666269,
  "lastModifiedBy": "id=dsameuser,ou=user,ou=am-config",
  "lastModifiedDate": 1433147666269,
  "evaluatorVersion": "1.0"
}
```

The values for the fields shown in the example are explained below:

* `_id`

  The UUID that AM generates for the script.

* `name`

  The name provided for the script.

* `description`

  An optional text string to help identify the script.

* `script`

  The source code of the script. The source code is in UTF-8 format and encoded into Base64.

  For example, a script such as the following:

  ```javascript
  var a = 123;
  var b = 456;
  ```

  When encoded into Base64 becomes:

  ```none
  dmFyIGEgPSAxMjM7IA0KdmFyIGIgPSA0NTY7
  ```

* `default`

  Whether the script is the default script for the context.

* `language`

  The language the script is written in: `JAVASCRIPT` or `GROOVY`. The script context determines the supported language(s).

* `context`

  The context type of the script.

* `context`

  The context type of the script.

  **Supported context values**

  | Legacy                                      | Next-generation                                        | Used by                                                                                                                             |
  | ------------------------------------------- | ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
  | AUTHENTICATION\_CLIENT\_SIDE                | *Not available*                                        | Client-side authentication                                                                                                          |
  | AUTHENTICATION\_SERVER\_SIDE                | *Not available*                                        | Server-side authentication                                                                                                          |
  | AUTHENTICATION\_TREE\_DECISION\_NODE        | SCRIPTED\_DECISION\_NODE                               | [Scripted Decision node](https://docs.pingidentity.com/auth-node-ref/8.1/scripted-decision.html)                                    |
  |                                             | DEVICE\_MATCH\_NODE                                    | [Device Match node](https://docs.pingidentity.com/auth-node-ref/8.1/device-match.html)                                              |
  | *Not available*                             | CACHE\_LOADER                                          | [Cache manager](cache-manager.html)                                                                                                 |
  | CONFIG\_PROVIDER\_NODE                      | CONFIG\_PROVIDER\_NODE\_NEXT\_GEN                      | [Configuration Provider node](https://docs.pingidentity.com/auth-node-ref/8.1/config-provider.html)                                 |
  | *Not available*                             | LIBRARY                                                | [Library scripts](library-scripts.html)                                                                                             |
  | *Not available*                             | NODE\_DESIGNER                                         | [Custom scripted nodes](../am-authentication/node-designer.html)                                                                    |
  | OAUTH2\_ACCESS\_TOKEN\_MODIFICATION         | OAUTH2\_ACCESS\_TOKEN\_MODIFICATION\_NEXT\_GEN         | [Access token modification](../am-oauth2/modifying-access-tokens-scripts.html)                                                      |
  | OAUTH2\_AUTHORIZE\_ENDPOINT\_DATA\_PROVIDER | OAUTH2\_AUTHORIZE\_ENDPOINT\_DATA\_PROVIDER\_NEXT\_GEN | [Authorize endpoint data provider](../am-oauth2/plugins-auth-endpoint-data-provider.html)                                           |
  | *Not available*                             | OAUTH2\_DYNAMIC\_CLIENT\_REGISTRATION                  | [Customize dynamic client registration](../am-oidc1/dynamic-client-registration-script.html)                                        |
  | OAUTH2\_EVALUATE\_SCOPE                     | OAUTH2\_EVALUATE\_SCOPE\_NEXT\_GEN                     | [Scope evaluation](../am-oauth2/plugins-scope-evaluation.html)                                                                      |
  | OAUTH2\_MAY\_ACT                            | OAUTH2\_MAY\_ACT\_NEXT\_GEN                            | [Token exchange](../am-oauth2/token-exchange.html)                                                                                  |
  | OAUTH2\_SCRIPTED\_JWT\_ISSUER               | OAUTH2\_SCRIPTED\_JWT\_ISSUER\_NEXT\_GEN               | [Scripted trusted JWT issuer](../am-oauth2/oauth2-jwt-bearer-grant.html#configure-scripted-jwt-issuer)                              |
  | OAUTH2\_VALIDATE\_SCOPE                     | OAUTH2\_VALIDATE\_SCOPE\_NEXT\_GEN                     | [Scope validation](../am-oauth2/plugins-scope-validation.html)                                                                      |
  | OIDC\_CLAIMS                                | OIDC\_CLAIMS\_NEXT\_GEN                                | [OIDC claims](../am-oauth2/plugins-user-info-claims.html)                                                                           |
  | *Not available*                             | PINGONE\_VERIFY\_COMPLETION\_DECISION\_NODE            | [PingOne Completion Decision node](https://docs.pingidentity.com/auth-node-ref/8.1/pingone/pingone-verify-completion-decision.html) |
  | POLICY\_CONDITION                           | POLICY\_CONDITION\_NEXT\_GEN                           | [Scripted policy conditions](../am-authorization/scripted-policy-condition.html)                                                    |
  | SAML2\_IDP\_ADAPTER                         | SAML2\_IDP\_ADAPTER\_NEXTGEN                           | [IdP adapter](../am-saml2/custom-idp-adapter.html)                                                                                  |
  | SAML2\_IDP\_ATTRIBUTE\_MAPPER               | SAML2\_IDP\_ATTRIBUTE\_MAPPER\_NEXT\_GEN               | [IdP attribute mapper](../am-saml2/custom-idp-attribute-mapper.html)                                                                |
  | *Not available*                             | SAML2\_NAMEID\_MAPPER                                  | [NameID mapper](../am-saml2/custom-nameid-mapper.html)                                                                              |
  | *Not available*                             | SAML2\_SP\_ACCOUNT\_MAPPER                             | [SP account mapper](../am-saml2/custom-sp-account-mapper.html)                                                                      |
  | SAML2\_SP\_ADAPTER                          | SAML2\_SP\_ADAPTER\_NEXTGEN                            | [SP adapter](../am-saml2/custom-sp-adapter.html)                                                                                    |
  | SOCIAL\_IDP\_PROFILE\_TRANSFORMATION        | SOCIAL\_IDP\_PROFILE\_TRANSFORMATION\_NEXT\_GEN        | [Social authentication](../am-authentication/social-registration.html)                                                              |
  |                                             | SOCIAL\_PROVIDER\_HANDLER\_NODE                        | [Social Provider Handler node](https://docs.pingidentity.com/auth-node-ref/8.1/social-provider-handler.html)                        |
  |                                             | OIDC\_NODE                                             | [OIDC ID Token Validator node](https://docs.pingidentity.com/auth-node-ref/8.1/oidc-idtoken-validator.html)                         |

* `createdBy`

  A string containing the universal identifier DN of the subject that created the script.

* `creationDate`

  An integer containing the creation date and time, in ISO 8601 format.

* `lastModifiedBy`

  A string containing the universal identifier DN of the subject that most recently updated the resource type.

  If the script has not been modified since it was created, this property will have the same value as `createdBy`.

* `lastModifiedDate`

  A string containing the last modified date and time, in ISO 8601 format.

  If the script has not been modified since it was created, this property will have the same value as `creationDate`.

* `evaluatorVersion`

  A number representing the script engine version: `1.0` for legacy or `2.0` for next-generation. Refer to [Next-generation scripts](next-generation-scripts.html) for details.

  When invalid or unspecified, the value defaults to `1.0` for all script types except [library scripts](library-scripts.html), which are always `2.0` (next-generation).
