> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anchorbrowser.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Sessions

> SDK reference for the Sessions resource (TypeScript & Python)

## List Sessions History Page

`GET /v1/sessions` — listSessions

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.listSessions();
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.list_sessions()
  print(result)
  ```
</CodeGroup>

## Start Browser Session

`POST /v1/sessions` — createSession

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.createSession();
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.create_session()
  print(result)
  ```
</CodeGroup>

## Start Browser Session (async)

`POST /v1/sessions/async` — createSessionAsync

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.createSessionAsync();
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.create_session_async()
  print(result)
  ```
</CodeGroup>

## Async Session Status

`GET /v1/sessions/async/{request_id}/status` — getAsyncSessionStatus

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.getAsyncSessionStatus({
    path: {
      request_id: 'your-request-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.get_async_session_status(
      "your-request-id",
  )
  print(result)
  ```
</CodeGroup>

## End All Sessions

`DELETE /v1/sessions/all` — deleteAllSessions

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.deleteAllSessions();
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.delete_all_sessions()
  print(result)
  ```
</CodeGroup>

## List All Sessions Status

`GET /v1/sessions/all/status` — getAllSessionsStatus

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.getAllSessionsStatus();
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.get_all_sessions_status()
  print(result)
  ```
</CodeGroup>

## Get Sessions History

`GET /v1/sessions/history` — getSessionsHistory

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.getSessionsHistory();
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.get_sessions_history()
  print(result)
  ```
</CodeGroup>

## Get Browser Session

`GET /v1/sessions/{session_id}` — getSession

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.getSession({
    path: {
      session_id: 'your-session-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.get_session(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## End Browser Session

`DELETE /v1/sessions/{session_id}` — deleteSession

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.deleteSession({
    path: {
      session_id: 'your-session-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.delete_session(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## Get Browser Session Pages

`GET /v1/sessions/{session_id}/pages` — getSessionPages

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.getSessionPages({
    path: {
      session_id: 'your-session-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.get_session_pages(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## Upload Files

`POST /v1/sessions/{sessionId}/uploads` — uploadFile

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.uploadFile({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      file: new File(['file content'], 'file.txt')
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.upload_file(
      "your-session-id",
      file=("file.txt", b"file content"),
  )
  print(result)
  ```
</CodeGroup>

## List Session Downloads

`GET /v1/sessions/{session_id}/downloads` — getSessionDownloads

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.getSessionDownloads({
    path: {
      session_id: 'your-session-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.get_session_downloads(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## Take Screenshot

`GET /v1/sessions/{sessionId}/screenshot` — getSessionScreenshot

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.getSessionScreenshot({
    path: {
      sessionId: 'your-sessionId'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.get_session_screenshot(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## Mouse Click

`POST /v1/sessions/{sessionId}/mouse/click` — mouseClick

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.mouseClick({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {}
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.mouse_click(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## Mouse Double Click

`POST /v1/sessions/{sessionId}/mouse/doubleClick` — mouseDoubleClick

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.mouseDoubleClick({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      x: 1,
      y: 1
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.mouse_double_click(
      "your-session-id",
      x=1,
      y=1,
  )
  print(result)
  ```
</CodeGroup>

## Mouse Down

`POST /v1/sessions/{sessionId}/mouse/down` — mouseDown

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.mouseDown({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      x: 1,
      y: 1
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.mouse_down(
      "your-session-id",
      x=1,
      y=1,
  )
  print(result)
  ```
</CodeGroup>

## Mouse Up

`POST /v1/sessions/{sessionId}/mouse/up` — mouseUp

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.mouseUp({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      x: 1,
      y: 1
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.mouse_up(
      "your-session-id",
      x=1,
      y=1,
  )
  print(result)
  ```
</CodeGroup>

## Mouse Move

`POST /v1/sessions/{sessionId}/mouse/move` — mouseMove

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.mouseMove({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      x: 1,
      y: 1
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.mouse_move(
      "your-session-id",
      x=1,
      y=1,
  )
  print(result)
  ```
</CodeGroup>

## Drag and Drop

`POST /v1/sessions/{sessionId}/drag-and-drop` — dragAndDrop

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.dragAndDrop({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      startX: 1,
      startY: 1,
      endX: 1,
      endY: 1
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.drag_and_drop(
      "your-session-id",
      start_x=1,
      start_y=1,
      end_x=1,
      end_y=1,
  )
  print(result)
  ```
</CodeGroup>

## Scroll

`POST /v1/sessions/{sessionId}/scroll` — scroll

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.scroll({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      x: 1,
      y: 1,
      deltaY: 1
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.scroll(
      "your-session-id",
      x=1,
      y=1,
      delta_y=1,
  )
  print(result)
  ```
</CodeGroup>

## Type Text

`POST /v1/sessions/{sessionId}/keyboard/type` — keyboardType

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.keyboardType({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      text: 'string'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.keyboard_type(
      "your-session-id",
      text="string",
  )
  print(result)
  ```
</CodeGroup>

## Keyboard Shortcut

`POST /v1/sessions/{sessionId}/keyboard/shortcut` — keyboardShortcut

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.keyboardShortcut({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      keys: ['string']
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.keyboard_shortcut(
      "your-session-id",
      keys=["string"],
  )
  print(result)
  ```
</CodeGroup>

## Get Clipboard Content

`GET /v1/sessions/{sessionId}/clipboard` — getClipboard

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.getClipboard({
    path: {
      sessionId: 'your-sessionId'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.get_clipboard(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## Set Clipboard Content

`POST /v1/sessions/{sessionId}/clipboard` — setClipboard

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.setClipboard({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      text: 'string'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.set_clipboard(
      "your-session-id",
      text="string",
  )
  print(result)
  ```
</CodeGroup>

## Copy Selected Text

`POST /v1/sessions/{sessionId}/copy` — copy

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.copy({
    path: {
      sessionId: 'your-sessionId'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.copy(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## Paste Text

`POST /v1/sessions/{sessionId}/paste` — paste

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.paste({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      text: 'string'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.paste(
      "your-session-id",
      text="string",
  )
  print(result)
  ```
</CodeGroup>

## Navigate to URL

`POST /v1/sessions/{sessionId}/goto` — goto

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Sessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Sessions.goto({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      url: 'string'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.sessions.goto(
      "your-session-id",
      url="string",
  )
  print(result)
  ```
</CodeGroup>
