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

# History Back

> Navigate back in the active tab's history.

## Overview

The `/browser/sessions/{id}/back` endpoint moves the active tab one step backwards in its history stack, equivalent to clicking the browser's back button. The call blocks until the configured wait condition is met or the timeout elapses.

When the browser's back-forward cache is warm, this returns almost instantly. If there is no previous history entry the endpoint returns `409 Conflict`.

## Path Parameters

<ParamField path="id" type="string" required={true}>
  Browser session ID (UUID). Create via `POST /browser/sessions`.
</ParamField>

## Body

All body fields are optional — the request body may be omitted entirely.

<ParamField body="waitUntil" type="string" default="load">
  When to consider the navigation finished. One of `load`, `domcontentloaded`, `networkidle`.
</ParamField>

<ParamField body="timeout" type="integer" default="30000">
  Maximum time (ms) to wait for navigation. Range `0`–`120000`.
</ParamField>

## Example Request

<CodeGroup>
  ```bash cURL (default) theme={null}
  curl -X POST "https://api.scrapengine.io/api/v1/browser/sessions/0f2b1f6a-88ac-4d25-bc58-67a6f4b4a001/back" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{}'
  ```

  ```bash cURL (custom wait) theme={null}
  curl -X POST "https://api.scrapengine.io/api/v1/browser/sessions/0f2b1f6a-88ac-4d25-bc58-67a6f4b4a001/back" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "waitUntil": "domcontentloaded",
      "timeout": 15000
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.scrapengine.io/api/v1/browser/sessions/0f2b1f6a-88ac-4d25-bc58-67a6f4b4a001/back",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ waitUntil: "domcontentloaded" }),
    },
  );
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.scrapengine.io/api/v1/browser/sessions/0f2b1f6a-88ac-4d25-bc58-67a6f4b4a001/back"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
  }
  payload = {"waitUntil": "domcontentloaded"}

  response = requests.post(url, headers=headers, json=payload)
  data = response.json()
  ```
</CodeGroup>

## Response

### Success Response (200)

<ResponseField name="url" type="string">
  Effective URL of the active tab after moving backwards.
</ResponseField>

<ResponseField name="pageId" type="string">
  CDP target identifier of the tab the operation applied to.
</ResponseField>

**Example Response:**

```json theme={null}
{
  "url": "https://example.com/",
  "pageId": "EA5E9AA71C7A91C467F8CDBB266EE5E0"
}
```

### Error Responses

| Status | Description                                                                |
| ------ | -------------------------------------------------------------------------- |
| `401`  | Unauthorized — invalid or missing API key.                                 |
| `404`  | Session not found or not owned by the caller.                              |
| `408`  | Navigation did not complete before `timeout` elapsed.                      |
| `409`  | No previous history entry — the active tab is already at the oldest entry. |
| `503`  | The browser session is temporarily unreachable.                            |

## Notes

* Returns almost immediately when the browser's back-forward cache (`bfcache`) is warm.
* A `409 Conflict` means there is nothing to go back to — check history length before calling, or handle the error as a no-op.
