> For the complete documentation index, see [llms.txt](https://docs.nlx.ai/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nlx.ai/platform/developers/voice+-api/context.md).

# Context

The NLX [Context API](/platform/developers/conversation-api/rest/context.md) is a specialized endpoint that asynchronously sets session attributes for an active NLX conversation, with special capabilities for Voice+.

Unlike the [Track API](/platform/developers/voice+-api/track.md) (which tracks journey steps), the Context API allows you to push detailed metadata about the current page, such as available form fields, current values, and navigation URLs, so the Voice AI knows exactly what the user is looking at.

### When to use this API

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><i class="fa-wpforms">:wpforms:</i></td><td><strong>Form filling</strong></td><td>Tell the Voice AI what fields are on the screen (e.g., "Account Number", "Amount") so it can offer to fill them</td></tr><tr><td><i class="fa-compass">:compass:</i></td><td><strong>Navigation awareness</strong></td><td>Update the Voice AI when the user navigates to a new URL</td></tr><tr><td><i class="fa-arrow-right-arrow-left">:arrow-right-arrow-left:</i></td><td><strong>State synchronization</strong></td><td>Send current field values to the Voice+ app if the user manually types them in</td></tr><tr><td><i class="fa-up">:up:</i></td><td><strong>Context updates</strong></td><td>Update the context of your conversation asynchronously</td></tr></tbody></table>

### Configuration

This endpoint is part of the standard Conversation API suite and shares the same authentication.

| Setting      | Value                                                                       |
| ------------ | --------------------------------------------------------------------------- |
| **Base URL** | `https://apps.nlx.ai/c/{deploymentKey}/{channelKey}-{languageCode}/context` |
| **Header**   | `nlx-api-key: YOUR_API_KEY`                                                 |

{% hint style="info" %}
Ensure you append `/context` to the standard base URL.
{% endhint %}

#### Send context (`POST`)

Push a context payload to the active conversation.

**Endpoint:** `POST /context`

**Request body**

| Field                   | Type   | Required | Description                            |
| ----------------------- | ------ | -------- | -------------------------------------- |
| `conversationId`        | String | Yes      | The active voice session ID.           |
| `context`               | Object | Yes      | Wrapper for context data.              |
| `context.nlx:vpContext` | Object | Yes      | The specific Voice+ context container. |

**Example: Form fields**

In this example, the web app tells the Voice AI that the user is on a "Transfer" page with fields for Account and Amount.

```bash
curl -X POST "https://apps.nlx.ai/c/YOUR_DEPLOYMENT_KEY/YOUR_CHANNEL_KEY-en-US/context" \
  -H "nlx-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "conversationId": "c03e0066-7cba-4bbf-b60b-10109b95a9f6",
    "context": {
      "nlx:vpContext": {
        "uri": "https://mybank.com/transfer",
        "fields": [
          {
            "id": "toAccount",
            "name": "To Account",
            "type": "select",
            "description": "Destination account",
            "value": "1131"
          },
          {
            "id": "amount",
            "name": "Transfer Amount",
            "type": "number",
            "description": "Amount in USD",
            "placeholder": "Enter amount"
          }
        ],
        "scopes": ["home_page"]
      }
    }
  }'
```

**Response**

The server responds with a `200 OK` empty JSON object upon success.

```javascript
{}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nlx.ai/platform/developers/voice+-api/context.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
