Retrieve

POST

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.

Request

This endpoint expects an object.
cmd
stringRequired
A specific natural language instruction on data the agent should extract.
url
stringOptional
The URL to create or continue session from.
session_id
stringOptional

Continues the session with session_id if provided.

local
booleanOptional
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
list of stringsOptional
List of fields (columns) to be outputted in data.
format
"json"Optional
Format of response data. (Default: json)
max_items
doubleOptionalDefaults to 100
Maximum number of data items to retrieve. (Default: 100)
full_page
booleanOptional
Flag to retrieve full page (Default: True). If set to false, the data will only be retrieved from the current session viewport.
render_js
booleanOptional
Flag to include rich JS and ARIA elements in data retrieved. (Default: False)
scroll_to_bottom
booleanOptional
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.
include_screenshot
booleanOptional
Flag to include a screenshot with the response. (Default: False)

Response

This endpoint returns an object
message
string
information relating to response
url
string
The last accessed URL during the session.
status
string
The current status of the session.
data
list of maps from strings to any
Array of data objects, each containing data requested in fields.
screenshot
stringOptional
image url of the screenshot taken during the session.
session_id
stringOptional
The unique identifier for the session.

Errors

POST
1curl -X POST https://api.multion.ai/v1/web/retrieve \
2 -H "X_MULTION_API_KEY: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "cmd": "Find the top post on Hackernews and get its title and points.",
6 "url": "https://news.ycombinator.com/",
7 "fields": [
8 "title",
9 "points"
10 ]
11}'
1{
2 "message": "Retrieved data successfully",
3 "url": "https://news.ycombinator.com/",
4 "status": "DONE",
5 "data": [
6 {
7 "title": "Show HN: Sonauto – a more controllable AI music creator",
8 "points": 219
9 }
10 ],
11 "screenshot": "https://api.multion.ai/v1/web/screenshot/1",
12 "session_id": "1"
13}