# takeScreenshot

### takeScreenshot

Takes a screenshot of the current scene view.

#### Signature

```typescript
takeScreenshot(height?: number): Promise<string>
```

#### Parameters

| Parameter | Type   | Required | Description                           |
| --------- | ------ | -------- | ------------------------------------- |
| height    | number | No       | Image height in pixels. Default: 2160 |

#### Returns

`Promise<string>` — Base64 [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs) (`data:image/png;base64,...`)

#### Usage

```javascript
// Default size (2160px height)
const dataUrl = await api.takeScreenshot();

// Custom height (width scales proportionally)
const dataUrl = await api.takeScreenshot(1024);

// Use in image element
const img = document.createElement("img");
img.src = dataUrl;
document.body.appendChild(img);

// Download as file
const link = document.createElement("a");
link.href = dataUrl;
link.download = "screenshot.png";
link.click();

// Use with jsPDF
pdf.addImage(dataUrl, "PNG", x, y, width, height);
```

#### Notes

* Returns **data URL string**, not Blob
* Width is calculated automatically to preserve aspect ratio
* Options object `{width, height, transparent}` does **NOT** work — use simple height parameter


---

# 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://help.vectary.com/api/model-api/api-reference/takescreenshot.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.
