---
title: Update a script
description: To update a script, 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: pingoneaic
page_id: pingoneaic:am-scripting:rest-api-scripts-update
canonical_url: https://docs.pingidentity.com/pingoneaic/am-scripting/rest-api-scripts-update.html
keywords: ["Scripts", "REST"]
---

# Update a script

To update a script, 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.

```bash
$ curl \
--header "Authorization: Bearer <access-token>" \
--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://<tenant-env-fqdn>/am/json/realms/root/realms/alpha/scripts/aeb22d32-100c-46c0-ac51-af571889e5b9'
{
  "_id": "aeb22d32-100c-46c0-ac51-af571889e5b9",
  "name": "UpdatedJavaScript",
  "description": "An updated example script",
  "script": "dmFyIGEgPSAxMjM7CnZhciBiID0gNDU2Ow==",
  "default": false,
  "language": "JAVASCRIPT",
  "context": "POLICY_CONDITION",
  "createdBy": "null",
  "creationDate": 0,
  "lastModifiedBy": "id=ed6816a3-c158-48e0-8402-b2f971b5b492,ou=user,ou=am-config",
  "lastModifiedDate": 1687792307783,
  "evaluatorVersion": "1.0"
}
```

|   |                                                                                                                                                                                                                                                                    |
| - | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|   | You can't read, update, or delete the default scripts prefixed `ForgeRock Internal` (UUIDs: `234ba0b-58a1-4cfd-9567-09edde980745` and `1f389a3d-21cf-417c-a6d3-42ea620071f0`). These scripts appear in the query but aren't accessible in Advanced Identity Cloud. |
