# API Assist - Functions

## Start a Function

<mark style="color:green;">`POST`</mark> `/v2/assist/start`

| Type   | Function                               |
| ------ | -------------------------------------- |
| button |                                        |
|        | narrow\_down                           |
|        | recommend                              |
|        | \[List in "buttons" from /assist/load] |
| ask    |                                        |
|        | ask                                    |

**Body**

<table><thead><tr><th width="236">Name</th><th>Type</th></tr></thead><tbody><tr><td><code>access_token</code></td><td>string</td></tr><tr><td><code>type</code></td><td>string</td></tr><tr><td><code>function</code></td><td>string</td></tr><tr><td><code>context[]</code></td><td>Example: <code>How hot is it in Spain?</code></td></tr><tr><td><code>context[]</code></td><td>Example: <code>2 Adults going from Spain to London</code></td></tr><tr><td><code>context[]</code></td><td>Example: <code>Client Name: John Doe</code></td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "pollingUrl": "check?session=SESSIONID&type=ask&function=ask",
    "type": "ask",
    "function": "ask"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

## Check Status of Request

<mark style="color:green;">`POST`</mark> `/v2/assist/check`

Check the status of a Start Function

**Body**

| Name           | Type   | Description                |
| -------------- | ------ | -------------------------- |
| `access_token` | string |                            |
| `session`      | string | Pulled from Start Function |
| `type`         | string | Pulled from Start Function |
| `function`     | string | Pulled from Start Function |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "running": true, // Will only show when AI is still running.
  "complete" true, // Will only show when AI is complete.
  "content": "" // JSON as String. "text" for ASK and Buttons will provide multiple keys.
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.systemsx.co.uk/sense/api-assist-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
