---
title: Update a script
description: To update an individual script in a realm, perform an HTTP PUT using the /json{/realm}/scripts endpoint, specifying the UUID in both the URL and the PUT body. Include a JSON representation of the updated script in the PUT data, alongside the UUID.
component: pingam
version: 8.1
page_id: pingam:am-scripting:rest-api-scripts-update
canonical_url: https://docs.pingidentity.com/pingam/8.1/am-scripting/rest-api-scripts-update.html
page_aliases: ["scripting-guide:rest-api-scripts-update.adoc"]
---

# Update a script

To update an individual script in a realm, perform an HTTP PUT using the `/json{/realm}/scripts` endpoint, specifying the UUID in both the URL and the PUT body. Include a JSON representation of the updated script in the PUT data, alongside the UUID.

|   |                                                                       |
| - | --------------------------------------------------------------------- |
|   | If the realm isn't specified in the URL, AM uses the top level realm. |

The `iPlanetDirectoryPro` header is required and should contain the SSO token of an administrative user, such as `amAdmin`, who has access to perform the operation.

```bash
$ curl \
--header "iPlanetDirectoryPro: AQIC5…​" \
--header "Content-Type: application/json" \
--header "Accept-API-Version: resource=1.1" \
--request PUT \
--data '{
  "name": "MyUpdatedJavaScript",
  "script": "dmFyIGEgPSAxMjM7CnZhciBiID0gNDU2Ow==",
  "language": "JAVASCRIPT",
  "context": "POLICY_CONDITION",
  "description": "An updated example script configuration"
}' \
https://am.example.com:8443/am/json/realms/root/realms/myrealm/scripts/0168d494-015a-420f-ae5a-6a2a5c1126af
{
  "_id": "0168d494-015a-420f-ae5a-6a2a5c1126af",
  "name": "MyUpdatedJavaScript",
  "description": "An updated example script configuration",
  "script": "dmFyIGEgPSAxMjM7CnZhciBiID0gNDU2Ow==",
  "language": "JAVASCRIPT",
  "context": "POLICY_CONDITION",
  "createdBy": "id=amadmin,ou=user,dc=am,dc=example,dc=com",
  "creationDate": 1436807766258,
  "lastModifiedBy": "id=amadmin,ou=user,dc=am,dc=example,dc=com",
  "lastModifiedDate": 1436808364681,
  "evaluatorVersion": "1.0"
}
```
