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

# Get Events

> Poll for session events

Get buffered events for a session. Use polling to follow the agent's progress in real time.

## Request

```bash theme={null}
curl "https://api.tapkit.ai/v1/sessions/{session_id}/events?since=0" \
  -H "X-API-Key: joot_your_api_key"
```

### Path Parameters

| Parameter    | Type     | Description            |
| ------------ | -------- | ---------------------- |
| `session_id` | `string` | The session identifier |

### Query Parameters

| Parameter | Type      | Default | Description                         |
| --------- | --------- | ------- | ----------------------------------- |
| `since`   | `integer` | `0`     | Get events starting from this index |

## Response

**Status: 200 OK**

```json theme={null}
{
  "events": [
    {
      "index": 0,
      "type": "agent_action",
      "ts": "2024-01-15T10:30:05Z",
      "data": {
        "action": "screenshot",
        "description": "Taking screenshot to see current screen"
      }
    },
    {
      "index": 1,
      "type": "agent_action",
      "ts": "2024-01-15T10:30:07Z",
      "data": {
        "action": "tap",
        "description": "Tapping Instagram icon",
        "x": 200,
        "y": 400
      }
    }
  ],
  "next_index": 2
}
```

### Response Fields

| Field            | Type      | Description                            |
| ---------------- | --------- | -------------------------------------- |
| `events`         | `array`   | Array of event objects                 |
| `events[].index` | `integer` | Sequential event index                 |
| `events[].type`  | `string`  | Event type                             |
| `events[].ts`    | `string`  | ISO 8601 timestamp                     |
| `events[].data`  | `object`  | Event-specific data                    |
| `next_index`     | `integer` | Pass this as `since` in your next poll |

## Examples

### Polling Loop

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

session_id = "sess_abc123"
next_index = 0

while True:
    response = requests.get(
        f"https://api.tapkit.ai/v1/sessions/{session_id}/events",
        headers={"X-API-Key": "joot_..."},
        params={"since": next_index}
    )
    data = response.json()

    for event in data["events"]:
        print(f"[{event['type']}] {event['data']}")

    next_index = data["next_index"]
    time.sleep(1)
```

## Related Endpoints

* [Get Session](/api-reference/sessions/get-session) - Get session status
* [Send Message](/api-reference/sessions/send-message) - Send a follow-up message to the agent
* [Stop Session](/api-reference/sessions/stop) - Kill a running session
