> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.multion.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.multion.ai/_mcp/server.

# Retrieve

> Learn about MultiOn retrieve

## What is retrieve?

[Retrieve](/autonomous-api/retrieve) is a function that allows you to retrieve structured data from any webpage. Use it to scrape and summarize information without creating traditional web scraping scripts.

It can be used standalone or as part of an [agent session](/learn/sessions). Combine retrieve with [step](/step-api/sessions/step) to create truly autonomous web research agents that can navigate sites and retreive full page data.

## Retrieve data

Call retrieve with a URL and a command to create a new agent session and start retrieving data. The data will be returned as a JSON array of objects. While it is optional, we recommend that you specify `fields` for structured data outputs. It is also helpful to specify what each field means and the desired type in `cmd`.

#### TypeScript

```ts
import { MultiOnClient } from "multion";

const multion = new MultiOnClient({ apiKey: "YOUR_API_KEY" });

const retrieveResponse = await multion.retrieve({
  cmd: "Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
  url: "https://news.ycombinator.com/",
  fields: ["title", "creator", "time", "points", "comments", "url"]
});

const data = retrieveResponse.data;
```

#### Python

```python
from multion.client import MultiOn

client = MultiOn(
    api_key="YOUR_API_KEY",
)

retrieve_response = client.retrieve(
    cmd="Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
    url="https://news.ycombinator.com/",
    fields=["title", "creator", "time", "points", "comments", "url"]
)

data = retrieve_response.data
```

### Local mode

Use the `local` flag to run retrieve locally on your browser. Make sure the [browser extension](/learn/browser-extension) is installed and **API Enabled** is checked.

#### TypeScript

```ts
const retrieveResponse = await multion.retrieve({
  cmd: "Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
  url: "https://news.ycombinator.com/",
  fields: ["title", "creator", "time", "points", "comments", "url"],
  local: true
});
```

#### Python

```python
retrieve_response = client.retrieve(
    cmd="Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
    url="https://news.ycombinator.com/",
    fields=["title", "creator", "time", "points", "comments", "url"],
    local=True
)
```

### Max items

Use the `max_items` param to limit the number of items to retrieve. This is helpful for pages with lots of data, which usually takes more time to retrieve.

#### TypeScript

```ts
const retrieveResponse = await multion.retrieve({
  cmd: "Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
  url: "https://news.ycombinator.com/",
  fields: ["title", "creator", "time", "points", "comments", "url"],
  maxItems: 10
});
```

#### Python

```python
retrieve_response = client.retrieve(
    cmd="Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
    url="https://news.ycombinator.com/",
    fields=["title", "creator", "time", "points", "comments", "url"],
    max_items=10
)
```

### Retrieve viewport only

Set the `full_page` flag to false to retrieve from the agent viewport only. By default, retrieve will crawl the full page regardless of scrolling. Note that crawling the full page does not move the viewport, so dynamically loaded content can still be hidden. To ensure all content is loaded, use [scroll to bottom](#scroll-to-bottom).

#### TypeScript

```ts
const retrieveResponse = await multion.retrieve({
  cmd: "Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
  url: "https://news.ycombinator.com/",
  fields: ["title", "creator", "time", "points", "comments", "url"],
  fullPage: false
});
```

#### Python

```python
retrieve_response = client.retrieve(
    cmd="Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
    url="https://news.ycombinator.com/",
    fields=["title", "creator", "time", "points", "comments", "url"],
    full_page=False
)
```

### Retrieve JS elements

Use the `render_js` flag to render and retrieve JS and ARIA elements. This is helpful for retrieving image URLs, but will slow down the request.

#### TypeScript

```ts
const retrieveResponse = await multion.retrieve({
  cmd: "Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
  url: "https://news.ycombinator.com/",
  fields: ["title", "creator", "time", "points", "comments", "url"],
  renderJs: true
});
```

#### Python

```python
retrieve_response = client.retrieve(
    cmd="Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
    url="https://news.ycombinator.com/",
    fields=["title", "creator", "time", "points", "comments", "url"],
    render_js=True
)
```

### Scroll to bottom

Use the `scroll_to_bottom` flag to scroll to the bottom of the page before retrieving data. This is helpful for websites that dynamically load more content as you scroll down. If the retrieved data has more fields in the first few items or returns only items from the top of the page, consider setting `scroll_to_bottom` to true.

#### TypeScript

```ts
const retrieveResponse = await multion.retrieve({
  cmd: "Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
  url: "https://news.ycombinator.com/",
  fields: ["title", "creator", "time", "points", "comments", "url"],
  scrollToBottom: true
});
```

#### Python

```python
retrieve_response = client.retrieve(
    cmd="Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
    url="https://news.ycombinator.com/",
    fields=["title", "creator", "time", "points", "comments", "url"],
    scroll_to_bottom=True
)
```

### Get retreive screenshot

Use the `include_screenshot` flag to include a screenshot URL of the retrieval in the response.

#### TypeScript

```ts
const retrieveResponse = await multion.retrieve({
  cmd: "Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
  url: "https://news.ycombinator.com/",
  fields: ["title", "creator", "time", "points", "comments", "url"],
  includeScreenshot: true
});

const screenshot = retrieveResponse.screenshot
```

#### Python

```python
retrieve_response = client.retrieve(
    cmd="Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
    url="https://news.ycombinator.com/",
    fields=["title", "creator", "time", "points", "comments", "url"],
    include_screenshot=True
)

screenshot = retrieve_response.screenshot
```

## Retrieve as part of a session

Use retrieve as part of a session to retrieve data alongside step actions. Calling retrieve without a session ID will create a new session. You can get the new session ID from the response.

#### TypeScript

```ts
import { MultiOnClient } from "multion";

const multion = new MultiOnClient({ apiKey: "YOUR_API_KEY" });

const retrieveResponse = await multion.retrieve({
  cmd: "Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
  url: "https://news.ycombinator.com/",
  fields: ["title", "creator", "time", "points", "comments", "url"]
});

const sessionId = retrieveResponse.sessionId;
```

#### Python

```python
from multion.client import MultiOn

client = MultiOn(
    api_key="YOUR_API_KEY",
)

retrieve_response = client.retrieve(
    cmd="Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
    url="https://news.ycombinator.com/",
    fields=["title", "creator", "time", "points", "comments", "url"]
)

session_id = retrieve_response.session_id
```

You can also call retrieve with a session ID to use it as part of an already-created session.

#### TypeScript

```ts
import { MultiOnClient } from "multion";

const multion = new MultiOnClient({ apiKey: "YOUR_API_KEY" });

const createResponse = await multion.sessions.create({
  url: "https://news.ycombinator.com/"
});

const sessionId = createResponse.sessionId;

const retrieveResponse = await multion.retrieve({
  sessionId: sessionId,
  cmd: "Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
  fields: ["title", "creator", "time", "points", "comments", "url"]
});
```

#### Python

```python
from multion.client import MultiOn

client = MultiOn(
    api_key="YOUR_API_KEY"
)

create_response = client.sessions.create(
    url="https://news.ycombinator.com/"
)

session_id = create_response.session_id

retrieve_response = client.retrieve(
    session_id=session_id,
    cmd="Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
    fields=["title", "creator", "time", "points", "comments", "url"]
)
```

### Use proxy

Use the `use_proxy` flag with [create session](/step-api/sessions/create) to enable proxy for retrieve to bypass IP blocks and bot protections. When enabled, the agent will be slightly slower to respond.

#### TypeScript

```ts
import { MultiOnClient } from "multion";

const multion = new MultiOnClient({ apiKey: "YOUR_API_KEY" });

const createResponse = await multion.sessions.create({
  url: "https://news.ycombinator.com/",
  useProxy: true
});

const sessionId = createResponse.sessionId;

const retrieveResponse = await multion.retrieve({
  sessionId: sessionId,
  cmd: "Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
  fields: ["title", "creator", "time", "points", "comments", "url"]
});
```

#### Python

```python
from multion.client import MultiOn

client = MultiOn(
    api_key="YOUR_API_KEY"
)

create_response = client.sessions.create(
    url="https://news.ycombinator.com/",
    use_proxy=True
)

session_id = create_response.session_id

retrieve_response = client.retrieve(
    session_id=session_id,
    cmd="Get all posts on Hackernews with title, creator, time created, points as a number, number of comments as a number, and the post URL.",
    fields=["title", "creator", "time", "points", "comments", "url"]
)
```