> For the complete documentation index, see [llms.txt](https://cloudbrowser.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cloudbrowser.gitbook.io/docs/configurations/ai-functions/query.md).

# Query

### NodeJS

```javascript
const html = await getHTML("https://www.amazon.com/dp/B01LR5S6HK");

if (!html) return;

const ai = new AIService(cloudBrowserToken, {
    openAIConfiguration: { apiKey: openAiToken },
});

// Response format can be created manually but it is easier to use a type
// await ai.query({
//     html: html,
//     prompt: "Give me the lowest price",
//     responseFormat: JSON.stringify({ response: "number", required: ["response"] })
// });

const rpai = await ai.query({
    html: html,
    prompt: "Give me the lowest price",
});

console.log("The lowest price is:", rpai);
```

### .NET

```csharp
var html = await GetHTML("http://www.cloudbrowser.ai").ConfigureAwait(false);

if (html == null) return;

using AIService ai = new(cloudBrowserToken, openAiToken);

var rpai = await ai.Query<decimal>(new() {
    Html = html,
    Prompt = "Give me the lowest price"
}).ConfigureAwait(false);

Console.WriteLine("The lowest price is: {0}", rpai);
```

### **/api/v1/ai/Query – Process an HTML Document and Prompt**

**Method**:\
`POST`

**Parameters**:

* `html`: *(string)* – The HTML document you want to process.
* `prompt`: *(string)* – The custom instruction or task for processing the HTML content.
* `responseFormat`: *(string)* – The desired format of the response (e.g., `text`, `json`).

**Request Example**:

```bash
curl -X POST https://production.cloudbrowser.ai/api/v1/ai/Query \
-H "Content-Type: application/json" \
-d '{
  "html": "<html>...</html>",
  "prompt": "Extract the title and summarize the content",
  "responseFormat": "text"
}'
```
