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

# Sessions

> Understanding and managing Stelis sessions

Sessions in Stelis allow you to maintain state across multiple automation steps, enabling complex, multi-step workflows.

## What is a Session?

A session represents a single browser instance that persists across multiple API calls. This allows you to:

* Maintain login states
* Handle multi-page workflows
* Interact with dynamic content that requires waiting or multiple steps

## Creating a Session

To create a session, use the `POST /session` endpoint:

```javascript theme={null}
const session = await stelis.createSession({
  headless: true,
  incognito: false
});

console.log(session.id);
```

## Using a Session

Once you have a session ID, you can use it for subsequent API calls:

```javascript theme={null}
const result = await stelis.executeStep(sessionId, {
  action: "click",
  selector: "#submit-button"
});
```

## Closing a Session

Always close your sessions when you're done to free up resources:

```javascript theme={null}
await stelis.closeSession(sessionId);
```

## Best Practices

* Use sessions for related tasks that require maintaining state
* Close sessions as soon as you're done with them
* Be mindful of session timeouts and handle reconnections gracefully

For more detailed API information on sessions, check our [Step API Reference](/api-reference/step-api).
