---
type: api
title: Get script contexts
description: Get a list of supported script contexts and their methods.
url: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/elasticsearch/v9/operation/operation-get-script-context
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/elasticsearch/v9/operation/operation-get-script-context
products:
  - Elasticsearch
---

# Get script contexts

Authentication: required

## Paths

- `GET` `/_script_context`

## Description

Get a list of supported script contexts and their methods.

## Required authorization

- Cluster privileges: `manage`

## Response

`application/json`

- `contexts` (object[])
  - `methods` (object[])
    - `name` (string)
    - `return_type` (string)
    - `params` (object[])
      - `name` (string)
      - `type` (string)
  - `name` (string)
## Code examples

#### Console

```console
GET _script_context
```

#### JavaScript

```javascript
const response = await client.getScriptContext();
```

#### Python

```python
resp = client.get_script_context()
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_script_context" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.getScriptContext();
```

#### C#

```c#
var response = await client.GetScriptContextAsync();
```

#### PHP

```php
$resp = $client->getScriptContext();
```

#### Ruby

```ruby
response = client.get_script_context
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "contexts": [
    {
      "methods": [
        {
          "name": "string",
          "return_type": "string",
          "params": []
        }
      ],
      "name": "string"
    }
  ]
}
```

