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

# 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

## Authentication

- `X_MULTION_API_KEY` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects an object.

- `url` (string, required) — The URL to create or continue session from.
- `local` (boolean, optional) — 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` (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`
- `use_proxy` (boolean, optional) — Boolean flag to use a proxy for the session (Default: False). Each Session gets a new Residential IP.
- `browser_params` (CreateSessionInputBrowserParams, optional) — Object containing height and width for the browser screen size.
- `include_screenshot` (boolean, optional)
- `optional_params` (map from string to any, optional) — Additional optional parameters for the session.

## Response

### 200

- `status` (string, required) — The final status of the browsing session. One of ["CONTINUE", "ASK_USER", "DONE"]
- `message` (string, required) — A message providing more details about the session status.
- `session_id` (string, required) — The unique identifier for the session.
- `url` (string, required) — The URL associated with the session.
- `screenshot` (string, required) — image url of the screenshot taken during the session.

## Errors

### 422 Unprocessable Entity

Validation error for the request parameters

- `detail` (list of ValidationError, optional)

## Types

### CreateSessionInputBrowserParams

Object containing height and width for the browser screen size.

- `height` (double, optional)
- `width` (double, optional)

### ValidationError

- `loc` (list of ValidationErrorLocItem, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItem

## Examples

**Request**

```json
{
  "url": "url"
}
```

**Response**

```json
{
  "status": "status",
  "message": "message",
  "session_id": "session_id",
  "url": "url",
  "screenshot": "screenshot"
}
```

**SDK Code**

```python
import requests

url = "https://api.multion.ai/v1/web/session"

payload = { "url": "url" }
headers = {
    "X_MULTION_API_KEY": "<apiKey>",
    "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", "<apiKey>")
	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"] = '<apiKey>'
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<String> response = Unirest.post("https://api.multion.ai/v1/web/session")
  .header("X_MULTION_API_KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"url\": \"url\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.multion.ai/v1/web/session', [
  'body' => '{
  "url": "url"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X_MULTION_API_KEY' => '<apiKey>',
  ],
]);

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", "<apiKey>");
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": "<apiKey>",
  "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()
```