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

> ## Agent Instructions
> Start with /introduction/getting-started. Use the Inference API's Direct Query endpoint (POST /api/inference/query) with the newton-c-2.6 or newton-fusion-1.0 model (text, image, and video reasoning) or the omega-embedding encoder (time-series embeddings). ATAI_API_ENDPOINT is the base URL https://platform.u1.archetypeai.app with no version path; every endpoint path begins with /api. Pages whose descriptions are marked (Archived) document the legacy Lens runtime — do not use them for new projects.

# List Session Events

> Page through a session's lifecycle events

Requires [version 2.0.1](https://docs.archetypeai.app/release-notes/2.0.x.md#v2-0-1) or later of the Archetype platform.

## Overview

This endpoint returns a page of a session's lifecycle events, newest first. The platform records
an event when the session is opened, dispatched, finished, or cancelled, and when it fails, with
why. A `serving` session's events also say why it ended when its deployment ended it.

## Request

**session\_id** `string` *required*

Session `ses_` id.

**limit** `integer` (default: 100)

Page size. Minimum `1`, maximum `1000`.

**after** `string`

Forward cursor: return events older than this page. Pass the previous page's `next_cursor`. The
cursor is opaque: never compute on it. Mutually exclusive with `before`.

**before** `string`

Backward cursor: return events newer than this page. Opaque, as `after` is. Mutually exclusive
with `after`.

## Response

**data** `array` *required*

The page, newest first.

**has\_more** `boolean` *required*

True when more events exist beyond this page in the direction of travel.

**next\_cursor** `string`

Cursor for the next page in the same direction. Pass it as `after` when paging forward, or as
`before` when you supplied `before`. `null` when `has_more` is false.

**prev\_cursor** `string`

Cursor to step back the way this page was reached. Pass it as `before` after a forward page, or
as `after` after a backward one. `null` when the request carried no cursor.

### Event object

**level** `string` *required*

Severity of the event: `info`, `warning`, or `error`.

**message** `string` *required*

What happened: the session was dispatched, finished, was cancelled, or failed and why.

**created\_at** `string` *required*

When the event was recorded (date-time).

```bash cURL theme={"system"}
curl "$ATAI_API_ENDPOINT/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events?limit=50" \
  -H "Authorization: Bearer $ATAI_API_KEY"
```

```python Python theme={"system"}
import os
import requests

base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]

response = requests.get(
    f"{base_url}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events",
    headers={"Authorization": f"Bearer {api_key}"},
    params={"limit": 50},
)

if response.status_code == 200:
    for event in response.json()["data"]:
        print(event["created_at"], event["level"], event["message"])
else:
    print(f"Error: {response.json()['errors']}")
```

```javascript JavaScript theme={"system"}
const response = await fetch(
  `${process.env.ATAI_API_ENDPOINT}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events?limit=50`,
  {
    headers: {
      'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
    }
  }
);

const body = await response.json();

if (response.ok) {
  body.data.forEach((event) => console.log(event.created_at, event.level, event.message));
} else {
  console.error('Error:', body.errors);
}
```

```json 200 - Page of events theme={"system"}
{
  "data": [
    {
      "level": "info",
      "message": "session opened",
      "created_at": "2026-10-29T16:05:00Z"
    }
  ],
  "has_more": false,
  "next_cursor": null,
  "prev_cursor": null
}
```

## Important Notes

> [!NOTE]
>
> * Passing both `after` and `before` returns `400`, as does a malformed cursor.
> * A `404` means the session does not exist, belongs to another organization, or is in a project you cannot see.
> * Events are the platform's record of the session's lifecycle, not its job's log lines.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.