> 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/optimize.md).

# Optimize

### NodeJS

```javascript
const rpai = await ai.optimize({
  text: "FakeBrand Boa XL Max Water Pump Pliers in a Festive Christmas Ornament",
  instruction: "SEO for an online store product title",
});

console.log("Optimized title:", rpai.response);
```

### .NET

<pre class="language-csharp"><code class="lang-csharp">//Response format can be created manually but it is easier to use a type
//await ai.Optimize(new() {
//Text= "FakeBrand Boa XL Max Water Pump Pliers in a Festive Christmas Ornament",
//Instruction= "SEO for an online store product title"
//}).ConfigureAwait(false);

var rpai = await ai.Optimize&#x3C;string>(new() {
<strong>  Text= "FakeBrand Boa XL Max Water Pump Pliers in a Festive Christmas Ornament",
</strong>  Instruction= "SEO for an online store product title"
}).ConfigureAwait(false);

Console.WriteLine("Optimized title: {0}", rpai);
</code></pre>

### **/api/v1/ai/Optimize – Optimize Text Based on Instructions**

**Method**:\
`POST`

**Parameters**:

* `text`: *(string)* – The text to optimize.
* `instruction`: *(string)* – The instruction for optimizing the text.
* `responseFormat`: *(string)* – The format of the response (e.g., `text`, `json`).

**Request Example**:

```bash
curl -X POST https://production.cloudbrowser.ai/api/v1/ai/Optimize \
-H "Content-Type: application/json" \
-d '{
  "text": "10 Tips for Gardening",
  "instruction": "Make the title more engaging for SEO",
  "responseFormat": "text"
}'
```
