# Session Management

Source: https://docs.scrappey.com/docs/api-reference/sessions

> Create and destroy persistent browser sessions that retain cookies and browser state, reducing repeated setup and overhead for subsequent requests.

## sessions.create

This launches a new browser instance that retains cookies until you destroy it with [`sessions.destroy`](/docs/sessions-destroy). Use sessions when you want to reuse cookies and browser state across requests and skip the overhead of spinning up a new browser each time. For the full parameter list (proxy, browser, device, OS), see [`sessions.create`](/docs/sessions-create); for state that persists across many requests, see [Profiles](/docs/profiles).

### Parameters

| Parameter | Type   | Required | Description                                         |
| --------- | ------ | -------- | --------------------------------------------------- |
| `cmd`     | string | Yes      | Must be `sessions.create`.                          |
| `session` | string | Yes      | A unique identifier for the browser session to create. |

### Request

```json
{
  "cmd": "sessions.create",
  "session": "my-session-id"
}
```

## sessions.destroy

This properly shuts down a browser instance. When you no longer need a session, close it to free resources.

### Parameters

| Parameter | Type   | Required | Description                                           |
| --------- | ------ | -------- | ----------------------------------------------------- |
| `cmd`     | string | Yes      | Must be `sessions.destroy`.                           |
| `session` | string | Yes      | The identifier of the browser session to destroy.     |

### Request

```json
{
  "cmd": "sessions.destroy",
  "session": "my-session-id"
}
```

## Related concepts

Go deeper in the [Scrappey knowledge base](https://scrappey.com/qa):

- [Stateful web scraping](https://scrappey.com/qa/web-scraping-apis/what-is-stateful-web-scraping) — reusing cookies and state across requests
- [Session cookie](https://scrappey.com/qa/anti-bot/what-is-a-session-cookie) — the cookie that ties a session together
