---
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/4493/api/doc/elasticsearch/v9/operation/operation-get-script-context
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-get-script-context
products:
  - Elasticsearch
---

# Get script contexts

## Paths

- `GET` `/_script_context`

## Description

Get a list of supported script contexts and their methods.

## Required authorization

- Cluster privileges: `manage`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## 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
```

