---
title: Query scripts
description: List all scripts in a realm and global scripts using the REST API query filter endpoint
component: pingam
version: 7.5
page_id: pingam:am-scripting:rest-api-scripts-query
canonical_url: https://docs.pingidentity.com/pingam/8.1/am-scripting/rest-api-scripts-query.html
llms_txt: https://docs.pingidentity.com/pingam/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
keywords: ["Scripts", "Query"]
page_aliases: ["scripting-guide:rest-api-scripts-query.adoc"]
superseded_by: https://docs.pingidentity.com/pingam/8.1/am-scripting/rest-api-scripts-query.html
---

# Query scripts

To list all the scripts in a realm, as well as any global scripts, perform an HTTP GET to the `/json{/realm}/scripts` endpoint with a `_queryFilter` parameter set to `true`.

|   |                                                                                                                     |
| - | ------------------------------------------------------------------------------------------------------------------- |
|   | If the realm is not specified in the URL, AM returns scripts in the top level realm, as well as any global scripts. |

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 "Accept-API-Version: resource=1.1" \
https://openam.example.com:8443/openam/json/realms/root/realms/myrealm/scripts?_queryFilter=true
{
  "result": [
    {
      "_id": "9de3eb62-f131-4fac-a294-7bd170fd4acb",
      "name": "Scripted Policy Condition",
      "description": "Default global script for Scripted Policy Conditions",
      "script": "LyoqCiAqIFRoaXMg…​",
      "language": "JAVASCRIPT",
      "context": "POLICY_CONDITION",
      "createdBy": "id=dsameuser,ou=user,dc=openam,dc=forgerock,dc=org",
      "creationDate": 1433147666269,
      "lastModifiedBy": "id=dsameuser,ou=user,dc=openam,dc=forgerock,dc=org",
      "lastModifiedDate": 1433147666269,
      "evaluatorVersion": "1.0"
    },
    {
      "_id": "7e3d7067-d50f-4674-8c76-a3e13a810c33",
      "name": "Scripted Module - Server Side",
      "description": "Default global script for server side Scripted Authentication Module",
      "script": "dmFyIFNUQVJUX1RJ…​",
      "language": "JAVASCRIPT",
      "context": "AUTHENTICATION_SERVER_SIDE",
      "createdBy": "id=dsameuser,ou=user,dc=openam,dc=forgerock,dc=org",
      "creationDate": 1433147666269,
      "lastModifiedBy": "id=dsameuser,ou=user,dc=openam,dc=forgerock,dc=org",
      "lastModifiedDate": 1433147666269,
      "evaluatorVersion": "1.0"
    }
  ],
  "resultCount": 2,
  "pagedResultsCookie": null,
  "remainingPagedResults": -1
}
```

**Supported \_queryFilter Fields andOperators**

| Field         | Supported Operators                                |
| ------------- | -------------------------------------------------- |
| `_id`         | Equals (`eq`), Contains (`co`), Starts with (`sw`) |
| `name`        | Equals (`eq`), Contains (`co`), Starts with (`sw`) |
| `description` | Equals (`eq`), Contains (`co`), Starts with (`sw`) |
| `script`      | Equals (`eq`), Contains (`co`), Starts with (`sw`) |
| `language`    | Equals (`eq`), Contains (`co`), Starts with (`sw`) |
| `context`     | Equals (`eq`), Contains (`co`), Starts with (`sw`) |
