> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.multion.ai/api-reference/sessions/step-stream/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.multion.ai/_mcp/server. # 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 ## Authentication - `X_MULTION_API_KEY` header (required) — API Key authentication via header ## Request ### Path parameters - `session_id` (string, required) ### Body (application/json) This endpoint expects an object. - `cmd` (string, required, default: ) — A specific natural language instruction for the next step. - `stream` (true, required) — Boolean flag to stream results back to the client (Default: False) - `url` (string, optional) — The URL to create or continue session from. - `browser_params` (SessionsStepStreamRequestBrowserParams, optional) — Object containing height and width for the browser screen size. - `temperature` (double, optional) — The temperature of model - `agent_id` (string, optional) — The agent id to use for the session. - `mode` (enum, optional) — The mode you would like to use for the session. 'fast' or 'standard' - Allowed values: `fast`, `standard` - `include_screenshot` (boolean, optional) - `optional_params` (map from string to any, optional) — Additional optional parameters for the session. ## Response ### 200 - Streaming response of `SessionStepStreamChunk`. - `type`: `event` - `data` (SessionStreamChunkEventData, required) — The delta object for the session. - `session_id` (string, optional) — The unique identifier for the session. - `type`: `final_event` - `data` (SessionStreamChunkFinalEventData, required) — The final delta object for the session. - `screenshot` (string, optional) — image url of the screenshot taken during the session. - `session_id` (string, optional) — The unique identifier for the session. ## Errors ### 422 Unprocessable Entity Validation Error - `detail` (list of ValidationError, optional) ## Types ### SessionsStepStreamRequestBrowserParams Object containing height and width for the browser screen size. - `height` (double, optional) - `width` (double, optional) ### SessionStreamChunkEventData The delta object for the session. - `delta` (SessionStreamChunkEventDataDelta, required) — The delta object for the session. ### SessionStreamChunkFinalEventData The final delta object for the session. - `delta` (SessionStreamChunkFinalEventDataDelta, required) — The final delta object for the session. ### ValidationError - `loc` (list of ValidationErrorLocItem, required) - `msg` (string, required) - `type` (string, required) ### SessionStreamChunkEventDataDelta The delta object for the session. - `content` (string, required) — A message providing more details about the session status. - `url` (string, required) — The URL associated with the session. ### SessionStreamChunkFinalEventDataDelta The final delta object for the session. - `content` (string, required) — A message providing more details about the session status. - `url` (string, required) — The URL associated with the session. - `status` (string, required) — The final status of the browsing session. One of ["CONTINUE", "ASK_USER", "DONE"] ### ValidationErrorLocItem ## Examples **Request** ```json { "cmd": "string", "stream": true } ``` **Response** ```json [ { "type": "event", "data": { "delta": { "content": "string", "url": "string" } }, "session_id": "string" }, { "type": "event", "data": { "delta": { "content": "string", "url": "string" } }, "session_id": "string" } ] ``` **SDK Code** ```python import requests url = "https://api.multion.ai/v1/web/session/%3Asession_id" payload = { "cmd": "string", "stream": True } headers = { "X_MULTION_API_KEY": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```typescript import { MultiOnClient, MultiOn } from "multion"; const client = new MultiOnClient({ apiKey: "YOUR_API_KEY" }); await client.sessions.stepStream("string", { cmd: "string", url: "string", browserParams: { height: 1.1, width: 1.1 }, temperature: 1.1, agentId: "string", mode: MultiOn.Mode.Fast, includeScreenshot: true, optionalParams: { "string": { "key": "value" } } }); ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.multion.ai/v1/web/session/%3Asession_id" payload := strings.NewReader("{\n \"cmd\": \"string\",\n \"stream\": true\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/%3Asession_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\": \"string\",\n \"stream\": true\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/%3Asession_id") .header("X_MULTION_API_KEY", "") .header("Content-Type", "application/json") .body("{\n \"cmd\": \"string\",\n \"stream\": true\n}") .asString(); ``` ```php request('POST', 'https://api.multion.ai/v1/web/session/%3Asession_id', [ 'body' => '{ "cmd": "string", "stream": true }', '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/%3Asession_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\": \"string\",\n \"stream\": true\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "X_MULTION_API_KEY": "", "Content-Type": "application/json" ] let parameters = [ "cmd": "string", "stream": true ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.multion.ai/v1/web/session/%3Asession_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() ```