# Documentation
# Welcome to MultiOn
> Official documentation for MultiOn - the Motor Cortex layer for AI
This is the documentation for MultiOn Agent V1 Beta. Verify outputs and reach out to [support@multion.ai](mailto:support@multion.ai) or on our [Discord](https://discord.gg/multion). AgentQ support will be out in Agent 2.0 upcoming Release!
MultiOn is the **Motor Cortex layer for AI**, enabling autonomous actions on the web using natural language commands with millions of concurrent AI Agents ready to run.
Create your first web browsing agent with the Agent API
Experience MultiOn agent capabilities, no setup required
## Why MultiOn?
MultiOn makes it easy to build autonomous web agents with:
* Secure [remote sessions](/learn/sessions) with [native proxy support](/learn/sessions#use-proxy) to navigate tricky bot protection.
* Chrome [browser extension](/learn/browser-extension) to interact with the agent locally.
* Best-in-class full page structured LLM [data scraping](/learn/retrieve).
* Infinite scalability with [parallel agents](/build/hm#scrape-multiple-pages-in-parallel).
## Stay up to date
Receive support from our team and discover how the community is building with MultiOn
Read the latest news and updates from MultiOn developers
## Get support
Want to get in touch with the MultiOn team? Reach out to us via [Discord](https://discord.gg/multion) or [email](mailto:tech@multion.ai).
# Quick Start
> Simple steps to get started with MultiOn Agent API
## Create your first agent
### Generate API key
Sign up on our [developer console](https://app.multion.ai/) and create a new [API key](https://app.multion.ai/api-keys). Remember, your API key is your access secret—keep it safe with environment variables.
### Install package
Install the MultiOn SDK for your preferred language.
```bash
npm install multion
```
```bash
pip install multion
```
### Send your first request
Try scraping a webpage with the Agent API. Be sure to replace `MULTION_API_KEY` with your actual API key.
```bash
curl -X POST https://api.multion.ai/v1/web/browse \
-H "X_MULTION_API_KEY: MULTION_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"cmd": "Find the top comment of the top post on Hackernews.",
"url": "https://news.ycombinator.com/"
}'
```
```ts
import { MultiOnClient } from "multion"
const multion = new MultiOnClient({
apiKey: "MULTION_API_KEY",
});
const browse = await multion.browse({
cmd: "Find the top comment of the top post on Hackernews.",
url: "https://news.ycombinator.com/",
});
console.log("Browse response:", browse)
```
```python
from multion.client import MultiOn
multion = MultiOn(api_key="MULTION_API_KEY")
browse = multion.browse(
cmd="Find the top comment of the top post on Hackernews.",
url="https://news.ycombinator.com/"
)
print("Browse response:", browse)
```
### Develop locally with the browser extension
Find the [MultiOn Browser Extension](https://chrome.google.com/webstore/detail/multi%C2%B7on/ddmjhdbknfidiopmbaceghhhbgbpenmm) on the Chrome Web Store and click **"Add to Chrome"** to add it to your browser. Make sure the **API Enabled** option is checked. Learn more about the browser extension [here](/learn/browser-extension).
## Learn concepts
Learn more about core MultiOn concepts to build complex applications with agents.
Learn to use the browser extension
Learn to manage agent sessions
Learn to scrape structured data
Learn to create agent skills
## Start building
That's it! You're ready to start building your own autonomous web agents. Here are a couple of examples to get you started. Happy building! 🙌
Learn to use step and retrieve to scrape structured data
Learn to use browse and local mode to take actions autonomously
# Browser Extension
> Learn about the MultiOn browser extension
## Installation
### Install on Chrome
Find the [MultiOn Browser Extension](https://chrome.google.com/webstore/detail/multi%C2%B7on/ddmjhdbknfidiopmbaceghhhbgbpenmm) on the Chrome Web Store and click **"Add to Chrome"** to add it to your browser.
### Sign in
Sign in to your MultiOn account. If you don't have one, create one [here](https://app.multion.ai/).
### Enable API
To use [local mode](/learn/sessions#local-mode) with the Agent API, click on the MultiOn extension in the extensions folder of your browser (not the hovering MultiOn icon on the web page) to open the extension configurations. Click the **API Enabled** toggle to enable the API.
## Usage
* Hover over the hovering MultiOn extension icon on any webpage and click **Chat** to start a browsing session directly on the page, no code required.
* Create and run browsing sessions with the Agent API using [local mode](/learn/sessions#local-mode).
# Sessions
> Learn about MultiOn sessions
## What is an agent session?

An agent session is a stateful instance of interaction with our agent for a specific user query or workflow. Each agent session is fully isolated and can be used to perform multiple sequential steps. When a session is created with a command, the agent generates a plan to complete the command.
With [browse](/autonomous-api/browse), the agent will step automatically until the action is completed or the agent requires additional input. With [step session](/step-api/sessions/step), you can supply additional information to refine the plan and help the agent at each step.
* **Session lifecycle:** An agent session begins when you initiate it with an input URL and an instruction prompt and ends when it has been closed or the session has expired. A session survives for 10 minutes if left inactive.
* **Local mode:** By default, sessions are hosted remotely in the cloud using our virtual headless browser. In local mode, our server-hosted agent interacts with your installed Chrome browser extension. Learn more [here](/learn/browser-extension).
* **Security:** In remote mode, each agent session is fully isolated, protecting the integrity of your data and interactions.
## Browse automatically
[Browse](/autonomous-api/browse) allows you to automatically create an agent session with a URL and a command. It will step through the session until the action is completed or the agent requires additional input.
```ts
import { MultiOnClient } from "multion";
const multion = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
const browseResponse = await multion.browse({
cmd: "Find the top comment of the top post on Hackernews.",
url: "https://news.ycombinator.com/"
});
```
```python
from multion.client import MultiOn
client = MultiOn(
api_key="YOUR_API_KEY"
)
browse_response = client.browse(
cmd="Find the top comment of the top post on Hackernews.",
url="https://news.ycombinator.com/"
)
```
## Create a session manually
[Create session](/step-api/sessions/create) allows you to manually create an agent session with a URL. You can continue the session using the `session_id` returned in the response.
```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;
```
```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
```
### Local mode
Use the `local` flag to run the agent locally on your browser. Make sure the [browser extension](/learn/browser-extension) is installed and **API Enabled** is checked.
```ts
const createResponse = await multion.sessions.create({
url: "https://news.ycombinator.com/",
local: true
});
```
```python
create_response = client.sessions.create(
url="https://news.ycombinator.com/",
local=True
)
```
### Speed modes
Use the `mode` param to specify the speed model of the agent. This setting determines which LLM model is used under the hood, affecting the balance between processing speed and task complexity:
* `standard`: Optimized for complex tasks that require more detailed analysis or multi-step reasoning.
* `fast`: Suitable for general tasks and quicker responses, ideal for simpler queries or when speed is a priority.
Choose the mode that best fits your specific use case and performance requirements.
```ts
const createResponse = await multion.sessions.create({
url: "https://news.ycombinator.com/",
mode: "fast"
});
```
```python
create_response = client.sessions.create(
url="https://news.ycombinator.com/",
mode="fast"
)
```
### Use proxy
Use the `use_proxy` flag to enable proxy for the session to bypass IP blocks and bot protections. When enabled, the agent will be slightly slower to respond.
```ts
const createResponse = await multion.sessions.create({
url: "https://news.ycombinator.com/",
useProxy: true
});
```
```python
create_response = client.sessions.create(
url="https://news.ycombinator.com/",
use_proxy=True
)
```
## Step through a session
[Step session](/step-api/sessions/step) allows you to step through an agent session with a command. It will return a response with the status of the agent. Status can be one of `CONTINUE`, `ASK_USER`, and `DONE`. If the status is `ASK_USER`, you can provide additional information to the agent in the `cmd` field.
```ts
const stepResponse = await multion.sessions.step("session_id", {
cmd: "Find the top comment of the top post on Hackernews."
});
const status = stepResponse.status
```
```python
step_response = client.sessions.step(
session_id="session_id",
cmd="Find the top comment of the top post on Hackernews."
)
status = step_response.status
```
You can keep stepping through the session until the status is `ASK_USER` or `DONE`.
```ts
let status = "CONTINUE";
while (status === "CONTINUE") {
const stepResponse = await multion.sessions.step("session_id", {
cmd: "Find the top comment of the top post on Hackernews."
});
status = stepResponse.status
// Do something if status is "ASK_USER"
// Do something else if status is "DONE"
}
```
```python
status = "CONTINUE"
while status == "CONTINUE":
step_response = client.sessions.step(
session_id="session_id",
cmd="Find the top comment of the top post on Hackernews."
)
status = step_response.status
# Do something if status is "ASK_USER"
# Do something else if status is "DONE"
```
### Get session screenshot
Use the `include_screenshot` flag to include a screenshot URL of the session in the response.
```ts
const stepResponse = await multion.sessions.step("session_id", {
cmd: "Find the top comment of the top post on Hackernews.",
includeScreenshot: true
});
const screenshot = stepResponse.screenshot
```
```python
step_response = client.sessions.step(
session_id="session_id",
cmd="Find the top comment of the top post on Hackernews.",
include_screenshot=True
)
screenshot = step_response.screenshot
```
## Close a session manually
To close a session before it expires, use [close session](/step-api/sessions/close).
```ts
await multion.sessions.close("session_id");
```
```python
client.sessions.close(
session_id="session_id"
)
```
# 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`.
```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
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.
```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
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.
```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
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).
```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
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.
```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
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.
```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
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.
```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
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.
```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
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.
```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
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.
```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
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"]
)
```
# Skills
> Learn about MultiOn skills
## What are skills?

Skills are a no-code way to improve and teach our Agent new behavior accessible on our [Agent Profile Page](https://app.multion.ai/profile).
Skills can be defined as natural language rules to control the Agent on specific websites and customize the browsing experience.
This can be used to steer the agent's behavior and add security guardrails for sensitive tasks
## Community ideas
* Build a skill learning library, akin to Voyager.
* Discover skills in a retrieval directory with upvoting and a Marketplace.
* Get creative with custom skills, like a Recruiter skill for Linkedin or a Cold Email skill for Gmail.
Unleash your creativity with MultiOn Skills! Join our [Discord](https://discord.gg/multion) or reach out to us at [our email](mailto:tech@multion.ai).
# Post on X with MultiOn
> Learn to use browse and local mode to take actions autonomously
This example combines MultiOn [browse](/autonomous-api/browse) and [local mode](/learn/sessions#local-mode) to post a loving message on X.
## Project setup
### Install extension
Find the [MultiOn Browser Extension](https://chrome.google.com/webstore/detail/multi%C2%B7on/ddmjhdbknfidiopmbaceghhhbgbpenmm) on the Chrome Web Store and click **"Add to Chrome"** to add it to your browser. Make sure the **API Enabled** option is checked. Learn more about the browser extension [here](/learn/browser-extension).
### Initialize project
Create a new project by running the following command in your terminal:
```bash
npm init
```
### Install package
Install the `multion` package by running the following command in your terminal:
```bash
npm install multion
```
### Import library
Create a new file called `index.ts` and import the required library for the example:
```ts
import { MultiOnClient } from 'multion';
```
### Initialize client
Initialize the MultiOn client with your API key.
```ts
const multion = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
```
### Run script
Run your script by running the following command in your terminal:
```bash
node index.ts
```
### Install extension
Find the [MultiOn Browser Extension](https://chrome.google.com/webstore/detail/multi%C2%B7on/ddmjhdbknfidiopmbaceghhhbgbpenmm) on the Chrome Web Store and click **"Add to Chrome"** to add it to your browser. Make sure the **API Enabled** option is checked. Learn more about the browser extension [here](/learn/browser-extension).
### Install package
Install the `multion` package by running the following command in your terminal:
```bash
pip install multion
```
### Import library
Create a new file called `main.py` and import the required library for the example:
```python
from multion.client import MultiOn
```
### Initialize client
Initialize the MultiOn client with your API key.
```python
client = MultiOn(api_key="YOUR_API_KEY")
```
### Run script
Run your script by running the following command in your terminal:
```bash
python main.py
```
## Follow MultiOn
Use [browse](/autonomous-api/browse) in local mode to follow us on X.
```ts
const followResponse = await multion.browse({
cmd: "Follow @MultiOn_AI on X",
url: "https://x.com",
local: true
});
console.log(followResponse.message);
```
```python
follow_response = client.browse(
cmd="Follow @MultiOn_AI on X",
url="https://x.com",
local=True,
)
print(follow_response.message)
```
## Hello world!
Continue the same session to say hi to the world.
```ts
const sessionId = followResponse.sessionId
const postResponse = await multion.browse({
sessionId: sessionId,
cmd: "Post 'Hello world, I love @MultiOn_AI!'"
});
console.log(postResponse.message);
```
```python
session_id = follow_response.session_id
post_response = client.browse(
session_id=session_id,
cmd="Post 'Hello world, I love @MultiOn_AI!'",
)
print(post_response.message)
```
# Scrape H&M with MultiOn
> Learn to use step and retrieve to scrape structured data
This example combines MultiOn [step](/step-api/sessions/step) and [retrieve](/autonomous-api/retrieve) to scrape the H\&M website catalog.
## Project setup
### Initialize project
Create a new project by running the following command in your terminal:
```bash
npm init
```
### Install package
Install the `multion` package by running the following command in your terminal:
```bash
npm install multion
```
### Import library
Create a new file called `index.ts` and import the required library for the example:
```ts
import { MultiOnClient } from 'multion';
```
### Initialize client
Initialize the MultiOn client with your API key.
```ts
const multion = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
```
### Run script
Run your script by running the following command in your terminal:
```bash
node index.ts
```
### Install package
Install the `multion` package by running the following command in your terminal:
```bash
pip install multion
```
### Import library
Create a new file called `main.py` and import the required library for the example:
```python
from multion.client import MultiOn
```
### Initialize client
Initialize the MultiOn client with your API key.
```python
client = MultiOn(api_key="YOUR_API_KEY")
```
### Run script
Run your script by running the following command in your terminal:
```bash
python main.py
```
## Scrape first page
To scrape the first page of the H\&M catalog, we can simply call retrieve.
```ts
const retrieveResponse = await multion.retrieve({
url: "https://www2.hm.com/en_us/men/products/view-all.html",
cmd: "Get all items and their name, price, colors, purchase url, and image url.",
fields: ["name", "price", "colors", "purchase_url", "image_url"]
});
const data = retrieveResponse.data;
console.log(data);
```
```python
retrieve_response = client.retrieve(
url="https://www2.hm.com/en_us/men/products/view-all.html",
cmd="Get all items and their name, price, colors, purchase url, and image url.",
fields=["name", "price", "colors", "purchase_url", "image_url"]
)
data = retrieve_response.data
print(data)
```
However, you might notice that while the first few items are complete, the rest are incomplete and some are even broken--especially images. This is because H\&M dynamically loads the images as the user scrolls down the page.
To help with this, we can use `renderJs` to ensure image links are included and `scrollToBottom` to scroll down the page.
```ts
const retrieveResponse = await multion.retrieve({
url: "https://www2.hm.com/en_us/men/products/view-all.html",
cmd: "Get all items and their name, price, colors, purchase url, and image url.",
fields: ["name", "price", "colors", "purchase_url", "image_url"],
renderJs: true,
scrollToBottom: true
});
const data = retrieveResponse.data;
console.log(data);
```
```python
retrieve_response = client.retrieve(
url="https://www2.hm.com/en_us/men/products/view-all.html",
cmd="Get all items and their name, price, colors, purchase url, and image url.",
fields=["name", "price", "colors", "purchase_url", "image_url"],
render_js=True,
scroll_to_bottom=True
)
data = retrieve_response.data
print(data)
```
If we only want 10 items from the page, we can use `maxItems` to speed up the request.
```ts
const retrieveResponse = await multion.retrieve({
url: "https://www2.hm.com/en_us/men/products/view-all.html",
cmd: "Get all items and their name, price, colors, purchase url, and image url.",
fields: ["name", "price", "colors", "purchase_url", "image_url"],
renderJs: true,
scrollToBottom: true,
maxItems: 10
});
const data = retrieveResponse.data;
console.log(data);
```
```python
retrieve_response = client.retrieve(
url="https://www2.hm.com/en_us/men/products/view-all.html",
cmd="Get all items and their name, price, colors, purchase url, and image url.",
fields=["name", "price", "colors", "purchase_url", "image_url"],
render_js=True,
scroll_to_bottom=True,
max_items=10
)
data = retrieve_response.data
print(data)
```
## Scrape multiple pages autonomously
To scrape multiple pages autonomously, we can use retrieve with step to navigate to next page. To do this, we must first create a session.
```ts
const createResponse = await multion.sessions.create({
url: "https://www2.hm.com/en_us/men/products/view-all.html"
// Can set useProxy to true to circumvent IP block
});
const sessionId = createResponse.sessionId;
console.log("Session created: ", sessionId);
```
```python
create_response = client.sessions.create(
url="https://www2.hm.com/en_us/men/products/view-all.html"
# Can set useProxy to True to circumvent IP block
)
session_id = create_response.session_id
print("Session created: ", session_id)
```
Then, we can create a while loop that will keep running until the last page. At each iteration, the agent will retrieve data and step to navigate to the next page.
```ts
let hasMore = true;
while (hasMore) {
const retrieveResponse = await multion.retrieve({
sessionId: sessionId,
cmd: "Get all items and their name, price, colors, purchase url, and image url.",
fields: ["name", "price", "colors", "purchase_url", "image_url"],
renderJs: true,
scrollToBottom: true
});
console.log("Data retrieved: ", retrieveResponse.data);
const stepResponse = await multion.sessions.step(sessionId, {
cmd: "Keep clicking on the next page button.",
mode: "fast",
});
console.log("Navigating to next page: ", stepResponse.message);
hasMore = !stepResponse.message.includes("last page");
// Can implement better way of checking if more pages to scrape
}
```
```python
has_more = True
while has_more:
retrieve_response = client.retrieve(
session_id=session_id,
cmd="Get all items and their name, price, colors, purchase url, and image url.",
fields=["name", "price", "colors", "purchase_url", "image_url"],
render_js=True,
scroll_to_bottom=True
)
print("Data retrieved: ", retrieve_response.data)
step_response = client.sessions.step(
session_id=session_id,
cmd="Keep clicking on the next page button.",
mode="fast",
)
print("Navigating to next page: ", step_response.message)
has_more = "last page" not in step_response.message
# Can implement better way of checking if more pages to scrape
```
## Scrape multiple pages in parallel
To massively speed up the scraping process, we can call retrieve for each page simultaneously. This works for H\&M because the URL is numbered for each page.
```ts
const pagePromises = Array.from({ length: 10 }, (_, i) => i + 1).map(async (i) => {
const retrieveResponse = await multion.retrieve({
url: `https://www2.hm.com/en_us/men/products/view-all.html?page=${i}`,
cmd: "Get all items and their name, price, colors, purchase url, and image url.",
fields: ["name", "price", "colors", "purchase_url", "image_url"],
renderJs: true,
scrollToBottom: true
});
console.log(`Data retrieved for page ${i}: `, retrieveResponse.data);
return retrieveResponse.data;
});
await Promise.all(pagePromises);
```
```python
# We have to import AsyncMultiOn instead of the normal MultiOn client
from multion.client import AsyncMultiOn
client = AsyncMultiOn(api_key=os.getenv("MULTION_API_KEY"))
async def retrieve_page(client, page_number):
retrieve_response = await client.retrieve(
url=f"https://www2.hm.com/en_us/men/products/view-all.html?page={page_number}",
cmd="Get all items and their name, price, colors, purchase url, and image url.",
fields=["name", "price", "colors", "purchase_url", "image_url"],
render_js=True,
scroll_to_bottom=True,
)
print(f"Data retrieved for page {page_number}: ", retrieve_response.data)
return retrieve_response.data
async def retrieve_all_pages():
tasks = []
for i in range(1, 11):
tasks.append(retrieve_page(client, i))
results = await asyncio.gather(*tasks)
return results
asyncio.run(retrieve_all_pages())
```
# Order on Amazon with MultiOn
> Learn to use browse and local mode to take actions autonomously
This example combines MultiOn [browse](/autonomous-api/browse) and [local mode](/learn/sessions#local-mode) to purchase a book on Amazon.
## Project setup
### Install extension
Find the [MultiOn Browser Extension](https://chrome.google.com/webstore/detail/multi%C2%B7on/ddmjhdbknfidiopmbaceghhhbgbpenmm) on the Chrome Web Store and click **"Add to Chrome"** to add it to your browser. Make sure the **API Enabled** option is checked. Learn more about the browser extension [here](/learn/browser-extension).
### Initialize project
Create a new project by running the following command in your terminal:
```bash
npm init
```
### Install package
Install the `multion` package by running the following command in your terminal:
```bash
npm install multion
```
### Import library
Create a new file called `index.ts` and import the required library for the example:
```ts
import { MultiOnClient } from 'multion';
```
### Initialize client
Initialize the MultiOn client with your API key.
```ts
const multion = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
```
### Run script
Run your script by running the following command in your terminal:
```bash
node index.ts
```
### Install extension
Find the [MultiOn Browser Extension](https://chrome.google.com/webstore/detail/multi%C2%B7on/ddmjhdbknfidiopmbaceghhhbgbpenmm) on the Chrome Web Store and click **"Add to Chrome"** to add it to your browser. Make sure the **API Enabled** option is checked. Learn more about the browser extension [here](/learn/browser-extension).
### Install package
Install the `multion` package by running the following command in your terminal:
```bash
pip install multion
```
### Import library
Create a new file called `main.py` and import the required library for the example:
```python
from multion.client import MultiOn
```
### Initialize client
Initialize the MultiOn client with your API key.
```python
client = MultiOn(api_key="YOUR_API_KEY")
```
### Run script
Run your script by running the following command in your terminal:
```bash
python main.py
```
## Add book to cart
Use [browse](/autonomous-api/browse) in local mode to add the book to your shopping cart.
```ts
const cartResponse = await multion.browse({
cmd: "Add the Three Body Problem book to my cart",
url: "https://amazon.com",
local: true
});
console.log(cartResponse.message);
```
```python
cart_response = client.browse(
cmd="Add the Three Body Problem book to my cart",
url="https://amazon.com",
local=True,
)
print(cart_response.message)
```
## Buy the book!
Now, if you want to buy the book, continue the same session to complete the purchase.
```ts
const sessionId = followResponse.sessionId
const purchaseResponse = await multion.browse({
sessionId: sessionId,
cmd: "Check out and purchase the book"
});
console.log(purchaseResponse.message);
```
```python
session_id = follow_response.session_id
purchase_response = client.browse(
session_id=session_id,
cmd="Check out and purchase the book",
)
print(purchase_response.message)
```
# Cookbook
> A collection of examples and recipes for MultiOn
For more examples and recipes for MultiOn, check out our cookbook on GitHub.
A collection of examples and recipes for MultiOn
## Table of recipes
### Projects
* [Internet of Agents](https://github.com/MULTI-ON/cookbook/tree/main/internet-of-agents) - deploy a swarm of web agents with MultiOn
### Notebooks
* [Scrape LinkedIn](https://github.com/MULTI-ON/cookbook/tree/main/scraping/scrape_linkedin.ipynb) - scrape LinkedIn with MultiOn
* [Finding Accommodation](https://github.com/MULTI-ON/cookbook/tree/main/accommodation/accommodation.ipynb) - find and book accommodation on AirBnB using MultiOn
* [Restaurant Booking](https://github.com/MULTI-ON/cookbook/tree/main/restaurant-booking/restaurant_booking.ipynb) - find and book accommodation on AirBnB using MultiOn
* [News Analysis](https://github.com/MULTI-ON/cookbook/tree/main/news-digest/news_digest.ipynb) - use MultiOn to scrape and analyze news articles.
* [Personalized Travel Agent](https://github.com/MULTI-ON/cookbook/blob/main/personalized-travel-agent/mem0_travel_agent.ipynb) - Intelligent travel agent with MultiOn and [Mem0](https://mem0.ai)
## Contributing
We welcome any contributions to the MultiOn Cookbook, whether it's submitting an idea, fixing a typo, adding a new guide, or improving an existing one.
To contribute, please review the contribution guidelines [here](https://github.com/MULTI-ON/cookbook/blob/main/README.md#Contributing).
# Client SDKs
> Official MultiOn client SDKs
We provide official open-source SDKs (client libraries) for your favorite languages: such as Typescript and Python. These clients make connecting to our API faster and error-free.
MultiOn for Typescript/Node.js
MultiOn for Python
If you'd like to request an SDK for a language that we don't currently support, [let us know on Discord](https://discord.gg/multion). We're always looking to expand our SDK offerings and would love to hear from you.
# Node.js SDK
> MultiOn for TypeScript/Node.js
## Installation
```bash
npm install --save multion
# or
yarn add multion
```
In Deno (1.25+) you can import by doing:
```ts
import { MultiOnClient } from "npm:multion";
```
## Usage
```typescript
import { MultiOnClient, MultiOn } from 'multion';
const multion = new MultiOnClient({
apiKey: "YOUR_API_KEY", // Defaults to process.env.MULTION_API_KEY
});
const response = await multion.browse({
cmd: "what is the weather today?",
url: "https://www.google.com"
})
```
## Request and Response Types
The SDK exports all request and response types as TypeScript interfaces. Simply import them under the `MultiOn` namespace:
```ts
import { MultiOn } from "multion";
const message: MultiOn.Message = {
url: "https://www.google.com",
includeScreenshot: true,
}
```
## Exception Handling
When the API returns a non-success status code (4xx or 5xx response),
a subclass of `MultiOnError` will be thrown:
```ts
import { MultiOnError } from 'multion';
try {
await multion.browse(...);
} catch (err) {
if (err instanceof MultiOnError) {
console.log(err.statusCode);
console.log(err.message);
console.log(err.body);
}
}
```
## Advanced
### Retries
The MultiOn Node SDK is instrumented with automatic retries with exponential backoff. A request will be
retried as long as the request is deemed retriable and the number of retry attempts has not grown larger
than the configured retry limit (default: 2).
A request is deemed retriable when any of the following HTTP status codes is returned:
* [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
* [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
* [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
Use the `maxRetries` request option to configure this behavior.
```ts
const response = multion.browse({ url: "https://google.com" }, {
maxRetries: 0 // override maxRetries at the request level
});
```
### Timeouts
The SDK defaults to a 60 second timout. Use the `timeoutInSeconds` option to
configure this behavior.
```ts
const response = multion.browse({ url: "https://google.com" }, {
timeoutInSeconds: 30 // override timeout to 30s
});
```
### Custom HTTP client
The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're
running in an unsupported environment, this provides a way for you to break the glass and
ensure the SDK works.
```ts
import { MultiOnClient } from 'multion';
const multion = new MultiOnClient({
apiKey: "...",
fetcher: // provide your implementation here
});
```
## Runtime compatiblity
The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK
works in the following runtimes:
The following runtimes are supported:
* Node.js 18+
* Vercel
* Cloudflare Workers
* Deno v1.25+
* Bun 1.0+
# Python SDK
> MultiOn for Python
## Installation
```bash
pip install multion
# or
poetry add multion
```
## Usage
Simply import MultiOn and start making calls to our API.
```python
from multion.client import MultiOn
client = MultiOn(
api_key="YOUR_API_KEY" # defaults to os.getenv("MULTION_API_KEY")
)
response = client.browse(
url="https://google.com"
)
```
## Async Client
The SDK also exports an async client so that you can make non-blocking
calls to our API.
```python
from multion.client import AsyncMultiOn
client = AsyncMultiOn(
api_key="YOUR_API_KEY" # defaults to os.getenv("MULTION_API_KEY")
)
async def main() -> None:
await response = client.browse(
url="https://google.com"
)
asyncio.run(main())
```
## Exception Handling
All errors thrown by the SDK will be subclasses of `ApiError`.
```python
import multion
try:
client.browse(...)
except multion.core.ApiError as e: # handle all errors
print(e.status_code)
print(e.body)
```
## Advanced
### Retries
The MultiOn SDK is instrumented with automatic retries with exponential backoff. A request will be
retried as long as the request is deemed retriable and the number of retry attempts has not grown larger
than the configured retry limit.
A request is deemed retriable when any of the following HTTP status codes is returned:
* [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
* [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
* [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
Use the `max_retries` request option to configure this behavior.
```python
from multion.client import MultiOn
client = MultiOn()
client.browse(url="https://google.com", {
max_retries=1 # override retries for a specific method
})
```
### Timeouts
By default, requests time out after 60 seconds. You can configure this with a
timeout option at the client or request level.
```python
from multion.client import MultiOn
client = MultiOn(
timeout=30.0, # all timeouts are 30 seconds
)
client.brwose(url="https://google.com", {
timeout_in_seconds=30.0 # override timeout for a specific method
})
```
### Custom HTTP client
You can override the httpx client to customize it for your use-case. Some common use-cases
include support for proxies and transports.
```python
import httpx
from multion.client import MultiOn
client = MultiOn(
http_client=httpx.Client(
proxies="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
)
```
# Browse
POST https://api.multion.ai/v1/web/browse
Content-Type: application/json
Allows for browsing the web using detailed natural language commands.
The function supports multi-step command execution based on the `CONTINUE` status of the Agent.
Reference: https://docs.multion.ai/api-reference/autonomous-api-reference/browse
## OpenAPI Specification
```yaml
openapi: 3.1.0
info:
title: API
version: 1.0.0
paths:
/browse:
post:
operationId: browse
summary: Browse
description: >-
Allows for browsing the web using detailed natural language commands.
The function supports multi-step command execution based on the
`CONTINUE` status of the Agent.
tags:
- ''
parameters:
- name: X_MULTION_API_KEY
in: header
required: true
schema:
type: string
responses:
'200':
description: Response with status 200
content:
application/json:
schema:
$ref: '#/components/schemas/type_:BrowseOutput'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/type_:BadRequestResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/type_:UnauthorizedResponse'
'402':
description: Payment Required
content:
application/json:
schema:
$ref: '#/components/schemas/type_:PaymentRequiredResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/type_:HTTPValidationError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/type_:InternalServerErrorResponse'
requestBody:
content:
application/json:
schema:
type: object
properties:
cmd:
type: string
description: >-
A specific natural language instruction for the agent to
execute
url:
type: string
description: >-
The URL to start or continue browsing from. (Default:
google.com)
local:
type: boolean
description: >-
Boolean flag to indicate if session to be run locally or in
the cloud (Default: False). If set to true, the session will
be run locally via your chrome extension. If set to false,
the session will be run in the cloud.
session_id:
type: string
description: Continues the session with session_id if provided.
max_steps:
type: integer
default: 20
description: 'Maximum number of steps to execute. (Default: 20)'
include_screenshot:
type: boolean
description: >-
Boolean flag to include a screenshot of the final page.
(Default: False)
temperature:
type: number
format: double
description: The temperature of model
agent_id:
type: string
description: The agent id to use for the session.
mode:
$ref: '#/components/schemas/type_:Mode'
use_proxy:
type: boolean
description: >-
Boolean flag to use a proxy for the session (Default:
False). Each Session gets a new Residential IP.
required:
- cmd
servers:
- url: https://api.multion.ai/v1/web
components:
schemas:
type_:Mode:
type: string
enum:
- fast
- standard
description: The mode you would like to use for the session. 'fast' or 'standard'
title: Mode
type_:Metadata:
type: object
properties:
step_count:
type: integer
description: Number of steps executed to complete browse request.
processing_time:
type: integer
description: Time taken to process the request in seconds.
temperature:
type: number
format: double
description: The temperature of model
description: Additional metadata for the session
title: Metadata
type_:BrowseOutput:
type: object
properties:
message:
type: string
description: The final message or result of the browsing session.
status:
type: string
description: >-
The final status of the browsing session. One of ["CONTINUE",
"ASK_USER", "DONE"]
url:
type: string
description: The current URL of the session.
screenshot:
type: string
description: image url of the screenshot taken during the session.
session_id:
type: string
description: The unique identifier for the session.
metadata:
$ref: '#/components/schemas/type_:Metadata'
description: Additional metadata for the session
required:
- message
- status
- url
- screenshot
- session_id
title: BrowseOutput
type_:BadRequestResponse:
type: object
properties:
statusCode:
type: integer
error:
type: string
message:
type: string
title: BadRequestResponse
type_:UnauthorizedResponse:
type: object
properties:
statusCode:
type: integer
error:
type: string
message:
type: string
title: UnauthorizedResponse
type_:PaymentRequiredResponse:
type: object
properties:
statusCode:
type: integer
error:
type: string
message:
type: string
title: PaymentRequiredResponse
type_:ValidationErrorLocItem:
oneOf:
- type: string
- type: integer
title: ValidationErrorLocItem
type_:ValidationError:
type: object
properties:
loc:
type: array
items:
$ref: '#/components/schemas/type_:ValidationErrorLocItem'
msg:
type: string
type:
type: string
required:
- loc
- msg
- type
title: ValidationError
type_:HTTPValidationError:
type: object
properties:
detail:
type: array
items:
$ref: '#/components/schemas/type_:ValidationError'
title: HTTPValidationError
type_:InternalServerErrorResponse:
type: object
properties:
statusCode:
type: integer
error:
type: string
message:
type: string
title: InternalServerErrorResponse
securitySchemes:
default:
type: apiKey
in: header
name: X_MULTION_API_KEY
```
## SDK Code Examples
```python
import requests
url = "https://api.multion.ai/v1/web/browse"
payload = {
"cmd": "Find the top post on Hackernews.",
"url": "https://news.ycombinator.com/"
}
headers = {
"X_MULTION_API_KEY": "",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
```
```typescript
import { MultiOnClient } from "multion";
const client = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
await client.browse({
cmd: "Find the top post on Hackernews.",
url: "https://news.ycombinator.com/"
});
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.multion.ai/v1/web/browse"
payload := strings.NewReader("{\n \"cmd\": \"Find the top post on Hackernews.\",\n \"url\": \"https://news.ycombinator.com/\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X_MULTION_API_KEY", "")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
```
```ruby
require 'uri'
require 'net/http'
url = URI("https://api.multion.ai/v1/web/browse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X_MULTION_API_KEY"] = ''
request["Content-Type"] = 'application/json'
request.body = "{\n \"cmd\": \"Find the top post on Hackernews.\",\n \"url\": \"https://news.ycombinator.com/\"\n}"
response = http.request(request)
puts response.read_body
```
```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse response = Unirest.post("https://api.multion.ai/v1/web/browse")
.header("X_MULTION_API_KEY", "")
.header("Content-Type", "application/json")
.body("{\n \"cmd\": \"Find the top post on Hackernews.\",\n \"url\": \"https://news.ycombinator.com/\"\n}")
.asString();
```
```php
request('POST', 'https://api.multion.ai/v1/web/browse', [
'body' => '{
"cmd": "Find the top post on Hackernews.",
"url": "https://news.ycombinator.com/"
}',
'headers' => [
'Content-Type' => 'application/json',
'X_MULTION_API_KEY' => '',
],
]);
echo $response->getBody();
```
```csharp
using RestSharp;
var client = new RestClient("https://api.multion.ai/v1/web/browse");
var request = new RestRequest(Method.POST);
request.AddHeader("X_MULTION_API_KEY", "");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"cmd\": \"Find the top post on Hackernews.\",\n \"url\": \"https://news.ycombinator.com/\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```
```swift
import Foundation
let headers = [
"X_MULTION_API_KEY": "",
"Content-Type": "application/json"
]
let parameters = [
"cmd": "Find the top post on Hackernews.",
"url": "https://news.ycombinator.com/"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://api.multion.ai/v1/web/browse")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
```
# Retrieve
POST https://api.multion.ai/v1/web/retrieve
Content-Type: application/json
Retrieve data from webpage based on a url and natural language command that guides agents data extraction process.
The function can create a new session or be used as part of a session.
Reference: https://docs.multion.ai/api-reference/autonomous-api-reference/retrieve
## OpenAPI Specification
```yaml
openapi: 3.1.0
info:
title: API
version: 1.0.0
paths:
/retrieve:
post:
operationId: retrieve
summary: Retrieve
description: >-
Retrieve data from webpage based on a url and natural language command
that guides agents data extraction process.
The function can create a new session or be used as part of a session.
tags:
- ''
parameters:
- name: X_MULTION_API_KEY
in: header
required: true
schema:
type: string
responses:
'200':
description: Response with status 200
content:
application/json:
schema:
$ref: '#/components/schemas/type_:RetrieveOutput'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/type_:HTTPValidationError'
requestBody:
content:
application/json:
schema:
type: object
properties:
cmd:
type: string
default: ''
description: >-
A specific natural language instruction on data the agent
should extract.
url:
type: string
description: The URL to create or continue session from.
session_id:
type: string
description: Continues the session with session_id if provided.
local:
type: boolean
description: >-
Boolean flag to indicate if session to be run locally or in
the cloud (Default: False). If set to true, the session will
be run locally via your chrome extension. If set to false,
the session will be run in the cloud.
fields:
type: array
items:
type: string
description: List of fields (columns) to be outputted in data.
format:
$ref: '#/components/schemas/type_:Format'
max_items:
type: number
format: double
default: 100
description: 'Maximum number of data items to retrieve. (Default: 100)'
full_page:
type: boolean
description: >-
Flag to retrieve full page (Default: True). If set to false,
the data will only be retrieved from the current session
viewport.
render_js:
type: boolean
description: >-
Flag to include rich JS and ARIA elements in data retrieved.
(Default: False)
scroll_to_bottom:
type: boolean
description: >-
Flag to scroll to the bottom of the page (Default: False).
If set to true, the page will be scrolled to the bottom for
a maximum of 5 seconds before data is retrieved.
mode:
type: string
default: fast
description: >-
The mode you would like to use for the session. 'standard',
'fast' or 'ludicrous'
include_screenshot:
type: boolean
description: >-
Flag to include a screenshot with the response. (Default:
False)
optional_params:
type: object
additionalProperties:
description: Any type
description: Additional optional parameters for the session.
required:
- cmd
servers:
- url: https://api.multion.ai/v1/web
components:
schemas:
type_:Format:
type: string
enum:
- json
- markdown
description: 'The format of the response data. (Default: json)'
title: Format
type_:RetrieveOutput:
type: object
properties:
message:
type: string
description: information relating to response
url:
type: string
description: The last accessed URL during the session.
screenshot:
type: string
description: image url of the screenshot taken during the session.
session_id:
type: string
description: The unique identifier for the session.
status:
type: string
description: The current status of the session.
data:
type: array
items:
type: object
additionalProperties:
description: Any type
description: Array of data objects, each containing data requested in fields.
required:
- message
- url
- status
- data
title: RetrieveOutput
type_:ValidationErrorLocItem:
oneOf:
- type: string
- type: integer
title: ValidationErrorLocItem
type_:ValidationError:
type: object
properties:
loc:
type: array
items:
$ref: '#/components/schemas/type_:ValidationErrorLocItem'
msg:
type: string
type:
type: string
required:
- loc
- msg
- type
title: ValidationError
type_:HTTPValidationError:
type: object
properties:
detail:
type: array
items:
$ref: '#/components/schemas/type_:ValidationError'
title: HTTPValidationError
securitySchemes:
default:
type: apiKey
in: header
name: X_MULTION_API_KEY
```
## SDK Code Examples
```python
import requests
url = "https://api.multion.ai/v1/web/retrieve"
payload = {
"cmd": "Find the top post on Hackernews and get its title and points.",
"url": "https://news.ycombinator.com/",
"fields": ["title", "points"]
}
headers = {
"X_MULTION_API_KEY": "",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
```
```typescript
import { MultiOnClient } from "multion";
const client = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
await client.retrieve({
cmd: "Find the top post on Hackernews and get its title and points.",
url: "https://news.ycombinator.com/",
fields: ["title", "points"]
});
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.multion.ai/v1/web/retrieve"
payload := strings.NewReader("{\n \"cmd\": \"Find the top post on Hackernews and get its title and points.\",\n \"url\": \"https://news.ycombinator.com/\",\n \"fields\": [\n \"title\",\n \"points\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X_MULTION_API_KEY", "")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
```
```ruby
require 'uri'
require 'net/http'
url = URI("https://api.multion.ai/v1/web/retrieve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X_MULTION_API_KEY"] = ''
request["Content-Type"] = 'application/json'
request.body = "{\n \"cmd\": \"Find the top post on Hackernews and get its title and points.\",\n \"url\": \"https://news.ycombinator.com/\",\n \"fields\": [\n \"title\",\n \"points\"\n ]\n}"
response = http.request(request)
puts response.read_body
```
```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse response = Unirest.post("https://api.multion.ai/v1/web/retrieve")
.header("X_MULTION_API_KEY", "")
.header("Content-Type", "application/json")
.body("{\n \"cmd\": \"Find the top post on Hackernews and get its title and points.\",\n \"url\": \"https://news.ycombinator.com/\",\n \"fields\": [\n \"title\",\n \"points\"\n ]\n}")
.asString();
```
```php
request('POST', 'https://api.multion.ai/v1/web/retrieve', [
'body' => '{
"cmd": "Find the top post on Hackernews and get its title and points.",
"url": "https://news.ycombinator.com/",
"fields": [
"title",
"points"
]
}',
'headers' => [
'Content-Type' => 'application/json',
'X_MULTION_API_KEY' => '',
],
]);
echo $response->getBody();
```
```csharp
using RestSharp;
var client = new RestClient("https://api.multion.ai/v1/web/retrieve");
var request = new RestRequest(Method.POST);
request.AddHeader("X_MULTION_API_KEY", "");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"cmd\": \"Find the top post on Hackernews and get its title and points.\",\n \"url\": \"https://news.ycombinator.com/\",\n \"fields\": [\n \"title\",\n \"points\"\n ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```
```swift
import Foundation
let headers = [
"X_MULTION_API_KEY": "",
"Content-Type": "application/json"
]
let parameters = [
"cmd": "Find the top post on Hackernews and get its title and points.",
"url": "https://news.ycombinator.com/",
"fields": ["title", "points"]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://api.multion.ai/v1/web/retrieve")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
```
# Create Session
POST https://api.multion.ai/v1/web/session
Content-Type: application/json
Creates a new session and returns session details including a unique session ID. A session remains active for 10 minutes of inactivity.
Reference: https://docs.multion.ai/api-reference/sessions/create
## OpenAPI Specification
```yaml
openapi: 3.1.0
info:
title: API
version: 1.0.0
paths:
/session:
post:
operationId: create
summary: Create Session
description: >-
Creates a new session and returns session details including a unique
session ID. A session remains active for 10 minutes of inactivity.
tags:
- subpackage_sessions
parameters:
- name: X_MULTION_API_KEY
in: header
required: true
schema:
type: string
responses:
'200':
description: Response with status 200
content:
application/json:
schema:
$ref: '#/components/schemas/type_:SessionCreated'
'422':
description: Validation error for the request parameters
content:
application/json:
schema:
$ref: '#/components/schemas/type_:HTTPValidationError'
requestBody:
content:
application/json:
schema:
type: object
properties:
url:
type: string
description: The URL to create or continue session from.
local:
type: boolean
description: >-
Boolean flag to indicate if session to be run locally or in
the cloud (Default: False). If set to true, the session will
be run locally via your chrome extension. If set to false,
the session will be run in the cloud.
agent_id:
type: string
description: The agent id to use for the session.
mode:
$ref: '#/components/schemas/type_:Mode'
use_proxy:
type: boolean
description: >-
Boolean flag to use a proxy for the session (Default:
False). Each Session gets a new Residential IP.
browser_params:
$ref: >-
#/components/schemas/type_sessions:CreateSessionInputBrowserParams
description: >-
Object containing height and width for the browser screen
size.
include_screenshot:
type: boolean
optional_params:
type: object
additionalProperties:
description: Any type
description: Additional optional parameters for the session.
required:
- url
servers:
- url: https://api.multion.ai/v1/web
components:
schemas:
type_:Mode:
type: string
enum:
- fast
- standard
description: The mode you would like to use for the session. 'fast' or 'standard'
title: Mode
type_sessions:CreateSessionInputBrowserParams:
type: object
properties:
height:
type: number
format: double
width:
type: number
format: double
description: Object containing height and width for the browser screen size.
title: CreateSessionInputBrowserParams
type_:SessionCreated:
type: object
properties:
status:
type: string
description: >-
The final status of the browsing session. One of ["CONTINUE",
"ASK_USER", "DONE"]
message:
type: string
description: A message providing more details about the session status.
session_id:
type: string
description: The unique identifier for the session.
url:
type: string
description: The URL associated with the session.
screenshot:
type: string
description: image url of the screenshot taken during the session.
required:
- status
- message
- session_id
- url
- screenshot
title: SessionCreated
type_:ValidationErrorLocItem:
oneOf:
- type: string
- type: integer
title: ValidationErrorLocItem
type_:ValidationError:
type: object
properties:
loc:
type: array
items:
$ref: '#/components/schemas/type_:ValidationErrorLocItem'
msg:
type: string
type:
type: string
required:
- loc
- msg
- type
title: ValidationError
type_:HTTPValidationError:
type: object
properties:
detail:
type: array
items:
$ref: '#/components/schemas/type_:ValidationError'
title: HTTPValidationError
securitySchemes:
default:
type: apiKey
in: header
name: X_MULTION_API_KEY
```
## SDK Code Examples
```python
import requests
url = "https://api.multion.ai/v1/web/session"
payload = { "url": "url" }
headers = {
"X_MULTION_API_KEY": "",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
```
```typescript
import { MultiOnClient } from "multion";
const client = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
await client.sessions.create({
url: "url"
});
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.multion.ai/v1/web/session"
payload := strings.NewReader("{\n \"url\": \"url\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X_MULTION_API_KEY", "")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
```
```ruby
require 'uri'
require 'net/http'
url = URI("https://api.multion.ai/v1/web/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X_MULTION_API_KEY"] = ''
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"url\"\n}"
response = http.request(request)
puts response.read_body
```
```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse response = Unirest.post("https://api.multion.ai/v1/web/session")
.header("X_MULTION_API_KEY", "")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"url\"\n}")
.asString();
```
```php
request('POST', 'https://api.multion.ai/v1/web/session', [
'body' => '{
"url": "url"
}',
'headers' => [
'Content-Type' => 'application/json',
'X_MULTION_API_KEY' => '',
],
]);
echo $response->getBody();
```
```csharp
using RestSharp;
var client = new RestClient("https://api.multion.ai/v1/web/session");
var request = new RestRequest(Method.POST);
request.AddHeader("X_MULTION_API_KEY", "");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"url\": \"url\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```
```swift
import Foundation
let headers = [
"X_MULTION_API_KEY": "",
"Content-Type": "application/json"
]
let parameters = ["url": "url"] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://api.multion.ai/v1/web/session")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
```
# Step Session
POST https://api.multion.ai/v1/web/session/{session_id}
Content-Type: application/json
Allows for browsing the web using detailed natural language instructions in a step mode for a session with a given session ID
Reference: https://docs.multion.ai/api-reference/sessions/step
## OpenAPI Specification
```yaml
openapi: 3.1.0
info:
title: API
version: 1.0.0
paths:
/session/{session_id}:
post:
operationId: step
summary: Step Session
description: >-
Allows for browsing the web using detailed natural language instructions
in a step mode for a session with a given session ID
tags:
- subpackage_sessions
parameters:
- name: session_id
in: path
required: true
schema:
type: string
- name: X_MULTION_API_KEY
in: header
required: true
schema:
type: string
responses:
'200':
description: Response with status 200
content:
application/json:
schema:
$ref: '#/components/schemas/type_:SessionStepSuccess'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/type_:HTTPValidationError'
requestBody:
content:
application/json:
schema:
type: object
properties:
cmd:
type: string
default: ''
description: A specific natural language instruction for the next step.
url:
type: string
description: The URL to create or continue session from.
stream:
type: boolean
enum:
- false
description: >-
Boolean flag to stream results back to the client (Default:
False)
browser_params:
$ref: >-
#/components/schemas/type_sessions:SessionsStepRequestBrowserParams
description: >-
Object containing height and width for the browser screen
size.
temperature:
type: number
format: double
description: The temperature of model
agent_id:
type: string
description: The agent id to use for the session.
mode:
$ref: '#/components/schemas/type_:Mode'
include_screenshot:
type: boolean
optional_params:
type: object
additionalProperties:
description: Any type
description: Additional optional parameters for the session.
required:
- cmd
- stream
servers:
- url: https://api.multion.ai/v1/web
components:
schemas:
type_sessions:SessionsStepRequestBrowserParams:
type: object
properties:
height:
type: number
format: double
width:
type: number
format: double
description: Object containing height and width for the browser screen size.
title: SessionsStepRequestBrowserParams
type_:Mode:
type: string
enum:
- fast
- standard
description: The mode you would like to use for the session. 'fast' or 'standard'
title: Mode
type_:SessionStepSuccessMetadata:
type: object
properties:
temperature:
type: number
format: double
description: The temperature of model
description: Additional metadata for the step session.
title: SessionStepSuccessMetadata
type_:SessionStepSuccess:
type: object
properties:
status:
type: string
description: >-
The final status of the browsing session. One of ["CONTINUE",
"ASK_USER", "DONE"]
message:
type: string
description: A message providing more details about the session status.
session_id:
type: string
description: The unique identifier for the session.
url:
type: string
description: The URL associated with the session.
screenshot:
type: string
description: image url of the screenshot taken during the session.
metadata:
$ref: '#/components/schemas/type_:SessionStepSuccessMetadata'
description: Additional metadata for the step session.
required:
- status
- message
- session_id
- url
- screenshot
title: SessionStepSuccess
type_:ValidationErrorLocItem:
oneOf:
- type: string
- type: integer
title: ValidationErrorLocItem
type_:ValidationError:
type: object
properties:
loc:
type: array
items:
$ref: '#/components/schemas/type_:ValidationErrorLocItem'
msg:
type: string
type:
type: string
required:
- loc
- msg
- type
title: ValidationError
type_:HTTPValidationError:
type: object
properties:
detail:
type: array
items:
$ref: '#/components/schemas/type_:ValidationError'
title: HTTPValidationError
securitySchemes:
default:
type: apiKey
in: header
name: X_MULTION_API_KEY
```
## SDK Code Examples
```python
import requests
url = "https://api.multion.ai/v1/web/session/session_id"
payload = {
"cmd": "cmd",
"stream": False
}
headers = {
"X_MULTION_API_KEY": "",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
```
```typescript
import { MultiOnClient } from "multion";
const client = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
await client.sessions.step("session_id", {
cmd: "cmd"
});
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.multion.ai/v1/web/session/session_id"
payload := strings.NewReader("{\n \"cmd\": \"cmd\",\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X_MULTION_API_KEY", "")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
```
```ruby
require 'uri'
require 'net/http'
url = URI("https://api.multion.ai/v1/web/session/session_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X_MULTION_API_KEY"] = ''
request["Content-Type"] = 'application/json'
request.body = "{\n \"cmd\": \"cmd\",\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body
```
```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse response = Unirest.post("https://api.multion.ai/v1/web/session/session_id")
.header("X_MULTION_API_KEY", "")
.header("Content-Type", "application/json")
.body("{\n \"cmd\": \"cmd\",\n \"stream\": false\n}")
.asString();
```
```php
request('POST', 'https://api.multion.ai/v1/web/session/session_id', [
'body' => '{
"cmd": "cmd",
"stream": false
}',
'headers' => [
'Content-Type' => 'application/json',
'X_MULTION_API_KEY' => '',
],
]);
echo $response->getBody();
```
```csharp
using RestSharp;
var client = new RestClient("https://api.multion.ai/v1/web/session/session_id");
var request = new RestRequest(Method.POST);
request.AddHeader("X_MULTION_API_KEY", "");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"cmd\": \"cmd\",\n \"stream\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```
```swift
import Foundation
let headers = [
"X_MULTION_API_KEY": "",
"Content-Type": "application/json"
]
let parameters = [
"cmd": "cmd",
"stream": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://api.multion.ai/v1/web/session/session_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
```
# Close Session
DELETE https://api.multion.ai/v1/web/session/{session_id}
Closes the session.
Reference: https://docs.multion.ai/api-reference/sessions/close
## OpenAPI Specification
```yaml
openapi: 3.1.0
info:
title: API
version: 1.0.0
paths:
/session/{session_id}:
delete:
operationId: close
summary: Close Session
description: Closes the session.
tags:
- subpackage_sessions
parameters:
- name: session_id
in: path
required: true
schema:
type: string
- name: X_MULTION_API_KEY
in: header
required: true
schema:
type: string
responses:
'200':
description: Response with status 200
content:
application/json:
schema:
$ref: '#/components/schemas/type_sessions:SessionsCloseResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/type_:HTTPValidationError'
servers:
- url: https://api.multion.ai/v1/web
components:
schemas:
type_sessions:SessionsCloseResponse:
type: object
properties:
status:
type: string
description: response data
session_id:
type: string
description: The unique identifier for the session, duplicated for convenience.
required:
- status
- session_id
title: SessionsCloseResponse
type_:ValidationErrorLocItem:
oneOf:
- type: string
- type: integer
title: ValidationErrorLocItem
type_:ValidationError:
type: object
properties:
loc:
type: array
items:
$ref: '#/components/schemas/type_:ValidationErrorLocItem'
msg:
type: string
type:
type: string
required:
- loc
- msg
- type
title: ValidationError
type_:HTTPValidationError:
type: object
properties:
detail:
type: array
items:
$ref: '#/components/schemas/type_:ValidationError'
title: HTTPValidationError
securitySchemes:
default:
type: apiKey
in: header
name: X_MULTION_API_KEY
```
## SDK Code Examples
```python
import requests
url = "https://api.multion.ai/v1/web/session/session_id"
headers = {"X_MULTION_API_KEY": ""}
response = requests.delete(url, headers=headers)
print(response.json())
```
```typescript
import { MultiOnClient } from "multion";
const client = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
await client.sessions.close("session_id");
```
```go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.multion.ai/v1/web/session/session_id"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X_MULTION_API_KEY", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
```
```ruby
require 'uri'
require 'net/http'
url = URI("https://api.multion.ai/v1/web/session/session_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X_MULTION_API_KEY"] = ''
response = http.request(request)
puts response.read_body
```
```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse response = Unirest.delete("https://api.multion.ai/v1/web/session/session_id")
.header("X_MULTION_API_KEY", "")
.asString();
```
```php
request('DELETE', 'https://api.multion.ai/v1/web/session/session_id', [
'headers' => [
'X_MULTION_API_KEY' => '',
],
]);
echo $response->getBody();
```
```csharp
using RestSharp;
var client = new RestClient("https://api.multion.ai/v1/web/session/session_id");
var request = new RestRequest(Method.DELETE);
request.AddHeader("X_MULTION_API_KEY", "");
IRestResponse response = client.Execute(request);
```
```swift
import Foundation
let headers = ["X_MULTION_API_KEY": ""]
let request = NSMutableURLRequest(url: NSURL(string: "https://api.multion.ai/v1/web/session/session_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
```
# Screenshot
GET https://api.multion.ai/v1/web/screenshot/{session_id}
Retrieve the screenshot of the session.
Reference: https://docs.multion.ai/api-reference/sessions/screenshot
## OpenAPI Specification
```yaml
openapi: 3.1.0
info:
title: API
version: 1.0.0
paths:
/screenshot/{session_id}:
get:
operationId: screenshot
summary: Screenshot
description: Retrieve the screenshot of the session.
tags:
- subpackage_sessions
parameters:
- name: session_id
in: path
required: true
schema:
type: string
- name: X_MULTION_API_KEY
in: header
required: true
schema:
type: string
responses:
'200':
description: Response with status 200
content:
application/json:
schema:
$ref: '#/components/schemas/type_sessions:SessionsScreenshotResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/type_:HTTPValidationError'
servers:
- url: https://api.multion.ai/v1/web
components:
schemas:
type_sessions:SessionsScreenshotResponse:
type: object
properties:
screenshot:
type: string
description: Image url of the screenshot taken during the session.
required:
- screenshot
title: SessionsScreenshotResponse
type_:ValidationErrorLocItem:
oneOf:
- type: string
- type: integer
title: ValidationErrorLocItem
type_:ValidationError:
type: object
properties:
loc:
type: array
items:
$ref: '#/components/schemas/type_:ValidationErrorLocItem'
msg:
type: string
type:
type: string
required:
- loc
- msg
- type
title: ValidationError
type_:HTTPValidationError:
type: object
properties:
detail:
type: array
items:
$ref: '#/components/schemas/type_:ValidationError'
title: HTTPValidationError
securitySchemes:
default:
type: apiKey
in: header
name: X_MULTION_API_KEY
```
## SDK Code Examples
```python
import requests
url = "https://api.multion.ai/v1/web/screenshot/session_id"
headers = {"X_MULTION_API_KEY": ""}
response = requests.get(url, headers=headers)
print(response.json())
```
```typescript
import { MultiOnClient } from "multion";
const client = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
await client.sessions.screenshot("session_id");
```
```go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.multion.ai/v1/web/screenshot/session_id"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X_MULTION_API_KEY", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
```
```ruby
require 'uri'
require 'net/http'
url = URI("https://api.multion.ai/v1/web/screenshot/session_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X_MULTION_API_KEY"] = ''
response = http.request(request)
puts response.read_body
```
```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse response = Unirest.get("https://api.multion.ai/v1/web/screenshot/session_id")
.header("X_MULTION_API_KEY", "")
.asString();
```
```php
request('GET', 'https://api.multion.ai/v1/web/screenshot/session_id', [
'headers' => [
'X_MULTION_API_KEY' => '',
],
]);
echo $response->getBody();
```
```csharp
using RestSharp;
var client = new RestClient("https://api.multion.ai/v1/web/screenshot/session_id");
var request = new RestRequest(Method.GET);
request.AddHeader("X_MULTION_API_KEY", "");
IRestResponse response = client.Execute(request);
```
```swift
import Foundation
let headers = ["X_MULTION_API_KEY": ""]
let request = NSMutableURLRequest(url: NSURL(string: "https://api.multion.ai/v1/web/screenshot/session_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
```
# List Sessions
GET https://api.multion.ai/v1/web/sessions
Retrieve a list of active session IDs.
Reference: https://docs.multion.ai/api-reference/sessions/list
## OpenAPI Specification
```yaml
openapi: 3.1.0
info:
title: API
version: 1.0.0
paths:
/sessions:
get:
operationId: list
summary: List Sessions
description: Retrieve a list of active session IDs.
tags:
- subpackage_sessions
parameters:
- name: X_MULTION_API_KEY
in: header
required: true
schema:
type: string
responses:
'200':
description: Response with status 200
content:
application/json:
schema:
$ref: '#/components/schemas/type_sessions:SessionsListResponse'
servers:
- url: https://api.multion.ai/v1/web
components:
schemas:
type_sessions:SessionsListResponse:
type: object
properties:
session_ids:
type: array
items:
type: string
description: The list of active session IDs.
required:
- session_ids
title: SessionsListResponse
securitySchemes:
default:
type: apiKey
in: header
name: X_MULTION_API_KEY
```
## SDK Code Examples
```python
import requests
url = "https://api.multion.ai/v1/web/sessions"
headers = {"X_MULTION_API_KEY": ""}
response = requests.get(url, headers=headers)
print(response.json())
```
```typescript
import { MultiOnClient } from "multion";
const client = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
await client.sessions.list();
```
```go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.multion.ai/v1/web/sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X_MULTION_API_KEY", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
```
```ruby
require 'uri'
require 'net/http'
url = URI("https://api.multion.ai/v1/web/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X_MULTION_API_KEY"] = ''
response = http.request(request)
puts response.read_body
```
```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse response = Unirest.get("https://api.multion.ai/v1/web/sessions")
.header("X_MULTION_API_KEY", "")
.asString();
```
```php
request('GET', 'https://api.multion.ai/v1/web/sessions', [
'headers' => [
'X_MULTION_API_KEY' => '',
],
]);
echo $response->getBody();
```
```csharp
using RestSharp;
var client = new RestClient("https://api.multion.ai/v1/web/sessions");
var request = new RestRequest(Method.GET);
request.AddHeader("X_MULTION_API_KEY", "");
IRestResponse response = client.Execute(request);
```
```swift
import Foundation
let headers = ["X_MULTION_API_KEY": ""]
let request = NSMutableURLRequest(url: NSURL(string: "https://api.multion.ai/v1/web/sessions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
```
# Developer Platform
> MultiOn developer platform release notes 💪
See all the latest changes in the MultiOn Agent API and developer platform.
## June 18, 2024
* Complete documentation overhaul with new guides, examples, and release notes!
## June 14, 2024
* New [retrieve](/autonomous-api/retrieve) is live with faster speeds and better accuracy. Learn more about it [here](/learn/retrieve).
# Browser Extension
> MultiOn browser extension release notes 💪
See all the latest changes in the MultiOn browser extension.
Official MultiOn browser extension release notes